本文整理汇总了C++中TIntermBinary::setLine方法的典型用法代码示例。如果您正苦于以下问题:C++ TIntermBinary::setLine方法的具体用法?C++ TIntermBinary::setLine怎么用?C++ TIntermBinary::setLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TIntermBinary
的用法示例。
在下文中一共展示了TIntermBinary::setLine方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TIntermBinary
//
// Connect two nodes with a new parent that does a binary operation on the nodes.
//
// Returns the added node.
//
TIntermTyped *TIntermediate::addBinaryMath(
TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &line)
{
//
// Need a new node holding things together then. Make
// one and promote it to the right type.
//
TIntermBinary *node = new TIntermBinary(op);
node->setLine(line);
node->setLeft(left);
node->setRight(right);
if (!node->promote(mInfoSink))
return NULL;
//
// See if we can fold constants.
//
TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
if (leftTempConstant && rightTempConstant)
{
TIntermTyped *typedReturnNode =
leftTempConstant->fold(node->getOp(), rightTempConstant, mInfoSink);
if (typedReturnNode)
return typedReturnNode;
}
return node;
}
示例2: addIndex
//
// Connect two nodes through an index operator, where the left node is the base
// of an array or struct, and the right node is a direct or indirect offset.
//
// Returns the added node.
// The caller should set the type of the returned node.
//
TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, const TSourceLoc& line)
{
TIntermBinary* node = new TIntermBinary(op);
node->setLine(line);
node->setLeft(base);
node->setRight(index);
// caller should set the type
return node;
}
示例3: ir_add_index
// Connect two nodes through an index operator, where the left node is the base
// of an array or struct, and the right node is a direct or indirect offset.
//
// The caller should set the type of the returned node.
TIntermTyped* ir_add_index(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc line)
{
TIntermBinary* node = new TIntermBinary(op);
if (line.line == 0)
line = index->getLine();
node->setLine(line);
node->setLeft(base);
node->setRight(index);
// caller should set the type
return node;
}
示例4: TIntermBinary
//
// Connect two nodes through an index operator, where the left node is the base
// of an array or struct, and the right node is a direct or indirect offset.
//
// Returns the added node.
// The caller should set the type of the returned node.
//
TIntermTyped *TIntermediate::addIndex(TOperator op,
TIntermTyped *base,
TIntermTyped *index,
const TSourceLoc &line,
TDiagnostics *diagnostics)
{
TIntermBinary *node = new TIntermBinary(op, base, index);
node->setLine(line);
TIntermTyped *folded = node->fold(diagnostics);
if (folded)
{
return folded;
}
return node;
}
示例5: addAssign
//
// Connect two nodes through an assignment.
//
// Returns the added node.
//
TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc& line)
{
//
// Like adding binary math, except the conversion can only go
// from right to left.
//
TIntermBinary* node = new TIntermBinary(op);
node->setLine(line);
TIntermTyped* child = addConversion(op, left->getType(), right);
if (child == 0)
return 0;
node->setLeft(left);
node->setRight(child);
if (! node->promote(infoSink))
return 0;
return node;
}
示例6: TIntermBinary
//
// Connect two nodes through an assignment.
//
// Returns the added node.
//
TIntermTyped *TIntermediate::addAssign(
TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &line)
{
if (left->getType().getStruct() || right->getType().getStruct())
{
if (left->getType() != right->getType())
{
return NULL;
}
}
TIntermBinary *node = new TIntermBinary(op);
node->setLine(line);
node->setLeft(left);
node->setRight(right);
if (!node->promote(mInfoSink))
return NULL;
return node;
}
示例7: ir_add_assign
// Connect two nodes through an assignment.
TIntermTyped* ir_add_assign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc line, TParseContext& ctx)
{
//
// Like adding binary math, except the conversion can only go
// from right to left.
//
TIntermBinary* node = new TIntermBinary(op);
if (line.line == 0)
line = left->getLine();
node->setLine(line);
TIntermTyped* child = ir_add_conversion(op, left->getType(), right, ctx.infoSink);
if (child == 0)
return 0;
node->setLeft(left);
node->setRight(child);
if (! node->promote(ctx))
return 0;
return node;
}
示例8: TIntermBinary
//
// Connect two nodes with a new parent that does a binary operation on the nodes.
//
// Returns the added node.
//
TIntermTyped *TIntermediate::addBinaryMath(
TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &line)
{
//
// Need a new node holding things together then. Make
// one and promote it to the right type.
//
TIntermBinary *node = new TIntermBinary(op);
node->setLine(line);
node->setLeft(left);
node->setRight(right);
if (!node->promote(mInfoSink))
return NULL;
// See if we can fold constants.
TIntermTyped *foldedNode = node->fold(mInfoSink);
if (foldedNode)
return foldedNode;
return node;
}
示例9: switch
//
// Connect two nodes with a new parent that does a binary operation on the nodes.
//
// Returns the added node.
//
TIntermTyped *TIntermediate::addBinaryMath(
TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &line)
{
switch (op)
{
case EOpEqual:
case EOpNotEqual:
if (left->isArray())
return NULL;
break;
case EOpLessThan:
case EOpGreaterThan:
case EOpLessThanEqual:
case EOpGreaterThanEqual:
if (left->isMatrix() || left->isArray() || left->isVector() ||
left->getBasicType() == EbtStruct)
{
return NULL;
}
break;
case EOpLogicalOr:
case EOpLogicalXor:
case EOpLogicalAnd:
if (left->getBasicType() != EbtBool ||
left->isMatrix() || left->isArray() || left->isVector())
{
return NULL;
}
break;
case EOpAdd:
case EOpSub:
case EOpDiv:
case EOpMul:
if (left->getBasicType() == EbtStruct || left->getBasicType() == EbtBool)
return NULL;
default:
break;
}
if (left->getBasicType() != right->getBasicType())
{
return NULL;
}
//
// Need a new node holding things together then. Make
// one and promote it to the right type.
//
TIntermBinary *node = new TIntermBinary(op);
node->setLine(line);
node->setLeft(left);
node->setRight(right);
if (!node->promote(mInfoSink))
return NULL;
//
// See if we can fold constants.
//
TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
if (leftTempConstant && rightTempConstant)
{
TIntermTyped *typedReturnNode =
leftTempConstant->fold(node->getOp(), rightTempConstant, mInfoSink);
if (typedReturnNode)
return typedReturnNode;
}
return node;
}
示例10: ir_add_binary_math
//.........这里部分代码省略.........
default:
break;
}
//
// First try converting the children to compatible types.
//
if (!(left->getType().getStruct() && right->getType().getStruct()))
{
TIntermTyped* child = 0;
bool useLeft = true; //default to using the left child as the type to promote to
//need to always convert up
if ( left->getType().getBasicType() != EbtFloat)
{
if ( right->getType().getBasicType() == EbtFloat)
{
useLeft = false;
}
else
{
if ( left->getType().getBasicType() != EbtInt)
{
if ( right->getType().getBasicType() == EbtInt)
useLeft = false;
}
}
}
if (useLeft)
{
child = ir_add_conversion(op, left->getType(), right, ctx.infoSink);
if (child)
right = child;
else
{
child = ir_add_conversion(op, right->getType(), left, ctx.infoSink);
if (child)
left = child;
else
return 0;
}
}
else
{
child = ir_add_conversion(op, right->getType(), left, ctx.infoSink);
if (child)
left = child;
else
{
child = ir_add_conversion(op, left->getType(), right, ctx.infoSink);
if (child)
right = child;
else
return 0;
}
}
}
else
{
if (left->getType() != right->getType())
return 0;
}
//
// Need a new node holding things together then. Make
// one and promote it to the right type.
//
TIntermBinary* node = new TIntermBinary(op);
if (line.line == 0)
line = right->getLine();
node->setLine(line);
node->setLeft(left);
node->setRight(right);
if (! node->promote(ctx))
return 0;
//
// See if we can fold constants
TIntermConstant* constA = left->getAsConstant();
TIntermConstant* constB = right->getAsConstant();
if (constA && constB)
{
TIntermConstant* FoldBinaryConstantExpression(TOperator op, TIntermConstant* nodeA, TIntermConstant* nodeB);
TIntermConstant* res = FoldBinaryConstantExpression(node->getOp(), constA, constB);
if (res)
{
delete node;
return res;
}
}
return node;
}
示例11: addBinaryMath
//
// Connect two nodes with a new parent that does a binary operation on the nodes.
//
// Returns the added node.
//
TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc line, TSymbolTable& symbolTable)
{
switch (op) {
case EOpEqual:
case EOpNotEqual:
if (left->isArray())
return 0;
break;
case EOpLessThan:
case EOpGreaterThan:
case EOpLessThanEqual:
case EOpGreaterThanEqual:
if (left->isMatrix() || left->isArray() || left->isVector() || left->getBasicType() == EbtStruct) {
return 0;
}
break;
case EOpLogicalOr:
case EOpLogicalXor:
case EOpLogicalAnd:
if (left->getBasicType() != EbtBool || left->isMatrix() || left->isArray() || left->isVector()) {
return 0;
}
break;
case EOpAdd:
case EOpSub:
case EOpDiv:
case EOpMul:
if (left->getBasicType() == EbtStruct || left->getBasicType() == EbtBool)
return 0;
default: break;
}
//
// First try converting the children to compatible types.
//
if (left->getType().getStruct() && right->getType().getStruct()) {
if (left->getType() != right->getType())
return 0;
} else {
TIntermTyped* child = addConversion(op, left->getType(), right);
if (child)
right = child;
else {
child = addConversion(op, right->getType(), left);
if (child)
left = child;
else
return 0;
}
}
//
// Need a new node holding things together then. Make
// one and promote it to the right type.
//
TIntermBinary* node = new TIntermBinary(op);
if (line == 0)
line = right->getLine();
node->setLine(line);
node->setLeft(left);
node->setRight(right);
if (!node->promote(infoSink))
return 0;
//
// See if we can fold constants.
//
TIntermTyped* typedReturnNode = 0;
TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
if (leftTempConstant && rightTempConstant) {
typedReturnNode = leftTempConstant->fold(node->getOp(), rightTempConstant, infoSink);
if (typedReturnNode)
return typedReturnNode;
}
return node;
}