本文整理汇总了C++中TIntermAggregate::setOp方法的典型用法代码示例。如果您正苦于以下问题:C++ TIntermAggregate::setOp方法的具体用法?C++ TIntermAggregate::setOp怎么用?C++ TIntermAggregate::setOp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TIntermAggregate
的用法示例。
在下文中一共展示了TIntermAggregate::setOp方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TIntermAggregate
//
// This is the safe way to change the operator on an aggregate, as it
// does lots of error checking and fixing. Especially for establishing
// a function call's operation on it's set of parameters. Sequences
// of instructions are also aggregates, but they just direnctly set
// their operator to EOpSequence.
//
// Returns an aggregate node, which could be the one passed in if
// it was already an aggregate but no operator was set.
//
TIntermAggregate *TIntermediate::setAggregateOperator(
TIntermNode *node, TOperator op, const TSourceLoc &line)
{
TIntermAggregate *aggNode;
//
// Make sure we have an aggregate. If not turn it into one.
//
if (node)
{
aggNode = node->getAsAggregate();
if (aggNode == NULL || aggNode->getOp() != EOpNull)
{
//
// Make an aggregate containing this node.
//
aggNode = new TIntermAggregate();
aggNode->getSequence()->push_back(node);
}
}
else
{
aggNode = new TIntermAggregate();
}
//
// Set the operator.
//
aggNode->setOp(op);
aggNode->setLine(line);
return aggNode;
}
示例2: makeAggregate
// If the input node is nullptr, return nullptr.
// If the input node is a sequence (block) node, return it.
// If the input node is not a sequence node, put it inside a sequence node and return that.
TIntermAggregate *TIntermediate::ensureSequence(TIntermNode *node)
{
if (node == nullptr)
return nullptr;
TIntermAggregate *aggNode = node->getAsAggregate();
if (aggNode != nullptr && aggNode->getOp() == EOpSequence)
return aggNode;
aggNode = makeAggregate(node, node->getLine());
aggNode->setOp(EOpSequence);
return aggNode;
}
示例3: postProcess
//
// This is to be executed once the final root is put on top by the parsing
// process.
//
bool TIntermediate::postProcess(TIntermNode *root)
{
if (root == NULL)
return true;
//
// First, finish off the top level sequence, if any
//
TIntermAggregate *aggRoot = root->getAsAggregate();
if (aggRoot && aggRoot->getOp() == EOpNull)
aggRoot->setOp(EOpSequence);
return true;
}
示例4: if
//
// This is to be executed once the final root is put on top by the parsing
// process.
//
TIntermAggregate *TIntermediate::postProcess(TIntermNode *root)
{
if (root == nullptr)
return nullptr;
//
// Finish off the top level sequence, if any
//
TIntermAggregate *aggRoot = root->getAsAggregate();
if (aggRoot != nullptr && aggRoot->getOp() == EOpNull)
{
aggRoot->setOp(EOpSequence);
}
else if (aggRoot == nullptr || aggRoot->getOp() != EOpSequence)
{
aggRoot = new TIntermAggregate(EOpSequence);
aggRoot->setLine(root->getLine());
aggRoot->getSequence()->push_back(root);
}
return aggRoot;
}