当前位置: 首页>>代码示例>>C++>>正文


C++ TType::getTypeName方法代码示例

本文整理汇总了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);
    }
}
开发者ID:Ajunboys,项目名称:mozilla-os2,代码行数:35,代码来源:OutputGLSLBase.cpp

示例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());
}
开发者ID:BrunoReX,项目名称:palemoon,代码行数:28,代码来源:OutputGLSLBase.cpp

示例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
}
开发者ID:jtorresfabra,项目名称:GLSL-Debugger,代码行数:25,代码来源:intermOut.cpp

示例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";
    }
}
开发者ID:jtorresfabra,项目名称:GLSL-Debugger,代码行数:19,代码来源:intermOut.cpp

示例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;
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:20,代码来源:ParseHelper.cpp

示例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;
}
开发者ID:Ajunboys,项目名称:mozilla-os2,代码行数:23,代码来源:ParseHelper.cpp


注:本文中的TType::getTypeName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。