本文整理汇总了C++中TIntermTyped类的典型用法代码示例。如果您正苦于以下问题:C++ TIntermTyped类的具体用法?C++ TIntermTyped怎么用?C++ TIntermTyped使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TIntermTyped类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getMatrixConstructOp
static TOperator getMatrixConstructOp(const TIntermTyped& intermediate)
{
switch (intermediate.getColsCount())
{
case 2:
switch (intermediate.getRowsCount())
{
case 2: return EOpConstructMat2x2;
case 3: return EOpConstructMat2x3;
case 4: return EOpConstructMat2x4;
} break;
case 3:
switch (intermediate.getRowsCount())
{
case 2: return EOpConstructMat3x2;
case 3: return EOpConstructMat3x3;
case 4: return EOpConstructMat3x4;
} break;
case 4:
switch (intermediate.getRowsCount())
{
case 2: return EOpConstructMat4x2;
case 3: return EOpConstructMat4x3;
case 4: return EOpConstructMat4x4;
} break;
}
assert(false);
return EOpNull;
}
开发者ID:juj,项目名称:hlsl2glslfork,代码行数:29,代码来源:Intermediate.cpp
示例2: growAggregate
TIntermTyped *TIntermediate::addComma(TIntermTyped *left,
TIntermTyped *right,
const TSourceLoc &line,
int shaderVersion)
{
TQualifier resultQualifier = EvqConst;
// ESSL3.00 section 12.43: The result of a sequence operator is not a constant-expression.
if (shaderVersion >= 300 || left->getQualifier() != EvqConst ||
right->getQualifier() != EvqConst)
{
resultQualifier = EvqTemporary;
}
TIntermTyped *commaNode = nullptr;
if (!left->hasSideEffects())
{
commaNode = right;
}
else
{
commaNode = growAggregate(left, right, line);
commaNode->getAsAggregate()->setOp(EOpComma);
commaNode->setType(right->getType());
}
commaNode->getTypePointer()->setQualifier(resultQualifier);
return commaNode;
}
开发者ID:servo,项目名称:angle,代码行数:27,代码来源:Intermediate.cpp
示例3: ASSERT
void TIntermAggregate::setBuiltInFunctionPrecision()
{
// All built-ins returning bool should be handled as ops, not functions.
ASSERT(getBasicType() != EbtBool);
TPrecision precision = EbpUndefined;
TIntermSequence::iterator childIter = mSequence.begin();
while (childIter != mSequence.end())
{
TIntermTyped *typed = (*childIter)->getAsTyped();
// ESSL spec section 8: texture functions get their precision from the sampler.
if (typed && IsSampler(typed->getBasicType()))
{
precision = typed->getPrecision();
break;
}
++childIter;
}
// ESSL 3.0 spec section 8: textureSize always gets highp precision.
// All other functions that take a sampler are assumed to be texture functions.
if (mName.find("textureSize") == 0)
mType.setPrecision(EbpHigh);
else
mType.setPrecision(precision);
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:25,代码来源:IntermNode.cpp
示例4: ir_add_vector_swizzle
TIntermTyped* ir_add_vector_swizzle(TVectorFields& fields, TIntermTyped* arg, TSourceLoc lineDot, TSourceLoc lineIndex)
{
// swizzle on a constant -> fold it
if (arg->getType().getQualifier() == EvqConst)
{
TIntermTyped* res = ir_add_const_vector_swizzle(fields, arg, lineIndex);
if (res)
return res;
}
TIntermTyped* res = NULL;
if (fields.num == 1)
{
TIntermConstant* index = ir_add_constant(TType(EbtInt, EbpUndefined, EvqConst), lineIndex);
index->setValue(fields.offsets[0]);
res = ir_add_index(EOpIndexDirect, arg, index, lineDot);
res->setType(TType(arg->getBasicType(), arg->getPrecision()));
}
else
{
TIntermTyped* index = ir_add_swizzle(fields, lineIndex);
res = ir_add_index(EOpVectorSwizzle, arg, index, lineDot);
res->setType(TType(arg->getBasicType(), arg->getPrecision(), EvqTemporary, 1, fields.num));
}
return res;
}
开发者ID:Groovounet,项目名称:hlsl2glslfork,代码行数:26,代码来源:Intermediate.cpp
示例5: switch
bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate* node)
{
bool visitChildren = true;
switch (node->getOp()) {
case EOpSequence:
// We need to visit sequence children to get to global or inner scope.
visitChildren = true;
break;
case EOpDeclaration: {
const TIntermSequence& sequence = node->getSequence();
TQualifier qualifier = sequence.front()->getAsTyped()->getQualifier();
if ((qualifier == EvqInvariantVaryingIn) ||
(qualifier == EvqInvariantVaryingOut)) {
updateVersion(GLSL_VERSION_120);
}
break;
}
case EOpParameters: {
const TIntermSequence& params = node->getSequence();
for (TIntermSequence::const_iterator iter = params.begin();
iter != params.end(); ++iter)
{
const TIntermTyped* param = (*iter)->getAsTyped();
if (param->isArray())
{
TQualifier qualifier = param->getQualifier();
if ((qualifier == EvqOut) || (qualifier == EvqInOut))
{
updateVersion(GLSL_VERSION_120);
break;
}
}
}
// Fully processed. No need to visit children.
visitChildren = false;
break;
}
case EOpConstructMat2:
case EOpConstructMat3:
case EOpConstructMat4: {
const TIntermSequence& sequence = node->getSequence();
if (sequence.size() == 1) {
TIntermTyped* typed = sequence.front()->getAsTyped();
if (typed && typed->isMatrix()) {
updateVersion(GLSL_VERSION_120);
}
}
break;
}
default: break;
}
return visitChildren;
}
开发者ID:0x163mL,项目名称:phantomjs,代码行数:56,代码来源:VersionGLSL.cpp
示例6: constructBuiltIn
// Function for constructor implementation. Calls addUnaryMath with appropriate EOp value
// for the parameter to the constructor (passed to this function). Essentially, it converts
// the parameter types correctly. If a constructor expects an int (like ivec2) and is passed a
// float, then float is converted to int.
//
// Returns 0 for an error or the constructed node.
//
TIntermTyped* TParseContext::constructBuiltIn(const TType* type, TOperator op, TIntermNode* node, TSourceLoc line, bool subset)
{
TIntermTyped* newNode;
TOperator basicOp;
//
// First, convert types as needed.
//
switch (op) {
case EOpConstructVec2:
case EOpConstructVec3:
case EOpConstructVec4:
case EOpConstructMat2:
case EOpConstructMat3:
case EOpConstructMat4:
case EOpConstructFloat:
basicOp = EOpConstructFloat;
break;
case EOpConstructIVec2:
case EOpConstructIVec3:
case EOpConstructIVec4:
case EOpConstructInt:
basicOp = EOpConstructInt;
break;
case EOpConstructBVec2:
case EOpConstructBVec3:
case EOpConstructBVec4:
case EOpConstructBool:
basicOp = EOpConstructBool;
break;
default:
error(line, "unsupported construction", "", "");
recover();
return 0;
}
newNode = intermediate.addUnaryMath(basicOp, node, node->getLine(), symbolTable);
if (newNode == 0) {
error(line, "can't convert", "constructor", "");
return 0;
}
//
// Now, if there still isn't an operation to do the construction, and we need one, add one.
//
// Otherwise, skip out early.
if (subset || (newNode != node && newNode->getType() == *type))
return newNode;
// setAggregateOperator will insert a new node for the constructor, as needed.
return intermediate.setAggregateOperator(newNode, op, line);
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:63,代码来源:ParseHelper.cpp
示例7: growAggregate
TIntermTyped* TIntermediate::addComma(TIntermTyped* left, TIntermTyped* right, TSourceLoc line)
{
if (left->getType().getQualifier() == EvqConst && right->getType().getQualifier() == EvqConst) {
return right;
} else {
TIntermTyped *commaAggregate = growAggregate(left, right, line);
commaAggregate->getAsAggregate()->setOp(EOpComma);
commaAggregate->setType(right->getType());
commaAggregate->getTypePointer()->setQualifier(EvqTemporary);
return commaAggregate;
}
}
开发者ID:JSilver99,项目名称:mozilla-central,代码行数:12,代码来源:Intermediate.cpp
示例8: ASSERT
bool ValidateLimitations::validateIndexing(TIntermBinary* node)
{
ASSERT((node->getOp() == EOpIndexDirect) ||
(node->getOp() == EOpIndexIndirect));
bool valid = true;
TIntermTyped* index = node->getRight();
// The index expression must have integral type.
if (!index->isScalar() || (index->getBasicType() != EbtInt)) {
error(index->getLine(),
"Index expression must have integral type",
index->getCompleteString().c_str());
valid = false;
}
// The index expession must be a constant-index-expression unless
// the operand is a uniform in a vertex shader.
TIntermTyped* operand = node->getLeft();
bool skip = (mShaderType == SH_VERTEX_SHADER) &&
(operand->getQualifier() == EvqUniform);
if (!skip && !isConstIndexExpr(index)) {
error(index->getLine(), "Index expression must be constant", "[]");
valid = false;
}
return valid;
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:25,代码来源:ValidateLimitations.cpp
示例9: ir_add_comma
TIntermTyped* ir_add_comma(TIntermTyped* left, TIntermTyped* right, TSourceLoc line)
{
if (left->getType().getQualifier() == EvqConst && right->getType().getQualifier() == EvqConst)
{
return right;
}
else
{
TIntermTyped *commaAggregate = ir_grow_aggregate(left, right, line);
commaAggregate->getAsAggregate()->setOperator(EOpComma);
commaAggregate->setType(right->getType());
commaAggregate->getTypePointer()->changeQualifier(EvqTemporary);
return commaAggregate;
}
}
开发者ID:Groovounet,项目名称:hlsl2glslfork,代码行数:15,代码来源:Intermediate.cpp
示例10: visitAggregate
bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate *node)
{
if (node->getOp() == EOpConstruct && node->getType().isMatrix())
{
const TIntermSequence &sequence = *(node->getSequence());
if (sequence.size() == 1)
{
TIntermTyped *typed = sequence.front()->getAsTyped();
if (typed && typed->isMatrix())
{
ensureVersionIsAtLeast(GLSL_VERSION_120);
}
}
}
return true;
}
开发者ID:google,项目名称:angle,代码行数:16,代码来源:VersionGLSL.cpp
示例11: constArray
//
// Make a constant vector node or constant scalar node, representing a given
// constant vector and constant swizzle into it.
//
TIntermTyped* TIntermediate::foldSwizzle(TIntermTyped* node, TVectorFields& fields, const TSourceLoc& loc)
{
const TConstUnionArray& unionArray = node->getAsConstantUnion()->getConstArray();
TConstUnionArray constArray(fields.num);
for (int i = 0; i < fields.num; i++)
constArray[i] = unionArray[fields.offsets[i]];
TIntermTyped* result = addConstantUnion(constArray, node->getType(), loc);
if (result == 0)
result = node;
else
result->setType(TType(node->getBasicType(), EvqConst, fields.num));
return result;
}
开发者ID:neilogd,项目名称:glslang,代码行数:21,代码来源:Constant.cpp
示例12: ir_grow_declaration
TIntermDeclaration* ir_grow_declaration(TIntermDeclaration* declaration, TIntermSymbol *symbol, TIntermTyped *initializer, TInfoSink& infoSink)
{
TIntermTyped* added_decl = symbol;
if (initializer)
added_decl = ir_add_assign(EOpAssign, symbol, initializer, symbol->getLine(), infoSink);
if (declaration->isSingleDeclaration()) {
TIntermTyped* current = declaration->getDeclaration();
TIntermAggregate* aggregate = ir_make_aggregate(current, current->getLine());
aggregate->setOperator(EOpComma);
declaration->getDeclaration() = aggregate;
}
TIntermAggregate* aggregate = ir_grow_aggregate(declaration->getDeclaration(), added_decl, added_decl->getLine());
aggregate->setOperator(EOpComma);
declaration->getDeclaration() = aggregate;
return declaration;
}
开发者ID:jjiezheng,项目名称:hlsl2glslfork,代码行数:19,代码来源:Intermediate.cpp
示例13: while
void TIntermAggregate::setPrecisionFromChildren()
{
if (getBasicType() == EbtBool)
{
mType.setPrecision(EbpUndefined);
return;
}
TPrecision precision = EbpUndefined;
TIntermSequence::iterator childIter = mSequence.begin();
while (childIter != mSequence.end())
{
TIntermTyped *typed = (*childIter)->getAsTyped();
if (typed)
precision = GetHigherPrecision(typed->getPrecision(), precision);
++childIter;
}
mType.setPrecision(precision);
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:19,代码来源:IntermNode.cpp
示例14: nodeSetMaintainer
void TDependencyGraphBuilder::visitAssignment(TIntermBinary* intermAssignment)
{
TIntermTyped* intermLeft = intermAssignment->getLeft();
if (!intermLeft)
return;
TGraphSymbol* leftmostSymbol = NULL;
{
TNodeSetMaintainer nodeSetMaintainer(this);
{
TLeftmostSymbolMaintainer leftmostSymbolMaintainer(this, mLeftSubtree);
intermLeft->traverse(this);
leftmostSymbol = mLeftmostSymbols.top();
// After traversing the left subtree of this assignment, we should have found a real
// leftmost symbol, and the leftmost symbol should not be a placeholder.
ASSERT(leftmostSymbol != &mLeftSubtree);
ASSERT(leftmostSymbol != &mRightSubtree);
}
if (TIntermTyped* intermRight = intermAssignment->getRight()) {
TLeftmostSymbolMaintainer leftmostSymbolMaintainer(this, mRightSubtree);
intermRight->traverse(this);
}
if (TParentNodeSet* assignmentNodes = mNodeSets.getTopSet())
connectMultipleNodesToSingleNode(assignmentNodes, leftmostSymbol);
}
// Push the leftmost symbol of this assignment into the current set of dependent symbols to
// represent the result of this assignment.
// An expression like "a = (b = c)" will yield a dependency graph like "c -> b -> a".
// This line essentially passes the leftmost symbol of the nested assignment ("b" in this
// example) back up to the earlier visitAssignment call for the outer assignment, which will
// create the connection "b -> a".
mNodeSets.insertIntoTopSet(leftmostSymbol);
}
开发者ID:13609594236,项目名称:CrossApp,代码行数:39,代码来源:DependencyGraphBuilder.cpp
示例15: 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;
}
开发者ID:Groovounet,项目名称:hlsl2glslfork,代码行数:38,代码来源:Intermediate.cpp
示例16: dereferencedType
//
// Constant folding of a bracket (array-style) dereference or struct-like dot
// dereference. Can handle any thing except a multi-character swizzle, though
// all swizzles may go to foldSwizzle().
//
TIntermTyped* TIntermediate::foldDereference(TIntermTyped* node, int index, const TSourceLoc& loc)
{
TType dereferencedType(node->getType(), index);
dereferencedType.getQualifier().storage = EvqConst;
TIntermTyped* result = 0;
int size = dereferencedType.computeNumComponents();
int start;
if (node->isStruct()) {
start = 0;
for (int i = 0; i < index; ++i)
start += (*node->getType().getStruct())[i].type->computeNumComponents();
} else
start = size * index;
result = addConstantUnion(TConstUnionArray(node->getAsConstantUnion()->getConstArray(), start, size), node->getType(), loc);
if (result == 0)
result = node;
else
result->setType(dereferencedType);
return result;
}
开发者ID:neilogd,项目名称:glslang,代码行数:29,代码来源:Constant.cpp
示例17: visitBinary
bool CollectVariables::visitBinary(Visit, TIntermBinary *binaryNode)
{
if (binaryNode->getOp() == EOpIndexDirectInterfaceBlock)
{
// NOTE: we do not determine static use for individual blocks of an array
TIntermTyped *blockNode = binaryNode->getLeft()->getAsTyped();
ASSERT(blockNode);
TIntermConstantUnion *constantUnion = binaryNode->getRight()->getAsConstantUnion();
ASSERT(constantUnion);
const TInterfaceBlock *interfaceBlock = blockNode->getType().getInterfaceBlock();
InterfaceBlock *namedBlock = FindVariable(interfaceBlock->name(), mInterfaceBlocks);
ASSERT(namedBlock);
namedBlock->staticUse = true;
unsigned int fieldIndex = constantUnion->getUConst(0);
ASSERT(fieldIndex < namedBlock->fields.size());
namedBlock->fields[fieldIndex].staticUse = true;
return false;
}
return true;
}
开发者ID:h4writer,项目名称:oomrepo,代码行数:24,代码来源:VariableInfo.cpp
示例18: acceptConstructor
// constructor
// : type argument_list
//
bool HlslGrammar::acceptConstructor(TIntermTyped*& node)
{
// type
TType type;
if (acceptType(type)) {
TFunction* constructorFunction = parseContext.handleConstructorCall(token.loc, type);
if (constructorFunction == nullptr)
return false;
// arguments
TIntermTyped* arguments = nullptr;
if (! acceptArguments(constructorFunction, arguments)) {
expected("constructor arguments");
return false;
}
// hook it up
node = parseContext.handleFunctionCall(arguments->getLoc(), constructorFunction, arguments);
return true;
}
return false;
}
开发者ID:Corralx,项目名称:helios,代码行数:27,代码来源:hlslGrammar.cpp
示例19: switch
bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate* node)
{
bool visitChildren = true;
switch (node->getOp()) {
case EOpSequence:
// We need to visit sequence children to get to global or inner scope.
visitChildren = true;
break;
case EOpDeclaration: {
const TIntermSequence& sequence = node->getSequence();
TQualifier qualifier = sequence.front()->getAsTyped()->getQualifier();
if ((qualifier == EvqInvariantVaryingIn) ||
(qualifier == EvqInvariantVaryingOut)) {
updateVersion(GLSL_VERSION_120);
}
break;
}
case EOpConstructMat2:
case EOpConstructMat3:
case EOpConstructMat4: {
const TIntermSequence& sequence = node->getSequence();
if (sequence.size() == 1) {
TIntermTyped* typed = sequence.front()->getAsTyped();
if (typed && typed->isMatrix()) {
updateVersion(GLSL_VERSION_120);
}
}
break;
}
default: break;
}
return visitChildren;
}
开发者ID:hideakihata,项目名称:mozilla-central.fgv,代码行数:36,代码来源:VersionGLSL.cpp
示例20: getMatrixConstructOp
static TOperator getMatrixConstructOp(const TIntermTyped& intermediate, TParseContext& ctx)
{
// before GLSL 1.20, only square matrices
if (ctx.targetVersion < ETargetGLSL_120)
{
const int c = intermediate.getColsCount();
const int r = intermediate.getRowsCount();
if (c == 2 && r == 2)
return EOpConstructMat2x2FromMat;
if (c == 3 && r == 3)
return EOpConstructMat3x3FromMat;
if (c == 4 && r == 4)
return EOpConstructMat4x4;
ctx.error(intermediate.getLine(), " non-square matrices not supported", "", "(%ix%i)", r, c);
return EOpNull;
}
switch (intermediate.getColsCount())
{
case 2:
switch (intermediate.getRowsCount())
{
case 2: return EOpConstructMat2x2;
case 3: return EOpConstructMat2x3;
case 4: return EOpConstructMat2x4;
} break;
case 3:
switch (intermediate.getRowsCount())
{
case 2: return EOpConstructMat3x2;
case 3: return EOpConstructMat3x3;
case 4: return EOpConstructMat3x4;
} break;
case 4:
switch (intermediate.getRowsCount())
{
case 2: return EOpConstructMat4x2;
case 3: return EOpConstructMat4x3;
case 4: return EOpConstructMat4x4;
} break;
}
assert(false);
return EOpNull;
}
开发者ID:Groovounet,项目名称:hlsl2glslfork,代码行数:44,代码来源:Intermediate.cpp
注:本文中的TIntermTyped类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论