本文整理汇总了C++中TType::getTypeName方法的典型用法代码示例。如果您正苦于以下问题:C++ TType::getTypeName方法的具体用法?C++ TType::getTypeName怎么用?C++ TType::getTypeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TType
的用法示例。
在下文中一共展示了TType::getTypeName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeVariableType
void TOutputGLSLBase::writeVariableType(const TType& type)
{
TInfoSinkBase& out = objSink();
TQualifier qualifier = type.getQualifier();
// TODO(alokp): Validate qualifier for variable declarations.
if ((qualifier != EvqTemporary) && (qualifier != EvqGlobal))
out << type.getQualifierString() << " ";
// Declare the struct if we have not done so already.
if ((type.getBasicType() == EbtStruct) &&
(mDeclaredStructs.find(type.getTypeName()) == mDeclaredStructs.end()))
{
out << "struct " << type.getTypeName() << "{\n";
const TTypeList* structure = type.getStruct();
ASSERT(structure != NULL);
for (size_t i = 0; i < structure->size(); ++i)
{
const TType* fieldType = (*structure)[i].type;
ASSERT(fieldType != NULL);
if (writeVariablePrecision(fieldType->getPrecision()))
out << " ";
out << getTypeName(*fieldType) << " " << fieldType->getFieldName();
if (fieldType->isArray())
out << arrayBrackets(*fieldType);
out << ";\n";
}
out << "}";
mDeclaredStructs.insert(type.getTypeName());
}
else
{
if (writeVariablePrecision(type.getPrecision()))
out << " ";
out << getTypeName(type);
}
}
示例2: getTypeName
TString TOutputGLSLBase::getTypeName(const TType& type)
{
TInfoSinkBase out;
if (type.isMatrix())
{
out << "mat";
out << type.getNominalSize();
}
else if (type.isVector())
{
switch (type.getBasicType())
{
case EbtFloat: out << "vec"; break;
case EbtInt: out << "ivec"; break;
case EbtBool: out << "bvec"; break;
default: UNREACHABLE(); break;
}
out << type.getNominalSize();
}
else
{
if (type.getBasicType() == EbtStruct)
out << hashName(type.getTypeName());
else
out << type.getBasicString();
}
return TString(out.c_str());
}
示例3: OutputSpecification
bool OutputSpecification(TIntermSpecification* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
TInfoSink& out = oit->infoSink;
OutputExtensionText(out, node);
OutputTreeText(out, node, oit->depth);
TType* t = node->getType();
out.debug << "specify '" << t->getTypeName().c_str() << "' (" << t->getCompleteString() << ")\n";
return true;
#if 0
TTypeList* tl = t->getStruct();
TTypeList::iterator iter = tl->begin();
for(; iter < tl->end(); iter++) {
out.debug << FormatSourceRange(iter->line);
for (i = 0; i < (oit->depth+1); ++i) out.debug << " ";
out.debug << "'" << iter->type->getFieldName().c_str() << "' (" <<
iter->type->getCompleteString().c_str() << ")\n";
}
#endif
}
示例4: OutputParameter
void OutputParameter(TIntermParameter* node, TIntermTraverser* it)
{
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
TInfoSink& out = oit->infoSink;
OutputExtensionText(out, node);
OutputTreeText(out, node, oit->depth);
TType* t = node->getType();
if (t->getBasicType() != EbtStruct) {
out.debug << "param '" << t->getFieldName() << "' (" <<
t->getCompleteString() << ")\n";
} else {
out.debug << "param '" << t->getFieldName() << "' (" <<
t->getCompleteString() << " '" <<
t->getTypeName() << "')\n";
}
}
示例5: structNestingErrorCheck
bool TParseContext::structNestingErrorCheck(TSourceLoc line, const TType& fieldType)
{
if (shaderSpec != SH_WEBGL_SPEC) {
return false;
}
if (fieldType.getBasicType() != EbtStruct) {
return false;
}
// We're already inside a structure definition at this point, so add
// one to the field's struct nesting.
if (1 + fieldType.getDeepestStructNesting() > kWebGLMaxStructNesting) {
error(line, "", "", "Reference of struct type %s exceeds maximum struct nesting of %d",
fieldType.getTypeName().c_str(), kWebGLMaxStructNesting);
return true;
}
return false;
}
示例6: structNestingErrorCheck
bool TParseContext::structNestingErrorCheck(TSourceLoc line, const TType& fieldType)
{
if (!isWebGLBasedSpec(shaderSpec)) {
return false;
}
if (fieldType.getBasicType() != EbtStruct) {
return false;
}
// We're already inside a structure definition at this point, so add
// one to the field's struct nesting.
if (1 + fieldType.getDeepestStructNesting() > kWebGLMaxStructNesting) {
std::stringstream extraInfoStream;
extraInfoStream << "Reference of struct type " << fieldType.getTypeName()
<< " exceeds maximum struct nesting of " << kWebGLMaxStructNesting;
std::string extraInfo = extraInfoStream.str();
error(line, "", "", extraInfo.c_str());
return true;
}
return false;
}