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


C++ TIntermSequence类代码示例

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


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

示例1: objSink

void TOutputGLSL::writeFunctionParameters(const TIntermSequence& args)
{
    TInfoSinkBase& out = objSink();
    for (TIntermSequence::const_iterator iter = args.begin();
         iter != args.end(); ++iter)
    {
        const TIntermSymbol* arg = (*iter)->getAsSymbolNode();
        ASSERT(arg != NULL);

        const TType& type = arg->getType();
        TQualifier qualifier = type.getQualifier();
        // TODO(alokp): Validate qualifier for function arguments.
        if ((qualifier != EvqTemporary) && (qualifier != EvqGlobal))
            out << type.getQualifierString() << " ";

        out << getTypeName(type);

        const TString& name = arg->getSymbol();
        if (!name.empty())
            out << " " << name;
        if (type.isArray())
            out << arrayBrackets(type);

        // Put a comma if this is not the last argument.
        if (iter != args.end() - 1)
            out << ", ";
    }
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:28,代码来源:OutputGLSL.cpp

示例2: isChildofMain

bool isChildofMain(TIntermNode *node, TIntermNode *root)
{
    TIntermNode *main = getFunctionBySignature(MAIN_FUNC_SIGNATURE, root);

    if (!main) {
        dbgPrint(DBGLVL_ERROR, "CodeTools - could not find main function\n");
        exit(1);
    }

    TIntermAggregate *aggregate;

    if (!(aggregate = main->getAsAggregate())) {
        dbgPrint(DBGLVL_ERROR, "CodeTools - main is not Aggregate\n");
        exit(1);
    }
    
    TIntermSequence sequence = aggregate->getSequence();
    TIntermSequence::iterator sit;

    for(sit = sequence.begin(); sit != sequence.end(); sit++) {
        if (*sit == node) {
            return true;
        }
    }

    return false;
}
开发者ID:flyncode,项目名称:GLSL-Debugger,代码行数:27,代码来源:CodeTools.cpp

示例3: getFunctionDebugParameter

int getFunctionDebugParameter(TIntermAggregate *node)
{
    int result = -1;
    int i;

    if (!node)
        return result;

    if ( node->getOp() != EOpFunction) {
        return result;
    }

    TIntermSequence funcDeclSeq = node->getSequence();
    
    if (!funcDeclSeq[0] ||
        !funcDeclSeq[0]->getAsAggregate() ||
        !(funcDeclSeq[0]->getAsAggregate()->getOp() == EOpParameters)) {
        dbgPrint(DBGLVL_ERROR, "CodeTools - function does not comply with assumptions\n");
        exit(1);
    }
    TIntermSequence funcDeclParamSeq = (funcDeclSeq[0]->getAsAggregate())->getSequence();
    TIntermSequence::iterator pD = funcDeclParamSeq.begin();
    
    for (i=0; pD != funcDeclParamSeq.end(); ++pD, ++i) {
        if ((*pD)->getAsFuncParamNode()->getType().getQualifier() == EvqIn) {
            result = i;
        }
    }

    return result;
}
开发者ID:flyncode,项目名称:GLSL-Debugger,代码行数:31,代码来源:CodeTools.cpp

示例4: getTypeDebugParameter

TType* getTypeDebugParameter(TIntermAggregate *node, int pnum)
{
	TType *result = NULL;

	if (!node)
		return result;

	if (node->getOp() != EOpFunctionCall)
		return result;

	TIntermSequence funcCallSeq = node->getSequence();

	if ((int) funcCallSeq.size() < pnum) {
		dbgPrint(DBGLVL_ERROR,
				"CodeTools -  function does not have this much parameter\n");
		exit(1);
	}

	if (!funcCallSeq[pnum]->getAsTyped()) {
		dbgPrint(DBGLVL_ERROR,
				"CodeTools -  in parameter is not of type TIntermTyped\n");
		exit(1);
	}

	return funcCallSeq[pnum]->getAsTyped()->getTypePointer();
}
开发者ID:10110111,项目名称:GLSL-Debugger,代码行数:26,代码来源:CodeTools.cpp

示例5: traverseAggregate

// Traverse an aggregate node.  Same comments in binary node apply here.
void TIntermTraverser::traverseAggregate(TIntermAggregate *node)
{
    bool visit = true;

    TIntermSequence *sequence = node->getSequence();

    if (preVisit)
        visit = visitAggregate(PreVisit, node);

    if (visit)
    {
        incrementDepth(node);

        for (auto *child : *sequence)
        {
            child->traverse(this);
            if (visit && inVisit)
            {
                if (child != sequence->back())
                    visit = visitAggregate(InVisit, node);
            }
        }

        decrementDepth();
    }

    if (visit && postVisit)
        visitAggregate(PostVisit, node);
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:30,代码来源:IntermTraverse.cpp

示例6: mergeLinkerObjects

//
// Merge the linker objects from unitLinkerObjects into linkerObjects.
// Duplication is expected and filtered out, but contradictions are an error.
//
void TIntermediate::mergeLinkerObjects(TInfoSink& infoSink, TIntermSequence& linkerObjects, const TIntermSequence& unitLinkerObjects)
{
    // Error check and merge the linker objects (duplicates should not be created)
    std::size_t initialNumLinkerObjects = linkerObjects.size();
    for (unsigned int unitLinkObj = 0; unitLinkObj < unitLinkerObjects.size(); ++unitLinkObj) {
        bool merge = true;
        for (std::size_t linkObj = 0; linkObj < initialNumLinkerObjects; ++linkObj) {
            TIntermSymbol* symbol = linkerObjects[linkObj]->getAsSymbolNode();
            TIntermSymbol* unitSymbol = unitLinkerObjects[unitLinkObj]->getAsSymbolNode();
            assert(symbol && unitSymbol);
            if (symbol->getName() == unitSymbol->getName()) {
                // filter out copy
                merge = false;

                // but if one has an initializer and the other does not, update
                // the initializer
                if (symbol->getConstArray().empty() && ! unitSymbol->getConstArray().empty())
                    symbol->setConstArray(unitSymbol->getConstArray());

                // Similarly for binding
                if (! symbol->getQualifier().hasBinding() && unitSymbol->getQualifier().hasBinding())
                    symbol->getQualifier().layoutBinding = unitSymbol->getQualifier().layoutBinding;

                // Update implicit array sizes
                mergeImplicitArraySizes(symbol->getWritableType(), unitSymbol->getType());

                // Check for consistent types/qualification/initializers etc.
                mergeErrorCheck(infoSink, *symbol, *unitSymbol, false);
            }
        }
        if (merge)
            linkerObjects.push_back(unitLinkerObjects[unitLinkObj]);
    }
}
开发者ID:AJ92,项目名称:renderdoc,代码行数:38,代码来源:linkValidate.cpp

示例7: traverseBlock

// Traverse a block node.
void TIntermTraverser::traverseBlock(TIntermBlock *node)
{
    bool visit = true;

    TIntermSequence *sequence = node->getSequence();

    if (preVisit)
        visit = visitBlock(PreVisit, node);

    if (visit)
    {
        incrementDepth(node);
        pushParentBlock(node);

        for (auto *child : *sequence)
        {
            child->traverse(this);
            if (visit && inVisit)
            {
                if (child != sequence->back())
                    visit = visitBlock(InVisit, node);
            }

            incrementParentBlockPos();
        }

        popParentBlock();
        decrementDepth();
    }

    if (visit && postVisit)
        visitBlock(PostVisit, node);
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:34,代码来源:IntermTraverse.cpp

示例8: ImmutableString

TIntermAggregate *EmulatePrecision::createCompoundAssignmentFunctionCallNode(TIntermTyped *left,
                                                                             TIntermTyped *right,
                                                                             const char *opNameStr)
{
    std::stringstream strstr = sh::InitializeStream<std::stringstream>();
    if (left->getPrecision() == EbpMedium)
        strstr << "angle_compound_" << opNameStr << "_frm";
    else
        strstr << "angle_compound_" << opNameStr << "_frl";
    ImmutableString functionName = ImmutableString(strstr.str());
    TIntermSequence *arguments   = new TIntermSequence();
    arguments->push_back(left);
    arguments->push_back(right);

    TVector<const TVariable *> parameters;
    TType *leftParamType = new TType(left->getType());
    leftParamType->setPrecision(EbpHigh);
    leftParamType->setQualifier(EvqOut);
    parameters.push_back(new TVariable(mSymbolTable, kParamXName,
                                       static_cast<const TType *>(leftParamType),
                                       SymbolType::AngleInternal));
    TType *rightParamType = new TType(right->getType());
    rightParamType->setPrecision(EbpHigh);
    rightParamType->setQualifier(EvqIn);
    parameters.push_back(new TVariable(mSymbolTable, kParamYName,
                                       static_cast<const TType *>(rightParamType),
                                       SymbolType::AngleInternal));

    return TIntermAggregate::CreateRawFunctionCall(
        *getInternalFunction(functionName, left->getType(), arguments, parameters, false),
        arguments);
}
开发者ID:google,项目名称:angle,代码行数:32,代码来源:EmulatePrecision.cpp

示例9: error

int ValidateLimitations::validateForLoopInit(TIntermLoop *node)
{
    TIntermNode *init = node->getInit();
    if (init == NULL)
    {
        error(node->getLine(), "Missing init declaration", "for");
        return -1;
    }

    //
    // init-declaration has the form:
    //     type-specifier identifier = constant-expression
    //
    TIntermAggregate *decl = init->getAsAggregate();
    if ((decl == NULL) || (decl->getOp() != EOpDeclaration))
    {
        error(init->getLine(), "Invalid init declaration", "for");
        return -1;
    }
    // To keep things simple do not allow declaration list.
    TIntermSequence *declSeq = decl->getSequence();
    if (declSeq->size() != 1)
    {
        error(decl->getLine(), "Invalid init declaration", "for");
        return -1;
    }
    TIntermBinary *declInit = (*declSeq)[0]->getAsBinaryNode();
    if ((declInit == NULL) || (declInit->getOp() != EOpInitialize))
    {
        error(decl->getLine(), "Invalid init declaration", "for");
        return -1;
    }
    TIntermSymbol *symbol = declInit->getLeft()->getAsSymbolNode();
    if (symbol == NULL)
    {
        error(declInit->getLine(), "Invalid init declaration", "for");
        return -1;
    }
    // The loop index has type int or float.
    TBasicType type = symbol->getBasicType();
    if ((type != EbtInt) && (type != EbtUInt) && (type != EbtFloat)) {
        error(symbol->getLine(),
              "Invalid type for loop index", getBasicString(type));
        return -1;
    }
    // The loop index is initialized with constant expression.
    if (!isConstExpr(declInit->getRight()))
    {
        error(declInit->getLine(),
              "Loop index cannot be initialized with non-constant expression",
              symbol->getSymbol().c_str());
        return -1;
    }

    return symbol->getId();
}
开发者ID:ghostoy,项目名称:angle,代码行数:56,代码来源:ValidateLimitations.cpp

示例10: ASSERT

bool TCompiler::pruneUnusedFunctions(TIntermNode *root)
{
    TIntermAggregate *rootNode = root->getAsAggregate();
    ASSERT(rootNode != nullptr);

    UnusedPredicate isUnused(&mCallDag, &functionMetadata);
    TIntermSequence *sequence = rootNode->getSequence();
    sequence->erase(std::remove_if(sequence->begin(), sequence->end(), isUnused), sequence->end());

    return true;
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:11,代码来源:Compiler.cpp

示例11: ASSERT

bool ValidateLimitations::validateFunctionCall(TIntermAggregate *node)
{
    ASSERT(node->getOp() == EOpFunctionCall);

    // If not within loop body, there is nothing to check.
    if (!withinLoopBody())
        return true;

    // List of param indices for which loop indices are used as argument.
    typedef std::vector<size_t> ParamIndex;
    ParamIndex pIndex;
    TIntermSequence *params = node->getSequence();
    for (TIntermSequence::size_type i = 0; i < params->size(); ++i)
    {
        TIntermSymbol *symbol = (*params)[i]->getAsSymbolNode();
        if (symbol && isLoopIndex(symbol))
            pIndex.push_back(i);
    }
    // If none of the loop indices are used as arguments,
    // there is nothing to check.
    if (pIndex.empty())
        return true;

    bool valid = true;
    TSymbolTable& symbolTable = GetGlobalParseContext()->symbolTable;
    TSymbol *symbol           = symbolTable.find(node->getFunctionSymbolInfo()->getName(),
                                       GetGlobalParseContext()->getShaderVersion());
    ASSERT(symbol && symbol->isFunction());
    TFunction *function = static_cast<TFunction *>(symbol);
    for (ParamIndex::const_iterator i = pIndex.begin();
         i != pIndex.end(); ++i)
    {
        const TConstParameter &param = function->getParam(*i);
        TQualifier qual = param.type->getQualifier();
        if ((qual == EvqOut) || (qual == EvqInOut))
        {
            error((*params)[*i]->getLine(),
                  "Loop index cannot be used as argument to a function out or inout parameter",
                  (*params)[*i]->getAsSymbolNode()->getSymbol().c_str());
            valid = false;
        }
    }

    return valid;
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:45,代码来源:ValidateLimitations.cpp

示例12: traverseAggregate

//
// Traverse an aggregate node.  Same comments in binary node apply here.
//
void TIntermTraverser::traverseAggregate(TIntermAggregate *node)
{
    bool visit = true;

    TIntermSequence *sequence = node->getSequence();

    if (preVisit)
        visit = visitAggregate(PreVisit, node);

    if (visit)
    {
        incrementDepth(node);

        if (node->getOp() == EOpSequence)
            pushParentBlock(node);
        else if (node->getOp() == EOpFunction)
            mInGlobalScope = false;

        for (auto *child : *sequence)
        {
            child->traverse(this);
            if (visit && inVisit)
            {
                if (child != sequence->back())
                    visit = visitAggregate(InVisit, node);
            }

            if (node->getOp() == EOpSequence)
                incrementParentBlockPos();
        }

        if (node->getOp() == EOpSequence)
            popParentBlock();
        else if (node->getOp() == EOpFunction)
            mInGlobalScope = true;

        decrementDepth();
    }

    if (visit && postVisit)
        visitAggregate(PostVisit, node);
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:45,代码来源:IntermTraverse.cpp

示例13: TIntermSequence

TIntermAggregate *EmulatePrecision::createRoundingFunctionCallNode(TIntermTyped *roundedChild)
{
    const ImmutableString *roundFunctionName = &kAngleFrmString;
    if (roundedChild->getPrecision() == EbpLow)
        roundFunctionName = &kAngleFrlString;
    TIntermSequence *arguments = new TIntermSequence();
    arguments->push_back(roundedChild);

    TVector<const TVariable *> parameters;
    TType *paramType = new TType(roundedChild->getType());
    paramType->setPrecision(EbpHigh);
    paramType->setQualifier(EvqIn);
    parameters.push_back(new TVariable(mSymbolTable, kParamXName,
                                       static_cast<const TType *>(paramType),
                                       SymbolType::AngleInternal));

    return TIntermAggregate::CreateRawFunctionCall(
        *getInternalFunction(*roundFunctionName, roundedChild->getType(), arguments, parameters,
                             true),
        arguments);
}
开发者ID:google,项目名称:angle,代码行数:21,代码来源:EmulatePrecision.cpp

示例14: getHasSideEffectsDebugParameter

bool getHasSideEffectsDebugParameter(TIntermAggregate *node, int pnum)
{
    if (!node)
        return false;
    
    if ( node->getOp() != EOpFunctionCall)
        return false;
    
    TIntermSequence funcCallSeq = node->getSequence();
    
    if ((int) funcCallSeq.size() < pnum) {
        dbgPrint(DBGLVL_ERROR, "CodeTools - function does not have this much parameter\n");
        exit(1);
    }
    
    if (!funcCallSeq[pnum]->getAsTyped()) {
        dbgPrint(DBGLVL_ERROR, "CodeTools - in parameter is not of type TIntermTyped\n");
        exit(1);
    }
    
    return funcCallSeq[pnum]->getAsTyped()->hasSideEffects();
}
开发者ID:flyncode,项目名称:GLSL-Debugger,代码行数:22,代码来源:CodeTools.cpp

示例15: TIntermAggregate

TIntermTyped *TIntermediate::addSwizzle(
    TVectorFields &fields, const TSourceLoc &line)
{

    TIntermAggregate *node = new TIntermAggregate(EOpSequence);

    node->setLine(line);
    TIntermConstantUnion *constIntNode;
    TIntermSequence *sequenceVector = node->getSequence();
    ConstantUnion *unionArray;

    for (int i = 0; i < fields.num; i++)
    {
        unionArray = new ConstantUnion[1];
        unionArray->setIConst(fields.offsets[i]);
        constIntNode = addConstantUnion(
            unionArray, TType(EbtInt, EbpUndefined, EvqConst), line);
        sequenceVector->push_back(constIntNode);
    }

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


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