本文整理汇总了C++中TIntermAggregate::setLine方法的典型用法代码示例。如果您正苦于以下问题:C++ TIntermAggregate::setLine方法的具体用法?C++ TIntermAggregate::setLine怎么用?C++ TIntermAggregate::setLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TIntermAggregate
的用法示例。
在下文中一共展示了TIntermAggregate::setLine方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeAggregate
//
// Turn an existing node into an aggregate.
//
// Returns an aggregate, unless 0 was passed in for the existing node.
//
TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, TSourceLoc line)
{
if (node == 0)
return 0;
TIntermAggregate* aggNode = new TIntermAggregate;
aggNode->getSequence().push_back(node);
if (line != 0)
aggNode->setLine(line);
else
aggNode->setLine(node->getLine());
return aggNode;
}
示例2: 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;
}
示例3: ir_set_aggregate_op
// 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.
TIntermAggregate* ir_set_aggregate_op(TIntermNode* node, TOperator op, TSourceLoc line)
{
TIntermAggregate* aggNode;
//
// Make sure we have an aggregate. If not turn it into one.
//
if (node)
{
aggNode = node->getAsAggregate();
if (aggNode == 0 || aggNode->getOp() != EOpNull)
{
//
// Make an aggregate containing this node.
//
aggNode = new TIntermAggregate();
aggNode->getNodes().push_back(node);
if (line.line == 0)
line = node->getLine();
}
}
else
aggNode = new TIntermAggregate();
//
// Set the operator.
//
aggNode->setOperator(op);
if (line.line != 0)
aggNode->setLine(line);
return aggNode;
}
示例4: ir_make_aggregate
// Turn an existing node into an aggregate.
TIntermAggregate* ir_make_aggregate(TIntermNode* node, TSourceLoc line)
{
if (node == 0)
return 0;
TIntermAggregate* aggNode = new TIntermAggregate;
if (node->getAsTyped())
aggNode->setType(*node->getAsTyped()->getTypePointer());
aggNode->getNodes().push_back(node);
if (line.line != 0)
aggNode->setLine(line);
else
aggNode->setLine(node->getLine());
return aggNode;
}
示例5:
//
// Turn an existing node into an aggregate.
//
// Returns an aggregate, unless NULL was passed in for the existing node.
//
TIntermAggregate *TIntermediate::makeAggregate(
TIntermNode *node, const TSourceLoc &line)
{
if (node == NULL)
return NULL;
TIntermAggregate *aggNode = new TIntermAggregate;
aggNode->getSequence()->push_back(node);
aggNode->setLine(line);
return aggNode;
}
示例6: promoteTernary
bool TIntermSelection::promoteTernary(TInfoSink& infoSink)
{
if (!condition->isVector())
return true;
int size = condition->getRowsCount();
TIntermTyped* trueb = trueBlock->getAsTyped();
TIntermTyped* falseb = falseBlock->getAsTyped();
if (!trueb || !falseb)
return false;
if (trueb->getRowsCount() == size && falseb->getRowsCount() == size)
return true;
// Base assumption: just make the type a float vector
TPrecision higherPrecision = GetHigherPrecision(trueb->getPrecision(), falseb->getPrecision());
setType(TType(EbtFloat, higherPrecision, EvqTemporary, 1, size, condition->isMatrix()));
TOperator convert = EOpNull;
{
convert = TOperator( EOpConstructVec2 + size - 2);
TIntermAggregate *node = new TIntermAggregate(convert);
node->setLine(trueb->getLine());
node->setType(TType(condition->getBasicType(), higherPrecision, trueb->getQualifier() == EvqConst ? EvqConst : EvqTemporary, 1, size, condition->isMatrix()));
node->getNodes().push_back(trueb);
trueBlock = node;
}
{
convert = TOperator( EOpConstructVec2 + size - 2);
TIntermAggregate *node = new TIntermAggregate(convert);
node->setLine(falseb->getLine());
node->setType(TType(condition->getBasicType(), higherPrecision, falseb->getQualifier() == EvqConst ? EvqConst : EvqTemporary, 1, size, condition->isMatrix()));
node->getNodes().push_back(falseb);
falseBlock = node;
}
return true;
}
示例7: ir_add_swizzle
TIntermTyped* ir_add_swizzle(TVectorFields& fields, TSourceLoc line)
{
TIntermAggregate* node = new TIntermAggregate(EOpSequence);
node->setLine(line);
TNodeArray& nodes = node->getNodes();
for (int i = 0; i < fields.num; i++)
{
TIntermConstant* constant = ir_add_constant(TType(EbtInt, EbpUndefined, EvqConst), line);
constant->setValue(fields.offsets[i]);
nodes.push_back(constant);
}
return node;
}
示例8: addSwizzle
TIntermTyped* TIntermediate::addSwizzle(TVectorFields& fields, 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;
}
示例9: growAggregate
//
// Safe way to combine two nodes into an aggregate. Works with null pointers,
// a node that's not a aggregate yet, etc.
//
// Returns the resulting aggregate, unless 0 was passed in for
// both existing nodes.
//
TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* right, const TSourceLoc& line)
{
if (left == 0 && right == 0)
return 0;
TIntermAggregate* aggNode = 0;
if (left)
aggNode = left->getAsAggregate();
if (!aggNode || aggNode->getOp() != EOpNull) {
aggNode = new TIntermAggregate;
if (left)
aggNode->getSequence().push_back(left);
}
if (right)
aggNode->getSequence().push_back(right);
aggNode->setLine(line);
return aggNode;
}
示例10: 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;
}
示例11: ir_grow_aggregate
// Safe way to combine two nodes into an aggregate. Works with null pointers,
// a node that's not a aggregate yet, etc.
//
// Returns the resulting aggregate, unless 0 was passed in for
// both existing nodes.
TIntermAggregate* ir_grow_aggregate(TIntermNode* left, TIntermNode* right, TSourceLoc line, TOperator expectedOp)
{
if (left == 0 && right == 0)
return 0;
TIntermAggregate* aggNode = 0;
if (left)
aggNode = left->getAsAggregate();
if (!aggNode || aggNode->getOp() != expectedOp)
{
aggNode = new TIntermAggregate;
if (left)
aggNode->getNodes().push_back(left);
}
if (right)
aggNode->getNodes().push_back(right);
if (line.line != 0)
aggNode->setLine(line);
return aggNode;
}
示例12: promote
//.........这里部分代码省略.........
assert(rows > 0);
//
// Downcast needed ?
//
if ( left->getColsCount() > cols || left->getRowsCount() > rows)
{
if (assignment)
return false; //can't promote the destination
//down convert left to match right
TOperator convert = EOpNull;
if (left->getTypePointer()->isMatrix())
{
convert = getMatrixConstructOp(*right, ctx);
if (convert == EOpNull)
return false;
}
else if (left->getTypePointer()->isVector())
{
switch (right->getTypePointer()->getBasicType())
{
case EbtBool: convert = TOperator( EOpConstructBVec2 + rows - 2); break;
case EbtInt: convert = TOperator( EOpConstructIVec2 + rows - 2); break;
case EbtFloat: convert = TOperator( EOpConstructVec2 + rows - 2); break;
default: break;
}
}
else
{
assert(0); //size 1 case should have been handled
}
TIntermAggregate *node = new TIntermAggregate(convert);
node->setLine(left->getLine());
node->setType(TType(left->getBasicType(), left->getPrecision(), EvqTemporary,
right->getColsCount(), right->getRowsCount(), left->isMatrix()));
node->getNodes().push_back(left);
left = node;
//now reset this node's type
setType(TType(left->getBasicType(), left->getPrecision(), EvqTemporary,
right->getColsCount(), right->getRowsCount(), left->isMatrix()));
}
else if ( right->getColsCount() > cols || right->getRowsCount() > rows)
{
//down convert right to match left
TOperator convert = EOpNull;
if (right->getTypePointer()->isMatrix())
{
convert = getMatrixConstructOp(*left, ctx);
if (convert == EOpNull)
return false;
}
else if (right->getTypePointer()->isVector())
{
switch (left->getTypePointer()->getBasicType())
{
case EbtBool: convert = TOperator( EOpConstructBVec2 + rows - 2); break;
case EbtInt: convert = TOperator( EOpConstructIVec2 + rows - 2); break;
case EbtFloat: convert = TOperator( EOpConstructVec2 + rows - 2); break;
default: break;
}
}
else
{
assert(0); //size 1 case should have been handled
}
示例13: promote
//.........这里部分代码省略.........
//Insert a constructor on the larger type to make the sizes match
if ( left->getNominalSize() > right->getNominalSize() )
{
if (assignment)
return false; //can't promote the destination
//down convert left to match right
TOperator convert = EOpNull;
if (left->getTypePointer()->isMatrix())
{
switch (right->getNominalSize())
{
case 2: convert = EOpConstructMat2FromMat; break;
case 3: convert = EOpConstructMat3FromMat; break;
case 4: convert = EOpConstructMat4; break; //should never need to down convert to mat4
}
}
else if (left->getTypePointer()->isVector())
{
switch (left->getTypePointer()->getBasicType())
{
case EbtBool: convert = TOperator( EOpConstructBVec2 + right->getNominalSize() - 2); break;
case EbtInt: convert = TOperator( EOpConstructIVec2 + right->getNominalSize() - 2); break;
case EbtFloat: convert = TOperator( EOpConstructVec2 + right->getNominalSize() - 2); break;
}
}
else
{
assert(0); //size 1 case should have been handled
}
TIntermAggregate *node = new TIntermAggregate(convert);
node->setLine(left->getLine());
node->setType(TType(left->getBasicType(), left->getPrecision(), EvqTemporary, right->getNominalSize(), left->isMatrix()));
node->getNodes().push_back(left);
left = node;
//now reset this node's type
setType(TType(left->getBasicType(), left->getPrecision(), EvqTemporary, right->getNominalSize(), left->isMatrix()));
}
else
{
//down convert right to match left
TOperator convert = EOpNull;
if (right->getTypePointer()->isMatrix())
{
switch (left->getNominalSize())
{
case 2: convert = EOpConstructMat2FromMat; break;
case 3: convert = EOpConstructMat3FromMat; break;
case 4: convert = EOpConstructMat4; break; //should never need to down convert to mat4
}
}
else if (right->getTypePointer()->isVector())
{
switch (right->getTypePointer()->getBasicType())
{
case EbtBool: convert = TOperator( EOpConstructBVec2 + left->getNominalSize() - 2); break;
case EbtInt: convert = TOperator( EOpConstructIVec2 + left->getNominalSize() - 2); break;
case EbtFloat: convert = TOperator( EOpConstructVec2 + left->getNominalSize() - 2); break;
}
}
else
{
assert(0); //size 1 case should have been handled
}