• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TType的典型用法代码示例。如果您正苦于以下问题:C++ TType类的具体用法?C++ TType怎么用?C++ TType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: getTypeName

TString TOutputGLSLBase::getTypeName(const TType &type)
{
    if (type.getBasicType() == EbtStruct)
        return hashName(type.getStruct()->name());
    else
        return type.getBuiltInTypeNameString();
}
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:7,代码来源:OutputGLSLBase.cpp


示例2: switch

BuiltInFunctionEmulator::TBuiltInFunction
BuiltInFunctionEmulator::IdentifyFunction(
    TOperator op, const TType& param)
{
    if (param.getNominalSize() > 4 || param.getSecondarySize() > 4)
        return TFunctionUnknown;
    unsigned int function = TFunctionUnknown;
    switch (op) {
        case EOpCos:
            function = TFunctionCos1;
            break;
        case EOpLength:
            function = TFunctionLength1;
            break;
        case EOpNormalize:
            function = TFunctionNormalize1;
            break;
        default:
            break;
    }
    if (function == TFunctionUnknown)
        return TFunctionUnknown;
    if (param.isVector())
        function += param.getNominalSize() - 1;
    return static_cast<TBuiltInFunction>(function);
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:26,代码来源:BuiltInFunctionEmulator.cpp


示例3: writeQualifier

void TOutputVulkanGLSL::writeQualifier(TQualifier qualifier,
                                       const TType &type,
                                       const TSymbol *symbol)
{
    if (qualifier != EvqUniform && qualifier != EvqAttribute && qualifier != EvqVertexIn &&
        !sh::IsVarying(qualifier))
    {
        TOutputGLSLBase::writeQualifier(qualifier, type, symbol);
        return;
    }

    if (symbol == nullptr)
    {
        return;
    }

    ImmutableString name = symbol->name();

    // For interface blocks, use the block name instead.  When the qualifier is being replaced in
    // the backend, that would be the name that's available.
    if (type.isInterfaceBlock())
    {
        name = type.getInterfaceBlock()->name();
    }

    TInfoSinkBase &out = objSink();
    out << "@@ QUALIFIER-" << name.data() << " @@ ";
}
开发者ID:google,项目名称:angle,代码行数:28,代码来源:OutputVulkanGLSL.cpp


示例4: 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


示例5: traverse

void GetVariableTraverser::traverse(const TType &type, const TString &name, std::vector<VarT> *output)
{
    const TStructure *structure = type.getStruct();

    VarT variable;
    variable.name = name.c_str();
    variable.arraySize = static_cast<unsigned int>(type.getArraySize());

    if (!structure)
    {
        variable.type = GLVariableType(type);
        variable.precision = GLVariablePrecision(type);
    }
    else
    {
        // Note: this enum value is not exposed outside ANGLE
        variable.type = GL_STRUCT_ANGLEX;
        variable.structName = structure->name().c_str();

        const TFieldList &fields = structure->fields();

        for (size_t fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
        {
            TField *field = fields[fieldIndex];
            traverse(*field->type(), field->name(), &variable.fields);
        }
    }

    visitVariable(&variable);

    ASSERT(output);
    output->push_back(variable);
}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:33,代码来源:util.cpp


示例6: resolveInOutLocation

    int resolveInOutLocation(EShLanguage /*stage*/, const char* /*name*/, const TType& type, bool /*is_live*/) override
    {
        // kick out of not doing this
        if (!doAutoLocationMapping)
            return -1;

        // no locations added if already present, or a built-in variable
        if (type.getQualifier().hasLocation() || type.isBuiltIn())
            return -1;

        // no locations on blocks of built-in variables
        if (type.isStruct()) {
            if (type.getStruct()->size() < 1)
                return -1;
            if ((*type.getStruct())[0].type->isBuiltIn())
                return -1;
        }

        // Placeholder.
        // TODO: It would be nice to flesh this out using 
        // intermediate->computeTypeLocationSize(type), or functions that call it like
        // intermediate->addUsedLocation()
        // These in turn would want the intermediate, which is not available here, but
        // is available in many places, and a lot of copying from it could be saved if
        // it were just available.
        return 0;
    }
开发者ID:CallmeNezha,项目名称:bgfx,代码行数:27,代码来源:iomapper.cpp


示例7: if

TType *TCodeGenerator::EmitSimpleExpression(void)
{
    TType      *pOperandType;      // ptr to operand's type
    TType      *pResultType;       // ptr to result type
    TTokenCode  op;                // operator
    TTokenCode  unaryOp = tcPlus;  // unary operator

    //--Unary + or -
    if (TokenIn(token, tlUnaryOps)) {
	unaryOp = token;
	GetToken();
    }

    //--Emit code for the first term.
    pResultType = EmitTerm();

    //--If there was a unary operator, negate in integer value in ax
    //--with the neg instruction, or negate a real value in dx:ax
    //--by calling _FloatNegate.
    if (unaryOp == tcMinus) {
	if (pResultType->Base() == pIntegerType) Emit1(neg, Reg(ax))
	else if (pResultType == pRealType) {
	    EmitPushOperand(pResultType);
	    Emit1(call, NameLit(FLOAT_NEGATE));
	    Emit2(add,  Reg(sp), IntegerLit(4));
	}
    }

    //--Loop to execute subsequent additive operators and terms.
    while (TokenIn(token, tlAddOps)) {
	op = token;
	pResultType = pResultType->Base();
	EmitPushOperand(pResultType);

	GetToken();
	pOperandType = EmitTerm()->Base();

	//--Perform the operation, and push the resulting value
	//--onto the stack.
	if (op == tcOR) {

	    //--boolean OR boolean => boolean
	    //--ax = ax OR dx
	    Emit1(pop, Reg(dx));
	    Emit2(or,  Reg(ax), Reg(dx));
	    pResultType = pBooleanType;
	}
	else if ((pResultType  == pIntegerType) &&
		 (pOperandType == pIntegerType)) {

	    //--integer +|- integer => integer
	    Emit1(pop, Reg(dx));
	    if (op == tcPlus) Emit2(add, Reg(ax), Reg(dx))
	    else {
		Emit2(sub, Reg(dx), Reg(ax));
		Emit2(mov, Reg(ax), Reg(dx));
	    }
	    pResultType = pIntegerType;
	}
	else {
开发者ID:soshimozi,项目名称:PascalCompiler,代码行数:60,代码来源:EMITEXPR.CPP


示例8: addConstArrayNode

//
// This function returns an element of an array accessed from a constant array. The values are retrieved from
// the symbol table and parse-tree is built for the type of the element. The input 
// to the function could either be a symbol node (a[0] where a is a constant array)that represents a 
// constant array or it could be the tree representation of the constant array (s.a1[0] where s is a constant structure)
//
TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, TSourceLoc line)
{
    TIntermTyped* typedNode;
    TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
    TType arrayElementType = node->getType();
    arrayElementType.clearArrayness();

    if (index >= node->getType().getArraySize()) {
        error(line, "", "[", "array field selection out of range '%d'", index);
        recover();
        index = 0;
    }

    int arrayElementSize = arrayElementType.getObjectSize();

    if (tempConstantNode) {
         ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
         typedNode = intermediate.addConstantUnion(&unionArray[arrayElementSize * index], tempConstantNode->getType(), line);
    } else {
        error(line, "Cannot offset into the array", "Error", "");
        recover();

        return 0;
    }

    return typedNode;
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:33,代码来源:ParseHelper.cpp


示例9: ArrayString

TString ArrayString(const TType &type)
{
    if (!type.isArray())
    {
        return "";
    }

    return "[" + str(type.getArraySize()) + "]";
}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:9,代码来源:util.cpp


示例10: parameterSamplerErrorCheck

bool TParseContext::parameterSamplerErrorCheck(int line, TQualifier qualifier, const TType& type)
{
    if ((qualifier == EvqOut || qualifier == EvqInOut) && 
             type.getBasicType() != EbtStruct && IsSampler(type.getBasicType())) {
        error(line, "samplers cannot be output parameters", type.getBasicString(), "");
        return true;
    }

    return false;
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:10,代码来源:ParseHelper.cpp


示例11: writeLayoutQualifier

void TOutputGLSLBase::writeLayoutQualifier(const TType &type)
{
    if (type.getQualifier() == EvqFragmentOut || type.getQualifier() == EvqVertexIn)
    {
        const TLayoutQualifier &layoutQualifier = type.getLayoutQualifier();
        if (layoutQualifier.location >= 0)
        {
            TInfoSinkBase &out = objSink();
            out << "layout(location = " << layoutQualifier.location << ") ";
        }
    }
}
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:12,代码来源:OutputGLSLBase.cpp


示例12: SamplerString

void UniformHLSL::outputHLSL4_0_FL9_3Sampler(TInfoSinkBase &out,
                                             const TType &type,
                                             const TName &name,
                                             const unsigned int registerIndex)
{
    out << "uniform " << SamplerString(type.getBasicType()) << " sampler_"
        << DecorateUniform(name, type) << ArrayString(type) << " : register(s" << str(registerIndex)
        << ");\n";
    out << "uniform " << TextureString(type.getBasicType()) << " texture_"
        << DecorateUniform(name, type) << ArrayString(type) << " : register(t" << str(registerIndex)
        << ");\n";
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:12,代码来源:UniformHLSL.cpp


示例13: ASSERT

void RegenerateStructNames::visitSymbol(TIntermSymbol *symbol)
{
    ASSERT(symbol);
    TType *type = symbol->getTypePointer();
    ASSERT(type);
    TStructure *userType = type->getStruct();
    if (!userType)
        return;

    if (mSymbolTable.findBuiltIn(userType->name(), mShaderVersion))
    {
        // Built-in struct, do not touch it.
        return;
    }

    int uniqueId = userType->uniqueId();

    ASSERT(mScopeDepth > 0);
    if (mScopeDepth == 1)
    {
        // If a struct is defined at global scope, we don't map its name.
        // This is because at global level, the struct might be used to
        // declare a uniform, so the same name needs to stay the same for
        // vertex/fragment shaders. However, our mapping uses internal ID,
        // which will be different for the same struct in vertex/fragment
        // shaders.
        // This is OK because names for any structs defined in other scopes
        // will begin with "_webgl", which is reserved. So there will be
        // no conflicts among unmapped struct names from global scope and
        // mapped struct names from other scopes.
        // However, we need to keep track of these global structs, so if a
        // variable is used in a local scope, we don't try to modify the
        // struct name through that variable.
        mDeclaredGlobalStructs.insert(uniqueId);
        return;
    }
    if (mDeclaredGlobalStructs.count(uniqueId) > 0)
        return;
    // Map {name} to _webgl_struct_{uniqueId}_{name}.
    const char kPrefix[] = "_webgl_struct_";
    if (userType->name().find(kPrefix) == 0)
    {
        // The name has already been regenerated.
        return;
    }
    std::string id = Str(uniqueId);
    TString tmp = kPrefix + TString(id.c_str());
    tmp += "_" + userType->name();
    userType->setName(tmp);
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:50,代码来源:RegenerateStructNames.cpp


示例14: 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


示例15: objSink

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


示例16: traverseSymbol

void TSamplerTraverser::traverseSymbol( TIntermSymbol *node, TIntermTraverser *it )
{
   TSamplerTraverser* sit = static_cast<TSamplerTraverser*>(it);

   if (sit->abort)
      return;

   if (sit->typing && sit->id == node->getId())
   {
      TType* type = node->getTypePointer();
      // Technically most of these should never happen
	  type->setBasicType (sit->sampType);
   }
}
开发者ID:CRivlaldo,项目名称:hlsl2glslfork,代码行数:14,代码来源:typeSamplers.cpp


示例17: containsSampler

bool TParseContext::containsSampler(TType& type)
{
    if (IsSampler(type.getBasicType()))
        return true;

    if (type.getBasicType() == EbtStruct) {
        TTypeList& structure = *type.getStruct();
        for (unsigned int i = 0; i < structure.size(); ++i) {
            if (containsSampler(*structure[i].type))
                return true;
        }
    }

    return false;
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:15,代码来源:ParseHelper.cpp


示例18: if

TString ScalarizeVecAndMatConstructorArgs::createTempVariable(TIntermTyped *original)
{
    TString tempVarName = "_webgl_tmp_";
    if (original->isScalar())
    {
        tempVarName += "scalar_";
    }
    else if (original->isVector())
    {
        tempVarName += "vec_";
    }
    else
    {
        ASSERT(original->isMatrix());
        tempVarName += "mat_";
    }
    tempVarName += Str(mTempVarCount).c_str();
    mTempVarCount++;

    ASSERT(original);
    TType type = original->getType();
    type.setQualifier(EvqTemporary);

    if (mShaderType == GL_FRAGMENT_SHADER &&
        type.getBasicType() == EbtFloat &&
        type.getPrecision() == EbpUndefined)
    {
        // We use the highest available precision for the temporary variable
        // to avoid computing the actual precision using the rules defined
        // in GLSL ES 1.0 Section 4.5.2.
        type.setPrecision(mFragmentPrecisionHigh ? EbpHigh : EbpMedium);
    }

    TIntermBinary *init = new TIntermBinary(EOpInitialize);
    TIntermSymbol *symbolNode = new TIntermSymbol(-1, tempVarName, type);
    init->setLeft(symbolNode);
    init->setRight(original);
    init->setType(type);

    TIntermAggregate *decl = new TIntermAggregate(EOpDeclaration);
    decl->getSequence()->push_back(init);

    ASSERT(mSequenceStack.size() > 0);
    TIntermSequence &sequence = mSequenceStack.back();
    sequence.push_back(decl);

    return tempVarName;
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:48,代码来源:ScalarizeVecAndMatConstructorArgs.cpp


示例19: TextureString

TString TextureString(const TType &type)
{
    switch (type.getBasicType())
    {
      case EbtSampler2D:            return "Texture2D";
      case EbtSamplerCube:          return "TextureCube";
      case EbtSamplerExternalOES:   return "Texture2D";
      case EbtSampler2DArray:       return "Texture2DArray";
      case EbtSampler3D:            return "Texture3D";
      case EbtISampler2D:           return "Texture2D<int4>";
      case EbtISampler3D:           return "Texture3D<int4>";
      case EbtISamplerCube:         return "Texture2DArray<int4>";
      case EbtISampler2DArray:      return "Texture2DArray<int4>";
      case EbtUSampler2D:           return "Texture2D<uint4>";
      case EbtUSampler3D:           return "Texture3D<uint4>";
      case EbtUSamplerCube:         return "Texture2DArray<uint4>";
      case EbtUSampler2DArray:      return "Texture2DArray<uint4>";
      case EbtSampler2DShadow:      return "Texture2D";
      case EbtSamplerCubeShadow:    return "TextureCube";
      case EbtSampler2DArrayShadow: return "Texture2DArray";
      default: UNREACHABLE();
    }

    return "<unknown texture type>";
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:25,代码来源:UtilsHLSL.cpp


示例20: assignSamplerInStructUniformRegister

unsigned int UniformHLSL::assignSamplerInStructUniformRegister(const TType &type,
                                                               const TString &name,
                                                               unsigned int *outRegisterCount)
{
    // Sampler that is a field of a uniform structure.
    ASSERT(IsSampler(type.getBasicType()));
    unsigned int registerIndex = mSamplerRegister;
    mUniformRegisterMap[std::string(name.c_str())] = registerIndex;
    unsigned int registerCount                     = type.isArray() ? type.getArraySize() : 1u;
    mSamplerRegister += registerCount;
    if (outRegisterCount)
    {
        *outRegisterCount = registerCount;
    }
    return registerIndex;
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:16,代码来源:UniformHLSL.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TTypeInfo类代码示例发布时间:2022-05-31
下一篇:
C++ TTrigger类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap