本文整理汇总了C++中TIntermAggregate::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ TIntermAggregate::getName方法的具体用法?C++ TIntermAggregate::getName怎么用?C++ TIntermAggregate::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TIntermAggregate
的用法示例。
在下文中一共展示了TIntermAggregate::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFunctionBySignature
TIntermNode* getFunctionBySignature(const char *sig, TIntermNode* root)
// Assumption: 1. roots hold all function definitions.
// for single file shaders this should hold.
// Todo: Add solution for multiple files compiled in one shader.
{
TIntermAggregate *aggregate;
TIntermSequence sequence;
TIntermSequence::iterator sit;
// Root must be aggregate
if (!(aggregate = root->getAsAggregate())) {
return NULL;
}
if (aggregate->getOp() == EOpFunction) {
// do not stop search at function prototypes
if (aggregate->getSequence().size() != 0) {
if (!strcmp(sig, aggregate->getName().c_str())) {
return aggregate;
}
}
} else {
sequence = aggregate->getSequence();
for (sit = sequence.begin(); sit != sequence.end(); sit++) {
if ((*sit)->getAsAggregate()
&& (*sit)->getAsAggregate()->getOp() == EOpFunction) {
// do not stop search at function prototypes
if ((*sit)->getAsAggregate()->getSequence().size() != 0) {
if (!strcmp(sig,
(*sit)->getAsAggregate()->getName().c_str())) {
return *sit;
}
}
}
}
}
return NULL;
}
示例2: mergeBodies
//
// Merge the function bodies and global-level initializers from unitGlobals into globals.
// Will error check duplication of function bodies for the same signature.
//
void TIntermediate::mergeBodies(TInfoSink& infoSink, TIntermSequence& globals, const TIntermSequence& unitGlobals)
{
// TODO: link-time performance: Processing in alphabetical order will be faster
// Error check the global objects, not including the linker objects
for (unsigned int child = 0; child < globals.size() - 1; ++child) {
for (unsigned int unitChild = 0; unitChild < unitGlobals.size() - 1; ++unitChild) {
TIntermAggregate* body = globals[child]->getAsAggregate();
TIntermAggregate* unitBody = unitGlobals[unitChild]->getAsAggregate();
if (body && unitBody && body->getOp() == EOpFunction && unitBody->getOp() == EOpFunction && body->getName() == unitBody->getName()) {
error(infoSink, "Multiple function bodies in multiple compilation units for the same signature in the same stage:");
infoSink.info << " " << globals[child]->getAsAggregate()->getName() << "\n";
}
}
}
// Merge the global objects, just in front of the linker objects
globals.insert(globals.end() - 1, unitGlobals.begin(), unitGlobals.end() - 1);
}