本文整理汇总了C++中TType::setQualifier方法的典型用法代码示例。如果您正苦于以下问题:C++ TType::setQualifier方法的具体用法?C++ TType::setQualifier怎么用?C++ TType::setQualifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TType
的用法示例。
在下文中一共展示了TType::setQualifier方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateRawFunctionCall
TIntermAggregate *EmulatePrecision::createCompoundAssignmentFunctionCallNode(TIntermTyped *left,
TIntermTyped *right,
const char *opNameStr)
{
std::stringstream strstr = sh::InitializeStream<std::stringstream>();
if (left->getPrecision() == EbpMedium)
strstr << "angle_compound_" << opNameStr << "_frm";
else
strstr << "angle_compound_" << opNameStr << "_frl";
ImmutableString functionName = ImmutableString(strstr.str());
TIntermSequence *arguments = new TIntermSequence();
arguments->push_back(left);
arguments->push_back(right);
TVector<const TVariable *> parameters;
TType *leftParamType = new TType(left->getType());
leftParamType->setPrecision(EbpHigh);
leftParamType->setQualifier(EvqOut);
parameters.push_back(new TVariable(mSymbolTable, kParamXName,
static_cast<const TType *>(leftParamType),
SymbolType::AngleInternal));
TType *rightParamType = new TType(right->getType());
rightParamType->setPrecision(EbpHigh);
rightParamType->setQualifier(EvqIn);
parameters.push_back(new TVariable(mSymbolTable, kParamYName,
static_cast<const TType *>(rightParamType),
SymbolType::AngleInternal));
return TIntermAggregate::CreateRawFunctionCall(
*getInternalFunction(functionName, left->getType(), arguments, parameters, false),
arguments);
}
示例2: createTempVariable
TString ScalarizeVecAndMatConstructorArgs::createTempVariable(TIntermTyped *original)
{
TString tempVarName = "_webgl_tmp_";
if (original->isScalar())
{
tempVarName += "scalar_";
}
else if (original->isVector())
{
tempVarName += "vec_";
}
else
{
ASSERT(original->isMatrix());
tempVarName += "mat_";
}
tempVarName += Str(mTempVarCount).c_str();
mTempVarCount++;
ASSERT(original);
TType type = original->getType();
type.setQualifier(EvqTemporary);
if (mShaderType == GL_FRAGMENT_SHADER &&
type.getBasicType() == EbtFloat &&
type.getPrecision() == EbpUndefined)
{
// We use the highest available precision for the temporary variable
// to avoid computing the actual precision using the rules defined
// in GLSL ES 1.0 Section 4.5.2.
type.setPrecision(mFragmentPrecisionHigh ? EbpHigh : EbpMedium);
}
TIntermBinary *init = new TIntermBinary(EOpInitialize);
TIntermSymbol *symbolNode = new TIntermSymbol(-1, tempVarName, type);
init->setLeft(symbolNode);
init->setRight(original);
init->setType(type);
TIntermAggregate *decl = new TIntermAggregate(EOpDeclaration);
decl->getSequence()->push_back(init);
ASSERT(mSequenceStack.size() > 0);
TIntermSequence &sequence = mSequenceStack.back();
sequence.push_back(decl);
return tempVarName;
}
示例3: addConstructor
void StructureHLSL::addConstructor(const TType &type, const TString &name, const TIntermSequence *parameters)
{
if (name == "")
{
return; // Nameless structures don't have constructors
}
if (type.getStruct() && mStructNames.find(name) != mStructNames.end())
{
return; // Already added
}
TType ctorType = type;
ctorType.clearArrayness();
ctorType.setPrecision(EbpHigh);
ctorType.setQualifier(EvqTemporary);
typedef std::vector<TType> ParameterArray;
ParameterArray ctorParameters;
const TStructure* structure = type.getStruct();
if (structure)
{
mStructNames.insert(name);
// Add element index
storeStd140ElementIndex(*structure, false);
storeStd140ElementIndex(*structure, true);
const TString &structString = defineQualified(*structure, false, false);
if (std::find(mStructDeclarations.begin(), mStructDeclarations.end(), structString) == mStructDeclarations.end())
{
// Add row-major packed struct for interface blocks
TString rowMajorString = "#pragma pack_matrix(row_major)\n" +
defineQualified(*structure, true, false) +
"#pragma pack_matrix(column_major)\n";
TString std140String = defineQualified(*structure, false, true);
TString std140RowMajorString = "#pragma pack_matrix(row_major)\n" +
defineQualified(*structure, true, true) +
"#pragma pack_matrix(column_major)\n";
mStructDeclarations.push_back(structString);
mStructDeclarations.push_back(rowMajorString);
mStructDeclarations.push_back(std140String);
mStructDeclarations.push_back(std140RowMajorString);
}
const TFieldList &fields = structure->fields();
for (unsigned int i = 0; i < fields.size(); i++)
{
ctorParameters.push_back(*fields[i]->type());
}
}
else if (parameters)
{
for (TIntermSequence::const_iterator parameter = parameters->begin(); parameter != parameters->end(); parameter++)
{
ctorParameters.push_back((*parameter)->getAsTyped()->getType());
}
}
else UNREACHABLE();
TString constructor;
if (ctorType.getStruct())
{
constructor += name + " " + name + "_ctor(";
}
else // Built-in type
{
constructor += TypeString(ctorType) + " " + name + "(";
}
for (unsigned int parameter = 0; parameter < ctorParameters.size(); parameter++)
{
const TType ¶mType = ctorParameters[parameter];
constructor += TypeString(paramType) + " x" + str(parameter) + ArrayString(paramType);
if (parameter < ctorParameters.size() - 1)
{
constructor += ", ";
}
}
constructor += ")\n"
"{\n";
if (ctorType.getStruct())
{
constructor += " " + name + " structure = {";
}
else
{
constructor += " return " + TypeString(ctorType) + "(";
}
if (ctorType.isMatrix() && ctorParameters.size() == 1)
//.........这里部分代码省略.........