本文整理汇总了C++中TFunction类的典型用法代码示例。如果您正苦于以下问题:C++ TFunction类的具体用法?C++ TFunction怎么用?C++ TFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TFunction类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: relateToExtension
//
// Change all function entries in the table with the non-mangled name
// to be related to the provided built-in extension. This is a low
// performance operation, and only intended for symbol tables that
// live across a large number of compiles.
//
void TSymbolTableLevel::relateToExtension(const char* name, const TString& ext)
{
for (tLevel::iterator it = level.begin(); it != level.end(); ++it) {
if (it->second->isFunction()) {
TFunction* function = static_cast<TFunction*>(it->second);
if (function->getName() == name)
function->relateToExtension(ext);
}
}
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:16,代码来源:SymbolTable.cpp
示例2: relateToOperator
//
// Change all function entries in the table with the non-mangled name
// to be related to the provided built-in operation. This is a low
// performance operation, and only intended for symbol tables that
// live across a large number of compiles.
//
void TSymbolTableLevel::relateToOperator(const char* name, TOperator op)
{
tLevel::iterator it;
for (it = level.begin(); it != level.end(); ++it) {
if ((*it).second->isFunction()) {
TFunction* function = static_cast<TFunction*>((*it).second);
if (function->getName() == name)
function->relateToOperator(op);
}
}
}
开发者ID:0x163mL,项目名称:phantomjs,代码行数:17,代码来源:SymbolTable.cpp
示例3: while
//
// Change all function entries in the table with the non-mangled name
// to be related to the provided built-in operation.
//
void TSymbolTableLevel::relateToOperator(const char* name, TOperator op)
{
tLevel::const_iterator candidate = level.lower_bound(name);
while (candidate != level.end()) {
const TString& candidateName = (*candidate).first;
TString::size_type parenAt = candidateName.find_first_of('(');
if (parenAt != candidateName.npos && candidateName.compare(0, parenAt, name) == 0) {
TFunction* function = (*candidate).second->getAsFunction();
function->relateToOperator(op);
} else
break;
++candidate;
}
}
开发者ID:CallmeNezha,项目名称:bgfx,代码行数:18,代码来源:SymbolTable.cpp
示例4: ASSERT
bool ValidateLimitations::validateFunctionCall(TIntermAggregate *node)
{
ASSERT(node->getOp() == EOpFunctionCall);
// If not within loop body, there is nothing to check.
if (!withinLoopBody())
return true;
// List of param indices for which loop indices are used as argument.
typedef std::vector<size_t> ParamIndex;
ParamIndex pIndex;
TIntermSequence *params = node->getSequence();
for (TIntermSequence::size_type i = 0; i < params->size(); ++i)
{
TIntermSymbol *symbol = (*params)[i]->getAsSymbolNode();
if (symbol && isLoopIndex(symbol))
pIndex.push_back(i);
}
// If none of the loop indices are used as arguments,
// there is nothing to check.
if (pIndex.empty())
return true;
bool valid = true;
TSymbolTable& symbolTable = GetGlobalParseContext()->symbolTable;
TSymbol *symbol = symbolTable.find(node->getFunctionSymbolInfo()->getName(),
GetGlobalParseContext()->getShaderVersion());
ASSERT(symbol && symbol->isFunction());
TFunction *function = static_cast<TFunction *>(symbol);
for (ParamIndex::const_iterator i = pIndex.begin();
i != pIndex.end(); ++i)
{
const TConstParameter ¶m = function->getParam(*i);
TQualifier qual = param.type->getQualifier();
if ((qual == EvqOut) || (qual == EvqInOut))
{
error((*params)[*i]->getLine(),
"Loop index cannot be used as argument to a function out or inout parameter",
(*params)[*i]->getAsSymbolNode()->getSymbol().c_str());
valid = false;
}
}
return valid;
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:45,代码来源:ValidateLimitations.cpp
示例5: acceptFunctionDefinition
// Do the work to create the function definition in addition to
// parsing the body (compound_statement).
bool HlslGrammar::acceptFunctionDefinition(TFunction& function, TIntermNode*& node)
{
TFunction* functionDeclarator = parseContext.handleFunctionDeclarator(token.loc, function, false /* not prototype */);
// This does a symbol table push
node = parseContext.handleFunctionDefinition(token.loc, *functionDeclarator);
// compound_statement
TIntermAggregate* functionBody = nullptr;
if (acceptCompoundStatement(functionBody)) {
node = intermediate.growAggregate(node, functionBody);
intermediate.setAggregateOperator(node, EOpFunction, functionDeclarator->getType(), token.loc);
node->getAsAggregate()->setName(functionDeclarator->getMangledName().c_str());
parseContext.symbolTable.pop(nullptr);
return true;
}
return false;
}
开发者ID:DavidYen,项目名称:glslang,代码行数:22,代码来源:hlslGrammar.cpp
示例6: TFunction
const TFunction *EmulatePrecision::getInternalFunction(const ImmutableString &functionName,
const TType &returnType,
TIntermSequence *arguments,
const TVector<const TVariable *> ¶meters,
bool knownToNotHaveSideEffects)
{
ImmutableString mangledName = TFunctionLookup::GetMangledName(functionName.data(), *arguments);
if (mInternalFunctions.find(mangledName) == mInternalFunctions.end())
{
TFunction *func = new TFunction(mSymbolTable, functionName, SymbolType::AngleInternal,
new TType(returnType), knownToNotHaveSideEffects);
ASSERT(parameters.size() == arguments->size());
for (size_t i = 0; i < parameters.size(); ++i)
{
func->addParameter(parameters[i]);
}
mInternalFunctions[mangledName] = func;
}
return mInternalFunctions[mangledName];
}
开发者ID:google,项目名称:angle,代码行数:20,代码来源:EmulatePrecision.cpp
示例7: acceptParameterDeclaration
// parameter_declaration
// : fully_specified_type
// | fully_specified_type identifier
//
bool HlslGrammar::acceptParameterDeclaration(TFunction& function)
{
// fully_specified_type
TType* type = new TType;
if (! acceptFullySpecifiedType(*type))
return false;
// identifier
HlslToken idToken;
acceptIdentifier(idToken);
TParameter param = { idToken.string, type };
function.addParameter(param);
return true;
}
开发者ID:DavidYen,项目名称:glslang,代码行数:20,代码来源:hlslGrammar.cpp
示例8: insertUnmangledBuiltIn
void TSymbolTable::insertBuiltIn(ESymbolLevel level, TOperator op, const char *ext, const TType *rvalue, const char *name,
const TType *ptype1, const TType *ptype2, const TType *ptype3, const TType *ptype4, const TType *ptype5)
{
if (ptype1->getBasicType() == EbtGSampler2D)
{
insertUnmangledBuiltIn(name);
bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
insertBuiltIn(level, gvec4 ? TCache::getType(EbtFloat, 4) : rvalue, name, TCache::getType(EbtSampler2D), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? TCache::getType(EbtInt, 4) : rvalue, name, TCache::getType(EbtISampler2D), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? TCache::getType(EbtUInt, 4) : rvalue, name, TCache::getType(EbtUSampler2D), ptype2, ptype3, ptype4, ptype5);
}
else if (ptype1->getBasicType() == EbtGSampler3D)
{
insertUnmangledBuiltIn(name);
bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
insertBuiltIn(level, gvec4 ? TCache::getType(EbtFloat, 4) : rvalue, name, TCache::getType(EbtSampler3D), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? TCache::getType(EbtInt, 4) : rvalue, name, TCache::getType(EbtISampler3D), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? TCache::getType(EbtUInt, 4) : rvalue, name, TCache::getType(EbtUSampler3D), ptype2, ptype3, ptype4, ptype5);
}
else if (ptype1->getBasicType() == EbtGSamplerCube)
{
insertUnmangledBuiltIn(name);
bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
insertBuiltIn(level, gvec4 ? TCache::getType(EbtFloat, 4) : rvalue, name, TCache::getType(EbtSamplerCube), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? TCache::getType(EbtInt, 4) : rvalue, name, TCache::getType(EbtISamplerCube), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? TCache::getType(EbtUInt, 4) : rvalue, name, TCache::getType(EbtUSamplerCube), ptype2, ptype3, ptype4, ptype5);
}
else if (ptype1->getBasicType() == EbtGSampler2DArray)
{
insertUnmangledBuiltIn(name);
bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
insertBuiltIn(level, gvec4 ? TCache::getType(EbtFloat, 4) : rvalue, name, TCache::getType(EbtSampler2DArray), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? TCache::getType(EbtInt, 4) : rvalue, name, TCache::getType(EbtISampler2DArray), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? TCache::getType(EbtUInt, 4) : rvalue, name, TCache::getType(EbtUSampler2DArray), ptype2, ptype3, ptype4, ptype5);
}
else if (IsGenType(rvalue) || IsGenType(ptype1) || IsGenType(ptype2) || IsGenType(ptype3))
{
ASSERT(!ptype4 && !ptype5);
insertUnmangledBuiltIn(name);
insertBuiltIn(level, op, ext, SpecificType(rvalue, 1), name, SpecificType(ptype1, 1), SpecificType(ptype2, 1), SpecificType(ptype3, 1));
insertBuiltIn(level, op, ext, SpecificType(rvalue, 2), name, SpecificType(ptype1, 2), SpecificType(ptype2, 2), SpecificType(ptype3, 2));
insertBuiltIn(level, op, ext, SpecificType(rvalue, 3), name, SpecificType(ptype1, 3), SpecificType(ptype2, 3), SpecificType(ptype3, 3));
insertBuiltIn(level, op, ext, SpecificType(rvalue, 4), name, SpecificType(ptype1, 4), SpecificType(ptype2, 4), SpecificType(ptype3, 4));
}
else if (IsVecType(rvalue) || IsVecType(ptype1) || IsVecType(ptype2) || IsVecType(ptype3))
{
ASSERT(!ptype4 && !ptype5);
insertUnmangledBuiltIn(name);
insertBuiltIn(level, op, ext, VectorType(rvalue, 2), name, VectorType(ptype1, 2), VectorType(ptype2, 2), VectorType(ptype3, 2));
insertBuiltIn(level, op, ext, VectorType(rvalue, 3), name, VectorType(ptype1, 3), VectorType(ptype2, 3), VectorType(ptype3, 3));
insertBuiltIn(level, op, ext, VectorType(rvalue, 4), name, VectorType(ptype1, 4), VectorType(ptype2, 4), VectorType(ptype3, 4));
}
else
{
TFunction *function = new TFunction(NewPoolTString(name), rvalue, op, ext);
function->addParameter(TConstParameter(ptype1));
if (ptype2)
{
function->addParameter(TConstParameter(ptype2));
}
if (ptype3)
{
function->addParameter(TConstParameter(ptype3));
}
if (ptype4)
{
function->addParameter(TConstParameter(ptype4));
}
if (ptype5)
{
function->addParameter(TConstParameter(ptype5));
}
ASSERT(hasUnmangledBuiltIn(name));
insert(level, function);
}
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:82,代码来源:SymbolTable.cpp
示例9: insertBuiltIn
void TSymbolTable::insertBuiltIn(ESymbolLevel level, TOperator op, const char *ext, TType *rvalue, const char *name,
TType *ptype1, TType *ptype2, TType *ptype3, TType *ptype4, TType *ptype5)
{
if (ptype1->getBasicType() == EbtGSampler2D)
{
bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSampler2D), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISampler2D), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSampler2D), ptype2, ptype3, ptype4, ptype5);
}
else if (ptype1->getBasicType() == EbtGSampler3D)
{
bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSampler3D), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISampler3D), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSampler3D), ptype2, ptype3, ptype4, ptype5);
}
else if (ptype1->getBasicType() == EbtGSamplerCube)
{
bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSamplerCube), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISamplerCube), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSamplerCube), ptype2, ptype3, ptype4, ptype5);
}
else if (ptype1->getBasicType() == EbtGSampler2DArray)
{
bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSampler2DArray), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISampler2DArray), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSampler2DArray), ptype2, ptype3, ptype4, ptype5);
}
else if (IsGenType(rvalue) || IsGenType(ptype1) || IsGenType(ptype2) || IsGenType(ptype3))
{
ASSERT(!ptype4 && !ptype5);
insertBuiltIn(level, op, ext, SpecificType(rvalue, 1), name, SpecificType(ptype1, 1), SpecificType(ptype2, 1), SpecificType(ptype3, 1));
insertBuiltIn(level, op, ext, SpecificType(rvalue, 2), name, SpecificType(ptype1, 2), SpecificType(ptype2, 2), SpecificType(ptype3, 2));
insertBuiltIn(level, op, ext, SpecificType(rvalue, 3), name, SpecificType(ptype1, 3), SpecificType(ptype2, 3), SpecificType(ptype3, 3));
insertBuiltIn(level, op, ext, SpecificType(rvalue, 4), name, SpecificType(ptype1, 4), SpecificType(ptype2, 4), SpecificType(ptype3, 4));
}
else if (IsVecType(rvalue) || IsVecType(ptype1) || IsVecType(ptype2) || IsVecType(ptype3))
{
ASSERT(!ptype4 && !ptype5);
insertBuiltIn(level, op, ext, VectorType(rvalue, 2), name, VectorType(ptype1, 2), VectorType(ptype2, 2), VectorType(ptype3, 2));
insertBuiltIn(level, op, ext, VectorType(rvalue, 3), name, VectorType(ptype1, 3), VectorType(ptype2, 3), VectorType(ptype3, 3));
insertBuiltIn(level, op, ext, VectorType(rvalue, 4), name, VectorType(ptype1, 4), VectorType(ptype2, 4), VectorType(ptype3, 4));
}
else
{
TFunction *function = new TFunction(NewPoolTString(name), *rvalue, op, ext);
TParameter param1 = {0, ptype1};
function->addParameter(param1);
if (ptype2)
{
TParameter param2 = {0, ptype2};
function->addParameter(param2);
}
if (ptype3)
{
TParameter param3 = {0, ptype3};
function->addParameter(param3);
}
if (ptype4)
{
TParameter param4 = {0, ptype4};
function->addParameter(param4);
}
if (ptype5)
{
TParameter param5 = {0, ptype5};
function->addParameter(param5);
}
insert(level, function);
}
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:80,代码来源:SymbolTable.cpp
示例10: constructorErrorCheck
//
// Make sure there is enough data provided to the constructor to build
// something of the type of the constructor. Also returns the type of
// the constructor.
//
// Returns true if there was an error in construction.
//
bool TParseContext::constructorErrorCheck(int line, TIntermNode* node, TFunction& function, TOperator op, TType* type)
{
*type = function.getReturnType();
bool constructingMatrix = false;
switch(op) {
case EOpConstructMat2:
case EOpConstructMat3:
case EOpConstructMat4:
constructingMatrix = true;
break;
default:
break;
}
//
// Note: It's okay to have too many components available, but not okay to have unused
// arguments. 'full' will go to true when enough args have been seen. If we loop
// again, there is an extra argument, so 'overfull' will become true.
//
int size = 0;
bool constType = true;
bool full = false;
bool overFull = false;
bool matrixInMatrix = false;
bool arrayArg = false;
for (int i = 0; i < function.getParamCount(); ++i) {
const TParameter& param = function.getParam(i);
size += param.type->getObjectSize();
if (constructingMatrix && param.type->isMatrix())
matrixInMatrix = true;
if (full)
overFull = true;
if (op != EOpConstructStruct && !type->isArray() && size >= type->getObjectSize())
full = true;
if (param.type->getQualifier() != EvqConst)
constType = false;
if (param.type->isArray())
arrayArg = true;
}
if (constType)
type->setQualifier(EvqConst);
if (type->isArray() && type->getArraySize() != function.getParamCount()) {
error(line, "array constructor needs one argument per array element", "constructor", "");
return true;
}
if (arrayArg && op != EOpConstructStruct) {
error(line, "constructing from a non-dereferenced array", "constructor", "");
return true;
}
if (matrixInMatrix && !type->isArray()) {
if (function.getParamCount() != 1) {
error(line, "constructing matrix from matrix can only take one argument", "constructor", "");
return true;
}
}
if (overFull) {
error(line, "too many arguments", "constructor", "");
return true;
}
if (op == EOpConstructStruct && !type->isArray() && int(type->getStruct()->size()) != function.getParamCount()) {
error(line, "Number of constructor parameters does not match the number of structure fields", "constructor", "");
return true;
}
if (!type->isMatrix() || !matrixInMatrix) {
if ((op != EOpConstructStruct && size != 1 && size < type->getObjectSize()) ||
(op == EOpConstructStruct && size < type->getObjectSize())) {
error(line, "not enough data provided for construction", "constructor", "");
return true;
}
}
TIntermTyped *typed = node ? node->getAsTyped() : 0;
if (typed == 0) {
error(line, "constructor argument does not have a type", "constructor", "");
return true;
}
if (op != EOpConstructStruct && IsSampler(typed->getBasicType())) {
error(line, "cannot convert a sampler", "constructor", "");
return true;
}
if (typed->getBasicType() == EbtVoid) {
error(line, "cannot convert a void", "constructor", "");
return true;
//.........这里部分代码省略.........
开发者ID:Anachid,项目名称:mozilla-central,代码行数:101,代码来源:ParseHelper.cpp
示例11: addToFunctionMap
void TLValueTrackingTraverser::traverseAggregate(TIntermAggregate *node)
{
bool visit = true;
TIntermSequence *sequence = node->getSequence();
if (node->getOp() == EOpPrototype)
{
addToFunctionMap(node->getFunctionSymbolInfo()->getNameObj(), sequence);
}
if (preVisit)
visit = visitAggregate(PreVisit, node);
if (visit)
{
bool inFunctionMap = false;
if (node->getOp() == EOpFunctionCall)
{
inFunctionMap = isInFunctionMap(node);
if (!inFunctionMap)
{
// The function is not user-defined - it is likely built-in texture function.
// Assume that those do not have out parameters.
setInFunctionCallOutParameter(false);
}
}
incrementDepth(node);
if (inFunctionMap)
{
TIntermSequence *params = getFunctionParameters(node);
TIntermSequence::iterator paramIter = params->begin();
for (auto *child : *sequence)
{
ASSERT(paramIter != params->end());
TQualifier qualifier = (*paramIter)->getAsTyped()->getQualifier();
setInFunctionCallOutParameter(qualifier == EvqOut || qualifier == EvqInOut);
child->traverse(this);
if (visit && inVisit)
{
if (child != sequence->back())
visit = visitAggregate(InVisit, node);
}
++paramIter;
}
setInFunctionCallOutParameter(false);
}
else
{
// Find the built-in function corresponding to this op so that we can determine the
// in/out qualifiers of its parameters.
TFunction *builtInFunc = nullptr;
TString opString = GetOperatorString(node->getOp());
if (!node->isConstructor() && !opString.empty())
{
// The return type doesn't affect the mangled name of the function, which is used
// to look it up from the symbol table.
TType dummyReturnType;
TFunction call(&opString, &dummyReturnType, node->getOp());
for (auto *child : *sequence)
{
TType *paramType = child->getAsTyped()->getTypePointer();
TConstParameter p(paramType);
call.addParameter(p);
}
TSymbol *sym = mSymbolTable.findBuiltIn(call.getMangledName(), mShaderVersion);
if (sym != nullptr && sym->isFunction())
{
builtInFunc = static_cast<TFunction *>(sym);
ASSERT(builtInFunc->getParamCount() == sequence->size());
}
}
size_t paramIndex = 0;
for (auto *child : *sequence)
{
TQualifier qualifier = EvqIn;
if (builtInFunc != nullptr)
qualifier = builtInFunc->getParam(paramIndex).type->getQualifier();
setInFunctionCallOutParameter(qualifier == EvqOut || qualifier == EvqInOut);
child->traverse(this);
if (visit && inVisit)
{
if (child != sequence->back())
visit = visitAggregate(InVisit, node);
}
++paramIndex;
}
setInFunctionCallOutParameter(false);
}
//.........这里部分代码省略.........
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:101,代码来源:IntermTraverse.cpp
示例12: insertBuiltIn
void TSymbolTable::insertBuiltIn(
ESymbolLevel level, TType *rvalue, const char *name,
TType *ptype1, TType *ptype2, TType *ptype3, TType *ptype4, TType *ptype5)
{
if (ptype1->getBasicType() == EbtGSampler2D)
{
bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name,
new TType(EbtSampler2D), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name,
new TType(EbtISampler2D), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name,
new TType(EbtUSampler2D), ptype2, ptype3, ptype4, ptype5);
return;
}
if (ptype1->getBasicType() == EbtGSampler3D)
{
bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name,
new TType(EbtSampler3D), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name,
new TType(EbtISampler3D), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name,
new TType(EbtUSampler3D), ptype2, ptype3, ptype4, ptype5);
return;
}
if (ptype1->getBasicType() == EbtGSamplerCube)
{
bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name,
new TType(EbtSamplerCube), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name,
new TType(EbtISamplerCube), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name,
new TType(EbtUSamplerCube), ptype2, ptype3, ptype4, ptype5);
return;
}
if (ptype1->getBasicType() == EbtGSampler2DArray)
{
bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name,
new TType(EbtSampler2DArray), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name,
new TType(EbtISampler2DArray), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name,
new TType(EbtUSampler2DArray), ptype2, ptype3, ptype4, ptype5);
return;
}
TFunction *function = new TFunction(NewPoolTString(name), *rvalue);
TType *types[] = {ptype1, ptype2, ptype3, ptype4, ptype5};
for (size_t ii = 0; ii < sizeof(types) / sizeof(types[0]); ++ii)
{
if (types[ii])
{
TParameter param = {NULL, types[ii]};
function->addParameter(param);
}
}
insert(level, function);
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:63,代码来源:SymbolTable.cpp
注:本文中的TFunction类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论