Nonfunctional: Shorten some lines to the coding standard, to retrigger failed test run.
This commit is contained in:
@@ -53,10 +53,12 @@
|
|||||||
namespace glslang {
|
namespace glslang {
|
||||||
|
|
||||||
HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& interm, bool parsingBuiltins,
|
HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& interm, bool parsingBuiltins,
|
||||||
int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TInfoSink& infoSink,
|
int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language,
|
||||||
|
TInfoSink& infoSink,
|
||||||
const TString sourceEntryPointName,
|
const TString sourceEntryPointName,
|
||||||
bool forwardCompatible, EShMessages messages) :
|
bool forwardCompatible, EShMessages messages) :
|
||||||
TParseContextBase(symbolTable, interm, parsingBuiltins, version, profile, spvVersion, language, infoSink, forwardCompatible, messages),
|
TParseContextBase(symbolTable, interm, parsingBuiltins, version, profile, spvVersion, language, infoSink,
|
||||||
|
forwardCompatible, messages),
|
||||||
annotationNestingLevel(0),
|
annotationNestingLevel(0),
|
||||||
inputPatch(nullptr),
|
inputPatch(nullptr),
|
||||||
builtInIoIndex(nullptr),
|
builtInIoIndex(nullptr),
|
||||||
@@ -133,7 +135,8 @@ bool HlslParseContext::parseShaderStrings(TPpContext& ppContext, TInputScanner&
|
|||||||
// Print a message formated such that if you click on the message it will take you right to
|
// Print a message formated such that if you click on the message it will take you right to
|
||||||
// the line through most UIs.
|
// the line through most UIs.
|
||||||
const glslang::TSourceLoc& sourceLoc = input.getSourceLoc();
|
const glslang::TSourceLoc& sourceLoc = input.getSourceLoc();
|
||||||
infoSink.info << sourceLoc.name << "(" << sourceLoc.line << "): error at column " << sourceLoc.column << ", HLSL parsing failed.\n";
|
infoSink.info << sourceLoc.name << "(" << sourceLoc.line << "): error at column " << sourceLoc.column
|
||||||
|
<< ", HLSL parsing failed.\n";
|
||||||
++numErrors;
|
++numErrors;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -170,7 +173,8 @@ bool HlslParseContext::shouldConvertLValue(const TIntermNode* node) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HlslParseContext::growGlobalUniformBlock(const TSourceLoc& loc, TType& memberType, const TString& memberName, TTypeList* newTypeList)
|
void HlslParseContext::growGlobalUniformBlock(const TSourceLoc& loc, TType& memberType, const TString& memberName,
|
||||||
|
TTypeList* newTypeList)
|
||||||
{
|
{
|
||||||
newTypeList = nullptr;
|
newTypeList = nullptr;
|
||||||
correctUniform(memberType.getQualifier());
|
correctUniform(memberType.getQualifier());
|
||||||
@@ -395,12 +399,13 @@ TIntermTyped* HlslParseContext::handleLvalue(const TSourceLoc& loc, const char*
|
|||||||
// fall through...
|
// fall through...
|
||||||
case EOpAssign:
|
case EOpAssign:
|
||||||
{
|
{
|
||||||
// Since this is an lvalue, we'll convert an image load to a sequence like this (to still provide the value):
|
// Since this is an lvalue, we'll convert an image load to a sequence like this
|
||||||
|
// (to still provide the value):
|
||||||
// OpSequence
|
// OpSequence
|
||||||
// OpImageStore(object, lhs, rhs)
|
// OpImageStore(object, lhs, rhs)
|
||||||
// rhs
|
// rhs
|
||||||
// But if it's not a simple symbol RHS (say, a fn call), we don't want to duplicate the RHS, so we'll convert
|
// But if it's not a simple symbol RHS (say, a fn call), we don't want to duplicate the RHS,
|
||||||
// instead to this:
|
// so we'll convert instead to this:
|
||||||
// OpSequence
|
// OpSequence
|
||||||
// rhsTmp = rhs
|
// rhsTmp = rhs
|
||||||
// OpImageStore(object, coord, rhsTmp)
|
// OpImageStore(object, coord, rhsTmp)
|
||||||
@@ -828,7 +833,8 @@ TIntermTyped* HlslParseContext::handleBracketDereference(const TSourceLoc& loc,
|
|||||||
variableCheck(base);
|
variableCheck(base);
|
||||||
if (! base->isArray() && ! base->isMatrix() && ! base->isVector()) {
|
if (! base->isArray() && ! base->isMatrix() && ! base->isVector()) {
|
||||||
if (base->getAsSymbolNode())
|
if (base->getAsSymbolNode())
|
||||||
error(loc, " left of '[' is not of type array, matrix, or vector ", base->getAsSymbolNode()->getName().c_str(), "");
|
error(loc, " left of '[' is not of type array, matrix, or vector ",
|
||||||
|
base->getAsSymbolNode()->getName().c_str(), "");
|
||||||
else
|
else
|
||||||
error(loc, " left of '[' is not of type array, matrix, or vector ", "expression", "");
|
error(loc, " left of '[' is not of type array, matrix, or vector ", "expression", "");
|
||||||
} else if (base->getType().getQualifier().storage == EvqConst && index->getQualifier().storage == EvqConst)
|
} else if (base->getType().getQualifier().storage == EvqConst && index->getQualifier().storage == EvqConst)
|
||||||
@@ -882,7 +888,8 @@ void HlslParseContext::checkIndex(const TSourceLoc& /*loc*/, const TType& /*type
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle seeing a binary node with a math operation.
|
// Handle seeing a binary node with a math operation.
|
||||||
TIntermTyped* HlslParseContext::handleBinaryMath(const TSourceLoc& loc, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right)
|
TIntermTyped* HlslParseContext::handleBinaryMath(const TSourceLoc& loc, const char* str, TOperator op,
|
||||||
|
TIntermTyped* left, TIntermTyped* right)
|
||||||
{
|
{
|
||||||
TIntermTyped* result = intermediate.addBinaryMath(op, left, right, loc);
|
TIntermTyped* result = intermediate.addBinaryMath(op, left, right, loc);
|
||||||
if (result == nullptr)
|
if (result == nullptr)
|
||||||
@@ -892,7 +899,8 @@ TIntermTyped* HlslParseContext::handleBinaryMath(const TSourceLoc& loc, const ch
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle seeing a unary node with a math operation.
|
// Handle seeing a unary node with a math operation.
|
||||||
TIntermTyped* HlslParseContext::handleUnaryMath(const TSourceLoc& loc, const char* str, TOperator op, TIntermTyped* childNode)
|
TIntermTyped* HlslParseContext::handleUnaryMath(const TSourceLoc& loc, const char* str, TOperator op,
|
||||||
|
TIntermTyped* childNode)
|
||||||
{
|
{
|
||||||
TIntermTyped* result = intermediate.addUnaryMath(op, childNode, loc);
|
TIntermTyped* result = intermediate.addUnaryMath(op, childNode, loc);
|
||||||
|
|
||||||
@@ -957,9 +965,11 @@ TIntermTyped* HlslParseContext::handleDotDereference(const TSourceLoc& loc, TInt
|
|||||||
// Keep 'result' pointing to 'base', since we expect an operator[] to go by next.
|
// Keep 'result' pointing to 'base', since we expect an operator[] to go by next.
|
||||||
} else {
|
} else {
|
||||||
if (field == "mips")
|
if (field == "mips")
|
||||||
error(loc, "unexpected texture type for .mips[][] operator:", base->getType().getCompleteString().c_str(), "");
|
error(loc, "unexpected texture type for .mips[][] operator:",
|
||||||
|
base->getType().getCompleteString().c_str(), "");
|
||||||
else
|
else
|
||||||
error(loc, "unexpected operator on texture type:", field.c_str(), base->getType().getCompleteString().c_str());
|
error(loc, "unexpected operator on texture type:", field.c_str(),
|
||||||
|
base->getType().getCompleteString().c_str());
|
||||||
}
|
}
|
||||||
} else if (base->isVector() || base->isScalar()) {
|
} else if (base->isVector() || base->isScalar()) {
|
||||||
TSwizzleSelectors<TVectorSelector> selectors;
|
TSwizzleSelectors<TVectorSelector> selectors;
|
||||||
@@ -993,7 +1003,8 @@ TIntermTyped* HlslParseContext::handleDotDereference(const TSourceLoc& loc, TInt
|
|||||||
} else {
|
} else {
|
||||||
TIntermTyped* index = intermediate.addSwizzle(selectors, loc);
|
TIntermTyped* index = intermediate.addSwizzle(selectors, loc);
|
||||||
result = intermediate.addIndex(EOpVectorSwizzle, base, index, loc);
|
result = intermediate.addIndex(EOpVectorSwizzle, base, index, loc);
|
||||||
result->setType(TType(base->getBasicType(), EvqTemporary, base->getType().getQualifier().precision, selectors.size()));
|
result->setType(TType(base->getBasicType(), EvqTemporary, base->getType().getQualifier().precision,
|
||||||
|
selectors.size()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (base->isMatrix()) {
|
} else if (base->isMatrix()) {
|
||||||
@@ -1007,10 +1018,14 @@ TIntermTyped* HlslParseContext::handleDotDereference(const TSourceLoc& loc, TInt
|
|||||||
result = intermediate.foldDereference(base, selectors[0].coord1, loc);
|
result = intermediate.foldDereference(base, selectors[0].coord1, loc);
|
||||||
result = intermediate.foldDereference(result, selectors[0].coord2, loc);
|
result = intermediate.foldDereference(result, selectors[0].coord2, loc);
|
||||||
} else {
|
} else {
|
||||||
result = intermediate.addIndex(EOpIndexDirect, base, intermediate.addConstantUnion(selectors[0].coord1, loc), loc);
|
result = intermediate.addIndex(EOpIndexDirect, base,
|
||||||
|
intermediate.addConstantUnion(selectors[0].coord1, loc),
|
||||||
|
loc);
|
||||||
TType dereferencedCol(base->getType(), 0);
|
TType dereferencedCol(base->getType(), 0);
|
||||||
result->setType(dereferencedCol);
|
result->setType(dereferencedCol);
|
||||||
result = intermediate.addIndex(EOpIndexDirect, result, intermediate.addConstantUnion(selectors[0].coord2, loc), loc);
|
result = intermediate.addIndex(EOpIndexDirect, result,
|
||||||
|
intermediate.addConstantUnion(selectors[0].coord2, loc),
|
||||||
|
loc);
|
||||||
TType dereferenced(dereferencedCol, 0);
|
TType dereferenced(dereferencedCol, 0);
|
||||||
result->setType(dereferenced);
|
result->setType(dereferenced);
|
||||||
}
|
}
|
||||||
@@ -1021,7 +1036,8 @@ TIntermTyped* HlslParseContext::handleDotDereference(const TSourceLoc& loc, TInt
|
|||||||
if (base->getType().getQualifier().isFrontEndConstant())
|
if (base->getType().getQualifier().isFrontEndConstant())
|
||||||
result = intermediate.foldDereference(base, column, loc);
|
result = intermediate.foldDereference(base, column, loc);
|
||||||
else {
|
else {
|
||||||
result = intermediate.addIndex(EOpIndexDirect, base, intermediate.addConstantUnion(column, loc), loc);
|
result = intermediate.addIndex(EOpIndexDirect, base, intermediate.addConstantUnion(column, loc),
|
||||||
|
loc);
|
||||||
TType dereferenced(base->getType(), 0);
|
TType dereferenced(base->getType(), 0);
|
||||||
result->setType(dereferenced);
|
result->setType(dereferenced);
|
||||||
}
|
}
|
||||||
@@ -1029,7 +1045,8 @@ TIntermTyped* HlslParseContext::handleDotDereference(const TSourceLoc& loc, TInt
|
|||||||
// general case, not a column, not a single component
|
// general case, not a column, not a single component
|
||||||
TIntermTyped* index = intermediate.addSwizzle(selectors, loc);
|
TIntermTyped* index = intermediate.addSwizzle(selectors, loc);
|
||||||
result = intermediate.addIndex(EOpMatrixSwizzle, base, index, loc);
|
result = intermediate.addIndex(EOpMatrixSwizzle, base, index, loc);
|
||||||
result->setType(TType(base->getBasicType(), EvqTemporary, base->getType().getQualifier().precision, selectors.size()));
|
result->setType(TType(base->getBasicType(), EvqTemporary, base->getType().getQualifier().precision,
|
||||||
|
selectors.size()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (base->getBasicType() == EbtStruct || base->getBasicType() == EbtBlock) {
|
} else if (base->getBasicType() == EbtStruct || base->getBasicType() == EbtBlock) {
|
||||||
@@ -1145,13 +1162,16 @@ TType& HlslParseContext::split(TType& type, TString name, const TType* outerStru
|
|||||||
|
|
||||||
// Get iterator to (now at end) set of builtin interstage IO members
|
// Get iterator to (now at end) set of builtin interstage IO members
|
||||||
const auto firstIo = std::stable_partition(userStructure->begin(), userStructure->end(),
|
const auto firstIo = std::stable_partition(userStructure->begin(), userStructure->end(),
|
||||||
[this](const TTypeLoc& t) {return !t.type->isBuiltInInterstageIO(language);});
|
[this](const TTypeLoc& t) {
|
||||||
|
return !t.type->isBuiltInInterstageIO(language);
|
||||||
|
});
|
||||||
|
|
||||||
// Move those to the builtin IO. However, we also propagate arrayness (just one level is handled
|
// Move those to the builtin IO. However, we also propagate arrayness (just one level is handled
|
||||||
// now) to this variable.
|
// now) to this variable.
|
||||||
for (auto ioType = firstIo; ioType != userStructure->end(); ++ioType) {
|
for (auto ioType = firstIo; ioType != userStructure->end(); ++ioType) {
|
||||||
const TType& memberType = *ioType->type;
|
const TType& memberType = *ioType->type;
|
||||||
TVariable* ioVar = makeInternalVariable(name + (name.empty() ? "" : "_") + memberType.getFieldName(), memberType);
|
TVariable* ioVar = makeInternalVariable(name + (name.empty() ? "" : "_") + memberType.getFieldName(),
|
||||||
|
memberType);
|
||||||
|
|
||||||
if (arraySizes)
|
if (arraySizes)
|
||||||
ioVar->getWritableType().newArraySizes(*arraySizes);
|
ioVar->getWritableType().newArraySizes(*arraySizes);
|
||||||
@@ -1475,7 +1495,8 @@ TIntermTyped* HlslParseContext::splitAccessStruct(const TSourceLoc& loc, TInterm
|
|||||||
|
|
||||||
if (memberType.isBuiltInInterstageIO(language)) {
|
if (memberType.isBuiltInInterstageIO(language)) {
|
||||||
// It's one of the interstage IO variables we split off.
|
// It's one of the interstage IO variables we split off.
|
||||||
TIntermTyped* builtIn = intermediate.addSymbol(*interstageBuiltInIo[tInterstageIoData(memberType, base->getType())], loc);
|
TIntermTyped* builtIn = intermediate.addSymbol(*interstageBuiltInIo[tInterstageIoData(memberType,
|
||||||
|
base->getType())], loc);
|
||||||
|
|
||||||
// If there's an array reference to an outer split struct, we re-apply it here.
|
// If there's an array reference to an outer split struct, we re-apply it here.
|
||||||
if (builtInIoIndex != nullptr) {
|
if (builtInIoIndex != nullptr) {
|
||||||
@@ -1681,7 +1702,8 @@ void HlslParseContext::addInterstageIoToLinkage()
|
|||||||
// For struct buffers with counters, we must pass the counter buffer as hidden parameter.
|
// For struct buffers with counters, we must pass the counter buffer as hidden parameter.
|
||||||
// This adds the hidden parameter to the parameter list in 'paramNodes' if needed.
|
// This adds the hidden parameter to the parameter list in 'paramNodes' if needed.
|
||||||
// Otherwise, it's a no-op
|
// Otherwise, it's a no-op
|
||||||
void HlslParseContext::addStructBufferHiddenCounterParam(const TSourceLoc& loc, TParameter& param, TIntermAggregate*& paramNodes)
|
void HlslParseContext::addStructBufferHiddenCounterParam(const TSourceLoc& loc, TParameter& param,
|
||||||
|
TIntermAggregate*& paramNodes)
|
||||||
{
|
{
|
||||||
if (! hasStructBuffCounter(*param.type))
|
if (! hasStructBuffCounter(*param.type))
|
||||||
return;
|
return;
|
||||||
@@ -1707,7 +1729,8 @@ void HlslParseContext::addStructBufferHiddenCounterParam(const TSourceLoc& loc,
|
|||||||
// Returns an aggregate of parameter-symbol nodes.
|
// Returns an aggregate of parameter-symbol nodes.
|
||||||
//
|
//
|
||||||
TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& loc, TFunction& function,
|
TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& loc, TFunction& function,
|
||||||
const TAttributeMap& attributes, TIntermNode*& entryPointTree)
|
const TAttributeMap& attributes,
|
||||||
|
TIntermNode*& entryPointTree)
|
||||||
{
|
{
|
||||||
currentCaller = function.getMangledName();
|
currentCaller = function.getMangledName();
|
||||||
TSymbol* symbol = symbolTable.find(function.getMangledName());
|
TSymbol* symbol = symbolTable.find(function.getMangledName());
|
||||||
@@ -1774,7 +1797,8 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
|
|||||||
const TTypeList* structure = variable->getType().getStruct();
|
const TTypeList* structure = variable->getType().getStruct();
|
||||||
for (int mem = 0; mem < (int)structure->size(); ++mem) {
|
for (int mem = 0; mem < (int)structure->size(); ++mem) {
|
||||||
paramNodes = intermediate.growAggregate(paramNodes,
|
paramNodes = intermediate.growAggregate(paramNodes,
|
||||||
flattenAccess(variable->getUniqueId(), mem, *(*structure)[mem].type),
|
flattenAccess(variable->getUniqueId(), mem,
|
||||||
|
*(*structure)[mem].type),
|
||||||
loc);
|
loc);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1816,7 +1840,8 @@ void HlslParseContext::handleEntryPointAttributes(const TSourceLoc& loc, const T
|
|||||||
// MaxVertexCount
|
// MaxVertexCount
|
||||||
const TIntermAggregate* maxVertexCount = attributes[EatMaxVertexCount];
|
const TIntermAggregate* maxVertexCount = attributes[EatMaxVertexCount];
|
||||||
if (maxVertexCount != nullptr) {
|
if (maxVertexCount != nullptr) {
|
||||||
if (! intermediate.setVertices(maxVertexCount->getSequence()[0]->getAsConstantUnion()->getConstArray()[0].getIConst())) {
|
if (! intermediate.setVertices(maxVertexCount->getSequence()[0]->getAsConstantUnion()->
|
||||||
|
getConstArray()[0].getIConst())) {
|
||||||
error(loc, "cannot change previously set maxvertexcount attribute", "", "");
|
error(loc, "cannot change previously set maxvertexcount attribute", "", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1927,14 +1952,16 @@ void HlslParseContext::handleEntryPointAttributes(const TSourceLoc& loc, const T
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! intermediate.setVertexSpacing(partitioning))
|
if (! intermediate.setVertexSpacing(partitioning))
|
||||||
error(loc, "cannot change previously set partitioning", TQualifier::getVertexSpacingString(partitioning), "");
|
error(loc, "cannot change previously set partitioning",
|
||||||
|
TQualifier::getVertexSpacingString(partitioning), "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle [outputcontrolpoints("...")]
|
// Handle [outputcontrolpoints("...")]
|
||||||
const TIntermAggregate* outputControlPoints = attributes[EatOutputControlPoints];
|
const TIntermAggregate* outputControlPoints = attributes[EatOutputControlPoints];
|
||||||
if (outputControlPoints != nullptr) {
|
if (outputControlPoints != nullptr) {
|
||||||
const TConstUnion& ctrlPointConst = outputControlPoints->getSequence()[0]->getAsConstantUnion()->getConstArray()[0];
|
const TConstUnion& ctrlPointConst =
|
||||||
|
outputControlPoints->getSequence()[0]->getAsConstantUnion()->getConstArray()[0];
|
||||||
if (ctrlPointConst.getType() != EbtInt) {
|
if (ctrlPointConst.getType() != EbtInt) {
|
||||||
error(loc, "invalid outputcontrolpoints", "", "");
|
error(loc, "invalid outputcontrolpoints", "", "");
|
||||||
} else {
|
} else {
|
||||||
@@ -1978,7 +2005,8 @@ void HlslParseContext::handleEntryPointAttributes(const TSourceLoc& loc, const T
|
|||||||
// Returns nullptr if no entry-point tree was built, otherwise, returns
|
// Returns nullptr if no entry-point tree was built, otherwise, returns
|
||||||
// a subtree that creates the entry point.
|
// a subtree that creates the entry point.
|
||||||
//
|
//
|
||||||
TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunction& userFunction, const TAttributeMap& attributes)
|
TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunction& userFunction,
|
||||||
|
const TAttributeMap& attributes)
|
||||||
{
|
{
|
||||||
// Return true if this is a tessellation patch constant function input to a domain shader.
|
// Return true if this is a tessellation patch constant function input to a domain shader.
|
||||||
const auto isDsPcfInput = [this](const TType& type) {
|
const auto isDsPcfInput = [this](const TType& type) {
|
||||||
@@ -2155,7 +2183,8 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
|
|||||||
return synthFunctionDef;
|
return synthFunctionDef;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HlslParseContext::handleFunctionBody(const TSourceLoc& loc, TFunction& function, TIntermNode* functionBody, TIntermNode*& node)
|
void HlslParseContext::handleFunctionBody(const TSourceLoc& loc, TFunction& function, TIntermNode* functionBody,
|
||||||
|
TIntermNode*& node)
|
||||||
{
|
{
|
||||||
node = intermediate.growAggregate(node, functionBody);
|
node = intermediate.growAggregate(node, functionBody);
|
||||||
intermediate.setAggregateOperator(node, EOpFunction, function.getType(), loc);
|
intermediate.setAggregateOperator(node, EOpFunction, function.getType(), loc);
|
||||||
@@ -2405,7 +2434,7 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// If we haven't created the output arleady, create it now.
|
// If we haven't created the output already, create it now.
|
||||||
if (*clipCullVar == nullptr) {
|
if (*clipCullVar == nullptr) {
|
||||||
// ClipDistance and CullDistance are handled specially in the entry point output
|
// ClipDistance and CullDistance are handled specially in the entry point output
|
||||||
// copy algorithm, because they may need to be unpacked from components of vectors
|
// copy algorithm, because they may need to be unpacked from components of vectors
|
||||||
@@ -2518,7 +2547,8 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc
|
|||||||
// expected to then not exist for opaque types, because they will turn into aliases.
|
// expected to then not exist for opaque types, because they will turn into aliases.
|
||||||
//
|
//
|
||||||
// Return a node that contains the non-aliased assignments that must continue to exist.
|
// Return a node that contains the non-aliased assignments that must continue to exist.
|
||||||
TIntermAggregate* HlslParseContext::flattenedInit(const TSourceLoc& loc, TIntermSymbol* symbol, const TIntermAggregate& initializer)
|
TIntermAggregate* HlslParseContext::flattenedInit(const TSourceLoc& loc, TIntermSymbol* symbol,
|
||||||
|
const TIntermAggregate& initializer)
|
||||||
{
|
{
|
||||||
TIntermAggregate* initList = nullptr;
|
TIntermAggregate* initList = nullptr;
|
||||||
// synthesize an access to each member, and then an assignment to it
|
// synthesize an access to each member, and then an assignment to it
|
||||||
@@ -2544,7 +2574,8 @@ TIntermAggregate* HlslParseContext::flattenedInit(const TSourceLoc& loc, TInterm
|
|||||||
//
|
//
|
||||||
// Also, assignment to matrix swizzles requires multiple component assignments,
|
// Also, assignment to matrix swizzles requires multiple component assignments,
|
||||||
// intercept those as well.
|
// intercept those as well.
|
||||||
TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op, TIntermTyped* left, TIntermTyped* right)
|
TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op, TIntermTyped* left,
|
||||||
|
TIntermTyped* right)
|
||||||
{
|
{
|
||||||
if (left == nullptr || right == nullptr)
|
if (left == nullptr || right == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -2803,7 +2834,8 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
|
|||||||
// An assignment to matrix swizzle must be decomposed into individual assignments.
|
// An assignment to matrix swizzle must be decomposed into individual assignments.
|
||||||
// These must be selected component-wise from the RHS and stored component-wise
|
// These must be selected component-wise from the RHS and stored component-wise
|
||||||
// into the LHS.
|
// into the LHS.
|
||||||
TIntermTyped* HlslParseContext::handleAssignToMatrixSwizzle(const TSourceLoc& loc, TOperator op, TIntermTyped* left, TIntermTyped* right)
|
TIntermTyped* HlslParseContext::handleAssignToMatrixSwizzle(const TSourceLoc& loc, TOperator op, TIntermTyped* left,
|
||||||
|
TIntermTyped* right)
|
||||||
{
|
{
|
||||||
assert(left->getAsOperator() && left->getAsOperator()->getOp() == EOpMatrixSwizzle);
|
assert(left->getAsOperator() && left->getAsOperator()->getOp() == EOpMatrixSwizzle);
|
||||||
|
|
||||||
@@ -2885,7 +2917,8 @@ TOperator HlslParseContext::mapAtomicOp(const TSourceLoc& loc, TOperator op, boo
|
|||||||
//
|
//
|
||||||
// Create a combined sampler/texture from separate sampler and texture.
|
// Create a combined sampler/texture from separate sampler and texture.
|
||||||
//
|
//
|
||||||
TIntermAggregate* HlslParseContext::handleSamplerTextureCombine(const TSourceLoc& loc, TIntermTyped* argTex, TIntermTyped* argSampler)
|
TIntermAggregate* HlslParseContext::handleSamplerTextureCombine(const TSourceLoc& loc, TIntermTyped* argTex,
|
||||||
|
TIntermTyped* argSampler)
|
||||||
{
|
{
|
||||||
TIntermAggregate* txcombine = new TIntermAggregate(EOpConstructTextureSampler);
|
TIntermAggregate* txcombine = new TIntermAggregate(EOpConstructTextureSampler);
|
||||||
|
|
||||||
@@ -3045,7 +3078,8 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
|
|||||||
|
|
||||||
|
|
||||||
if (isByteAddressBuffer)
|
if (isByteAddressBuffer)
|
||||||
argIndex = intermediate.addBinaryNode(EOpRightShift, argIndex, intermediate.addConstantUnion(2, loc, true),
|
argIndex = intermediate.addBinaryNode(EOpRightShift, argIndex,
|
||||||
|
intermediate.addConstantUnion(2, loc, true),
|
||||||
loc, TType(EbtInt));
|
loc, TType(EbtInt));
|
||||||
|
|
||||||
// Index into the array to find the item being loaded.
|
// Index into the array to find the item being loaded.
|
||||||
@@ -3080,7 +3114,8 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
|
|||||||
// First, we'll store the address in a variable to avoid multiple shifts
|
// First, we'll store the address in a variable to avoid multiple shifts
|
||||||
// (we must convert the byte address to an item address)
|
// (we must convert the byte address to an item address)
|
||||||
TIntermTyped* byteAddrIdx = intermediate.addBinaryNode(EOpRightShift, argIndex,
|
TIntermTyped* byteAddrIdx = intermediate.addBinaryNode(EOpRightShift, argIndex,
|
||||||
intermediate.addConstantUnion(2, loc, true), loc, TType(EbtInt));
|
intermediate.addConstantUnion(2, loc, true),
|
||||||
|
loc, TType(EbtInt));
|
||||||
|
|
||||||
TVariable* byteAddrSym = makeInternalVariable("byteAddrTemp", TType(EbtInt, EvqTemporary));
|
TVariable* byteAddrSym = makeInternalVariable("byteAddrTemp", TType(EbtInt, EvqTemporary));
|
||||||
TIntermTyped* byteAddrIdxVar = intermediate.addSymbol(*byteAddrSym, loc);
|
TIntermTyped* byteAddrIdxVar = intermediate.addSymbol(*byteAddrSym, loc);
|
||||||
@@ -3096,10 +3131,12 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
|
|||||||
|
|
||||||
// add index offset
|
// add index offset
|
||||||
if (idx != 0)
|
if (idx != 0)
|
||||||
offsetIdx = intermediate.addBinaryNode(EOpAdd, offsetIdx, intermediate.addConstantUnion(idx, loc, true),
|
offsetIdx = intermediate.addBinaryNode(EOpAdd, offsetIdx,
|
||||||
|
intermediate.addConstantUnion(idx, loc, true),
|
||||||
loc, TType(EbtInt));
|
loc, TType(EbtInt));
|
||||||
|
|
||||||
const TOperator idxOp = (offsetIdx->getQualifier().storage == EvqConst) ? EOpIndexDirect : EOpIndexIndirect;
|
const TOperator idxOp = (offsetIdx->getQualifier().storage == EvqConst) ? EOpIndexDirect
|
||||||
|
: EOpIndexIndirect;
|
||||||
|
|
||||||
vec = intermediate.growAggregate(vec, intermediate.addIndex(idxOp, argArray, offsetIdx, loc));
|
vec = intermediate.growAggregate(vec, intermediate.addIndex(idxOp, argArray, offsetIdx, loc));
|
||||||
}
|
}
|
||||||
@@ -3158,7 +3195,8 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
|
|||||||
if (idx != 0)
|
if (idx != 0)
|
||||||
offsetIdx = intermediate.addBinaryNode(EOpAdd, offsetIdx, idxConst, loc, TType(EbtInt));
|
offsetIdx = intermediate.addBinaryNode(EOpAdd, offsetIdx, idxConst, loc, TType(EbtInt));
|
||||||
|
|
||||||
const TOperator idxOp = (offsetIdx->getQualifier().storage == EvqConst) ? EOpIndexDirect : EOpIndexIndirect;
|
const TOperator idxOp = (offsetIdx->getQualifier().storage == EvqConst) ? EOpIndexDirect
|
||||||
|
: EOpIndexIndirect;
|
||||||
|
|
||||||
TIntermTyped* lValue = intermediate.addIndex(idxOp, argArray, offsetIdx, loc);
|
TIntermTyped* lValue = intermediate.addIndex(idxOp, argArray, offsetIdx, loc);
|
||||||
TIntermTyped* rValue = (size == 1) ? argValue :
|
TIntermTyped* rValue = (size == 1) ? argValue :
|
||||||
@@ -3191,7 +3229,8 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
|
|||||||
body = intermediate.growAggregate(body, assign, loc);
|
body = intermediate.growAggregate(body, assign, loc);
|
||||||
} else {
|
} else {
|
||||||
const int length = argArray->getType().getOuterArraySize();
|
const int length = argArray->getType().getOuterArraySize();
|
||||||
TIntermTyped* assign = intermediate.addAssign(EOpAssign, argNumItems, intermediate.addConstantUnion(length, loc, true), loc);
|
TIntermTyped* assign = intermediate.addAssign(EOpAssign, argNumItems,
|
||||||
|
intermediate.addConstantUnion(length, loc, true), loc);
|
||||||
body = intermediate.growAggregate(body, assign, loc);
|
body = intermediate.growAggregate(body, assign, loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3202,7 +3241,8 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
|
|||||||
intermediate.getBaseAlignment(argArray->getType(), size, stride, false,
|
intermediate.getBaseAlignment(argArray->getType(), size, stride, false,
|
||||||
argArray->getType().getQualifier().layoutMatrix == ElmRowMajor);
|
argArray->getType().getQualifier().layoutMatrix == ElmRowMajor);
|
||||||
|
|
||||||
TIntermTyped* assign = intermediate.addAssign(EOpAssign, argStride, intermediate.addConstantUnion(stride, loc, true), loc);
|
TIntermTyped* assign = intermediate.addAssign(EOpAssign, argStride,
|
||||||
|
intermediate.addConstantUnion(stride, loc, true), loc);
|
||||||
|
|
||||||
body = intermediate.growAggregate(body, assign);
|
body = intermediate.growAggregate(body, assign);
|
||||||
}
|
}
|
||||||
@@ -3277,8 +3317,9 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
|
|||||||
{
|
{
|
||||||
TIntermTyped* oldCounter = incDecCounter(-1);
|
TIntermTyped* oldCounter = incDecCounter(-1);
|
||||||
|
|
||||||
TIntermTyped* newCounter = intermediate.addBinaryNode(EOpAdd, oldCounter, intermediate.addConstantUnion(-1, loc, true), loc,
|
TIntermTyped* newCounter = intermediate.addBinaryNode(EOpAdd, oldCounter,
|
||||||
oldCounter->getType());
|
intermediate.addConstantUnion(-1, loc, true), loc,
|
||||||
|
oldCounter->getType());
|
||||||
|
|
||||||
node = intermediate.addIndex(EOpIndexIndirect, argArray, newCounter, loc);
|
node = intermediate.addIndex(EOpIndexIndirect, argArray, newCounter, loc);
|
||||||
|
|
||||||
@@ -4716,7 +4757,8 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
|
|||||||
|
|
||||||
TIntermAggregate* compoundStatement = intermediate.makeAggregate(tmpArgAssign, loc);
|
TIntermAggregate* compoundStatement = intermediate.makeAggregate(tmpArgAssign, loc);
|
||||||
|
|
||||||
const TType boolType(EbtBool, EvqTemporary, arg0->getVectorSize(), arg0->getMatrixCols(), arg0->getMatrixRows());
|
const TType boolType(EbtBool, EvqTemporary, arg0->getVectorSize(), arg0->getMatrixCols(),
|
||||||
|
arg0->getMatrixRows());
|
||||||
|
|
||||||
TIntermTyped* isnan = handleUnaryMath(loc, "isnan", EOpIsNan, intermediate.addSymbol(*tempArg, loc));
|
TIntermTyped* isnan = handleUnaryMath(loc, "isnan", EOpIsNan, intermediate.addSymbol(*tempArg, loc));
|
||||||
isnan->setType(boolType);
|
isnan->setType(boolType);
|
||||||
@@ -4826,7 +4868,8 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct
|
|||||||
|
|
||||||
// Error check for a function requiring specific extensions present.
|
// Error check for a function requiring specific extensions present.
|
||||||
if (builtIn && fnCandidate->getNumExtensions())
|
if (builtIn && fnCandidate->getNumExtensions())
|
||||||
requireExtensions(loc, fnCandidate->getNumExtensions(), fnCandidate->getExtensions(), fnCandidate->getName().c_str());
|
requireExtensions(loc, fnCandidate->getNumExtensions(), fnCandidate->getExtensions(),
|
||||||
|
fnCandidate->getName().c_str());
|
||||||
|
|
||||||
// turn an implicit member-function resolution into an explicit call
|
// turn an implicit member-function resolution into an explicit call
|
||||||
TString callerName;
|
TString callerName;
|
||||||
@@ -4856,7 +4899,8 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct
|
|||||||
op = fnCandidate->getBuiltInOp();
|
op = fnCandidate->getBuiltInOp();
|
||||||
if (builtIn && op != EOpNull) {
|
if (builtIn && op != EOpNull) {
|
||||||
// A function call mapped to a built-in operation.
|
// A function call mapped to a built-in operation.
|
||||||
result = intermediate.addBuiltInFunctionCall(loc, op, fnCandidate->getParamCount() == 1, arguments, fnCandidate->getType());
|
result = intermediate.addBuiltInFunctionCall(loc, op, fnCandidate->getParamCount() == 1, arguments,
|
||||||
|
fnCandidate->getType());
|
||||||
if (result == nullptr) {
|
if (result == nullptr) {
|
||||||
error(arguments->getLoc(), " wrong operand type", "Internal Error",
|
error(arguments->getLoc(), " wrong operand type", "Internal Error",
|
||||||
"built in unary operator function. Type: %s",
|
"built in unary operator function. Type: %s",
|
||||||
@@ -4922,7 +4966,8 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct
|
|||||||
}
|
}
|
||||||
|
|
||||||
// generic error recovery
|
// generic error recovery
|
||||||
// TODO: simplification: localize all the error recoveries that look like this, and taking type into account to reduce cascades
|
// TODO: simplification: localize all the error recoveries that look like this, and taking type into account to
|
||||||
|
// reduce cascades
|
||||||
if (result == nullptr)
|
if (result == nullptr)
|
||||||
result = intermediate.addConstantUnion(0.0, EbtFloat, loc);
|
result = intermediate.addConstantUnion(0.0, EbtFloat, loc);
|
||||||
|
|
||||||
@@ -5000,7 +5045,8 @@ void HlslParseContext::addInputArgumentConversions(const TFunction& function, TI
|
|||||||
internalAggregate->getType());
|
internalAggregate->getType());
|
||||||
internalSymbolNode->setLoc(arg->getLoc());
|
internalSymbolNode->setLoc(arg->getLoc());
|
||||||
// This makes the deepest level, the member-wise copy
|
// This makes the deepest level, the member-wise copy
|
||||||
TIntermAggregate* assignAgg = handleAssign(arg->getLoc(), EOpAssign, internalSymbolNode, arg)->getAsAggregate();
|
TIntermAggregate* assignAgg = handleAssign(arg->getLoc(), EOpAssign,
|
||||||
|
internalSymbolNode, arg)->getAsAggregate();
|
||||||
|
|
||||||
// Now, pair that with the resulting aggregate.
|
// Now, pair that with the resulting aggregate.
|
||||||
assignAgg = intermediate.growAggregate(assignAgg, internalSymbolNode, arg->getLoc());
|
assignAgg = intermediate.growAggregate(assignAgg, internalSymbolNode, arg->getLoc());
|
||||||
@@ -5154,7 +5200,8 @@ TIntermTyped* HlslParseContext::addOutputArgumentConversions(const TFunction& fu
|
|||||||
TIntermSymbol* tempArgNode = intermediate.addSymbol(*tempArg, loc);
|
TIntermSymbol* tempArgNode = intermediate.addSymbol(*tempArg, loc);
|
||||||
|
|
||||||
// This makes the deepest level, the member-wise copy
|
// This makes the deepest level, the member-wise copy
|
||||||
TIntermTyped* tempAssign = handleAssign(arguments[i]->getLoc(), EOpAssign, arguments[i]->getAsTyped(), tempArgNode);
|
TIntermTyped* tempAssign = handleAssign(arguments[i]->getLoc(), EOpAssign, arguments[i]->getAsTyped(),
|
||||||
|
tempArgNode);
|
||||||
tempAssign = handleLvalue(arguments[i]->getLoc(), "assign", tempAssign);
|
tempAssign = handleLvalue(arguments[i]->getLoc(), "assign", tempAssign);
|
||||||
conversionTree = intermediate.growAggregate(conversionTree, tempAssign, arguments[i]->getLoc());
|
conversionTree = intermediate.growAggregate(conversionTree, tempAssign, arguments[i]->getLoc());
|
||||||
|
|
||||||
@@ -5264,7 +5311,8 @@ void HlslParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fn
|
|||||||
case EOpTextureGather:
|
case EOpTextureGather:
|
||||||
// More than two arguments needs gpu_shader5, and rectangular or shadow needs gpu_shader5,
|
// More than two arguments needs gpu_shader5, and rectangular or shadow needs gpu_shader5,
|
||||||
// otherwise, need GL_ARB_texture_gather.
|
// otherwise, need GL_ARB_texture_gather.
|
||||||
if (fnCandidate.getParamCount() > 2 || fnCandidate[0].type->getSampler().dim == EsdRect || fnCandidate[0].type->getSampler().shadow) {
|
if (fnCandidate.getParamCount() > 2 || fnCandidate[0].type->getSampler().dim == EsdRect ||
|
||||||
|
fnCandidate[0].type->getSampler().shadow) {
|
||||||
if (! fnCandidate[0].type->getSampler().shadow)
|
if (! fnCandidate[0].type->getSampler().shadow)
|
||||||
compArg = 2;
|
compArg = 2;
|
||||||
}
|
}
|
||||||
@@ -5326,7 +5374,8 @@ void HlslParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fn
|
|||||||
for (int c = 0; c < type.getVectorSize(); ++c) {
|
for (int c = 0; c < type.getVectorSize(); ++c) {
|
||||||
int offset = aggArgs[arg]->getAsConstantUnion()->getConstArray()[c].getIConst();
|
int offset = aggArgs[arg]->getAsConstantUnion()->getConstArray()[c].getIConst();
|
||||||
if (offset > resources.maxProgramTexelOffset || offset < resources.minProgramTexelOffset)
|
if (offset > resources.maxProgramTexelOffset || offset < resources.minProgramTexelOffset)
|
||||||
error(loc, "value is out of range:", "texel offset", "[gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]");
|
error(loc, "value is out of range:", "texel offset",
|
||||||
|
"[gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5362,7 +5411,8 @@ void HlslParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fn
|
|||||||
// desktop 4.4 and later: swizzles may be used
|
// desktop 4.4 and later: swizzles may be used
|
||||||
const TIntermTyped* base = TIntermediate::findLValueBase(arg0, true);
|
const TIntermTyped* base = TIntermediate::findLValueBase(arg0, true);
|
||||||
if (base == nullptr || base->getType().getQualifier().storage != EvqVaryingIn)
|
if (base == nullptr || base->getType().getQualifier().storage != EvqVaryingIn)
|
||||||
error(loc, "first argument must be an interpolant, or interpolant-array element", fnCandidate.getName().c_str(), "");
|
error(loc, "first argument must be an interpolant, or interpolant-array element",
|
||||||
|
fnCandidate.getName().c_str(), "");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -5573,14 +5623,16 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi
|
|||||||
|
|
||||||
// Convert to a scalar boolean, or if not allowed by HLSL semantics,
|
// Convert to a scalar boolean, or if not allowed by HLSL semantics,
|
||||||
// report an error and return nullptr.
|
// report an error and return nullptr.
|
||||||
TIntermTyped* HlslParseContext::convertConditionalExpression(const TSourceLoc& loc, TIntermTyped* condition, bool mustBeScalar)
|
TIntermTyped* HlslParseContext::convertConditionalExpression(const TSourceLoc& loc, TIntermTyped* condition,
|
||||||
|
bool mustBeScalar)
|
||||||
{
|
{
|
||||||
if (mustBeScalar && !condition->getType().isScalarOrVec1()) {
|
if (mustBeScalar && !condition->getType().isScalarOrVec1()) {
|
||||||
error(loc, "requires a scalar", "conditional expression", "");
|
error(loc, "requires a scalar", "conditional expression", "");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return intermediate.addConversion(EOpConstructBool, TType(EbtBool, EvqTemporary, condition->getVectorSize()), condition);
|
return intermediate.addConversion(EOpConstructBool, TType(EbtBool, EvqTemporary, condition->getVectorSize()),
|
||||||
|
condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -5805,7 +5857,8 @@ bool HlslParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node
|
|||||||
TArraySizes& arraySizes = type.getArraySizes();
|
TArraySizes& arraySizes = type.getArraySizes();
|
||||||
|
|
||||||
// At least the dimensionalities have to match.
|
// At least the dimensionalities have to match.
|
||||||
if (! function[0].type->isArray() || arraySizes.getNumDims() != function[0].type->getArraySizes().getNumDims() + 1) {
|
if (! function[0].type->isArray() ||
|
||||||
|
arraySizes.getNumDims() != function[0].type->getArraySizes().getNumDims() + 1) {
|
||||||
error(loc, "array constructor argument not correct type to construct array element", "constructor", "");
|
error(loc, "array constructor argument not correct type to construct array element", "constructor", "");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -5929,7 +5982,8 @@ bool HlslParseContext::constructorTextureSamplerError(const TSourceLoc& loc, con
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (function.getType().getSampler().shadow != function[1].type->getSampler().shadow) {
|
if (function.getType().getSampler().shadow != function[1].type->getSampler().shadow) {
|
||||||
error(loc, "sampler-constructor second argument presence of shadow must match constructor presence of shadow", token, "");
|
error(loc, "sampler-constructor second argument presence of shadow must match constructor presence of shadow",
|
||||||
|
token, "");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6019,7 +6073,8 @@ int HlslParseContext::computeSamplerTypeIndex(TSampler& sampler)
|
|||||||
int shadowIndex = sampler.shadow ? 1 : 0;
|
int shadowIndex = sampler.shadow ? 1 : 0;
|
||||||
int externalIndex = sampler.external ? 1 : 0;
|
int externalIndex = sampler.external ? 1 : 0;
|
||||||
|
|
||||||
return EsdNumDims * (EbtNumTypes * (2 * (2 * arrayIndex + shadowIndex) + externalIndex) + sampler.type) + sampler.dim;
|
return EsdNumDims *
|
||||||
|
(EbtNumTypes * (2 * (2 * arrayIndex + shadowIndex) + externalIndex) + sampler.type) + sampler.dim;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -6095,7 +6150,8 @@ void HlslParseContext::arrayDimMerge(TType& type, const TArraySizes* sizes)
|
|||||||
// Do all the semantic checking for declaring or redeclaring an array, with and
|
// Do all the semantic checking for declaring or redeclaring an array, with and
|
||||||
// without a size, and make the right changes to the symbol table.
|
// without a size, and make the right changes to the symbol table.
|
||||||
//
|
//
|
||||||
void HlslParseContext::declareArray(const TSourceLoc& loc, const TString& identifier, const TType& type, TSymbol*& symbol, bool track)
|
void HlslParseContext::declareArray(const TSourceLoc& loc, const TString& identifier, const TType& type,
|
||||||
|
TSymbol*& symbol, bool track)
|
||||||
{
|
{
|
||||||
if (symbol == nullptr) {
|
if (symbol == nullptr) {
|
||||||
bool currentScope;
|
bool currentScope;
|
||||||
@@ -6137,7 +6193,8 @@ void HlslParseContext::declareArray(const TSourceLoc& loc, const TString& identi
|
|||||||
TType& existingType = symbol->getWritableType();
|
TType& existingType = symbol->getWritableType();
|
||||||
|
|
||||||
if (existingType.isExplicitlySizedArray()) {
|
if (existingType.isExplicitlySizedArray()) {
|
||||||
// be more lenient for input arrays to geometry shaders and tessellation control outputs, where the redeclaration is the same size
|
// be more lenient for input arrays to geometry shaders and tessellation control outputs,
|
||||||
|
// where the redeclaration is the same size
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6193,7 +6250,8 @@ void HlslParseContext::updateImplicitArraySize(const TSourceLoc& loc, TIntermNod
|
|||||||
//
|
//
|
||||||
// Enforce non-initializer type/qualifier rules.
|
// Enforce non-initializer type/qualifier rules.
|
||||||
//
|
//
|
||||||
void HlslParseContext::fixConstInit(const TSourceLoc& loc, const TString& identifier, TType& type, TIntermTyped*& initializer)
|
void HlslParseContext::fixConstInit(const TSourceLoc& loc, const TString& identifier, TType& type,
|
||||||
|
TIntermTyped*& initializer)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Make the qualifier make sense, given that there is an initializer.
|
// Make the qualifier make sense, given that there is an initializer.
|
||||||
@@ -6231,7 +6289,8 @@ TSymbol* HlslParseContext::redeclareBuiltinVariable(const TSourceLoc& /*loc*/, c
|
|||||||
// Either redeclare the requested block, or give an error message why it can't be done.
|
// Either redeclare the requested block, or give an error message why it can't be done.
|
||||||
//
|
//
|
||||||
// TODO: functionality: explicitly sizing members of redeclared blocks is not giving them an explicit size
|
// TODO: functionality: explicitly sizing members of redeclared blocks is not giving them an explicit size
|
||||||
void HlslParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes)
|
void HlslParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blockName,
|
||||||
|
const TString* instanceName, TArraySizes* arraySizes)
|
||||||
{
|
{
|
||||||
// Redeclaring a built-in block...
|
// Redeclaring a built-in block...
|
||||||
|
|
||||||
@@ -6294,17 +6353,23 @@ void HlslParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& n
|
|||||||
TType& oldType = *member->type;
|
TType& oldType = *member->type;
|
||||||
const TType& newType = *newMember->type;
|
const TType& newType = *newMember->type;
|
||||||
if (! newType.sameElementType(oldType))
|
if (! newType.sameElementType(oldType))
|
||||||
error(memberLoc, "cannot redeclare block member with a different type", member->type->getFieldName().c_str(), "");
|
error(memberLoc, "cannot redeclare block member with a different type",
|
||||||
|
member->type->getFieldName().c_str(), "");
|
||||||
if (oldType.isArray() != newType.isArray())
|
if (oldType.isArray() != newType.isArray())
|
||||||
error(memberLoc, "cannot change arrayness of redeclared block member", member->type->getFieldName().c_str(), "");
|
error(memberLoc, "cannot change arrayness of redeclared block member",
|
||||||
|
member->type->getFieldName().c_str(), "");
|
||||||
else if (! oldType.sameArrayness(newType) && oldType.isExplicitlySizedArray())
|
else if (! oldType.sameArrayness(newType) && oldType.isExplicitlySizedArray())
|
||||||
error(memberLoc, "cannot change array size of redeclared block member", member->type->getFieldName().c_str(), "");
|
error(memberLoc, "cannot change array size of redeclared block member",
|
||||||
|
member->type->getFieldName().c_str(), "");
|
||||||
if (newType.getQualifier().isMemory())
|
if (newType.getQualifier().isMemory())
|
||||||
error(memberLoc, "cannot add memory qualifier to redeclared block member", member->type->getFieldName().c_str(), "");
|
error(memberLoc, "cannot add memory qualifier to redeclared block member",
|
||||||
|
member->type->getFieldName().c_str(), "");
|
||||||
if (newType.getQualifier().hasLayout())
|
if (newType.getQualifier().hasLayout())
|
||||||
error(memberLoc, "cannot add layout to redeclared block member", member->type->getFieldName().c_str(), "");
|
error(memberLoc, "cannot add layout to redeclared block member",
|
||||||
|
member->type->getFieldName().c_str(), "");
|
||||||
if (newType.getQualifier().patch)
|
if (newType.getQualifier().patch)
|
||||||
error(memberLoc, "cannot add patch to redeclared block member", member->type->getFieldName().c_str(), "");
|
error(memberLoc, "cannot add patch to redeclared block member",
|
||||||
|
member->type->getFieldName().c_str(), "");
|
||||||
oldType.getQualifier().centroid = newType.getQualifier().centroid;
|
oldType.getQualifier().centroid = newType.getQualifier().centroid;
|
||||||
oldType.getQualifier().sample = newType.getQualifier().sample;
|
oldType.getQualifier().sample = newType.getQualifier().sample;
|
||||||
oldType.getQualifier().invariant = newType.getQualifier().invariant;
|
oldType.getQualifier().invariant = newType.getQualifier().invariant;
|
||||||
@@ -6632,7 +6697,8 @@ void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TQualifier& qua
|
|||||||
|
|
||||||
// Put the id's layout qualifier value into the public type, for qualifiers having a number set.
|
// Put the id's layout qualifier value into the public type, for qualifiers having a number set.
|
||||||
// This is before we know any type information for error checking.
|
// This is before we know any type information for error checking.
|
||||||
void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TQualifier& qualifier, TString& id, const TIntermTyped* node)
|
void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TQualifier& qualifier, TString& id,
|
||||||
|
const TIntermTyped* node)
|
||||||
{
|
{
|
||||||
const char* feature = "layout-id value";
|
const char* feature = "layout-id value";
|
||||||
// const char* nonLiteralFeature = "non-literal layout-id value";
|
// const char* nonLiteralFeature = "non-literal layout-id value";
|
||||||
@@ -6690,7 +6756,8 @@ void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TQualifier& qua
|
|||||||
// "It is a compile-time error to specify an *xfb_buffer* that is greater than
|
// "It is a compile-time error to specify an *xfb_buffer* that is greater than
|
||||||
// the implementation-dependent constant gl_MaxTransformFeedbackBuffers."
|
// the implementation-dependent constant gl_MaxTransformFeedbackBuffers."
|
||||||
if (value >= resources.maxTransformFeedbackBuffers)
|
if (value >= resources.maxTransformFeedbackBuffers)
|
||||||
error(loc, "buffer is too large:", id.c_str(), "gl_MaxTransformFeedbackBuffers is %d", resources.maxTransformFeedbackBuffers);
|
error(loc, "buffer is too large:", id.c_str(), "gl_MaxTransformFeedbackBuffers is %d",
|
||||||
|
resources.maxTransformFeedbackBuffers);
|
||||||
if (value >= (int)TQualifier::layoutXfbBufferEnd)
|
if (value >= (int)TQualifier::layoutXfbBufferEnd)
|
||||||
error(loc, "buffer is too large:", id.c_str(), "internal max is %d", TQualifier::layoutXfbBufferEnd - 1);
|
error(loc, "buffer is too large:", id.c_str(), "internal max is %d", TQualifier::layoutXfbBufferEnd - 1);
|
||||||
else
|
else
|
||||||
@@ -6706,7 +6773,8 @@ void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TQualifier& qua
|
|||||||
// "The resulting stride (implicit or explicit), when divided by 4, must be less than or equal to the
|
// "The resulting stride (implicit or explicit), when divided by 4, must be less than or equal to the
|
||||||
// implementation-dependent constant gl_MaxTransformFeedbackInterleavedComponents."
|
// implementation-dependent constant gl_MaxTransformFeedbackInterleavedComponents."
|
||||||
if (value > 4 * resources.maxTransformFeedbackInterleavedComponents)
|
if (value > 4 * resources.maxTransformFeedbackInterleavedComponents)
|
||||||
error(loc, "1/4 stride is too large:", id.c_str(), "gl_MaxTransformFeedbackInterleavedComponents is %d", resources.maxTransformFeedbackInterleavedComponents);
|
error(loc, "1/4 stride is too large:", id.c_str(), "gl_MaxTransformFeedbackInterleavedComponents is %d",
|
||||||
|
resources.maxTransformFeedbackInterleavedComponents);
|
||||||
else if (value >= (int)TQualifier::layoutXfbStrideEnd)
|
else if (value >= (int)TQualifier::layoutXfbStrideEnd)
|
||||||
error(loc, "stride is too large:", id.c_str(), "internal max is %d", TQualifier::layoutXfbStrideEnd - 1);
|
error(loc, "stride is too large:", id.c_str(), "internal max is %d", TQualifier::layoutXfbStrideEnd - 1);
|
||||||
if (value < (int)TQualifier::layoutXfbStrideEnd)
|
if (value < (int)TQualifier::layoutXfbStrideEnd)
|
||||||
@@ -7317,7 +7385,8 @@ TSymbol* HlslParseContext::lookupUserType(const TString& typeName, TType& type)
|
|||||||
// 'parseType' is the type part of the declaration (to the left)
|
// 'parseType' is the type part of the declaration (to the left)
|
||||||
// 'arraySizes' is the arrayness tagged on the identifier (to the right)
|
// 'arraySizes' is the arrayness tagged on the identifier (to the right)
|
||||||
//
|
//
|
||||||
TIntermNode* HlslParseContext::declareVariable(const TSourceLoc& loc, const TString& identifier, TType& type, TIntermTyped* initializer)
|
TIntermNode* HlslParseContext::declareVariable(const TSourceLoc& loc, const TString& identifier, TType& type,
|
||||||
|
TIntermTyped* initializer)
|
||||||
{
|
{
|
||||||
if (voidErrorCheck(loc, identifier, type.getBasicType()))
|
if (voidErrorCheck(loc, identifier, type.getBasicType()))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -7424,7 +7493,8 @@ TVariable* HlslParseContext::makeInternalVariable(const char* name, const TType&
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make a symbol node holding a new internal temporary variable.
|
// Make a symbol node holding a new internal temporary variable.
|
||||||
TIntermSymbol* HlslParseContext::makeInternalVariableNode(const TSourceLoc& loc, const char* name, const TType& type) const
|
TIntermSymbol* HlslParseContext::makeInternalVariableNode(const TSourceLoc& loc, const char* name,
|
||||||
|
const TType& type) const
|
||||||
{
|
{
|
||||||
TVariable* tmpVar = makeInternalVariable(name, type);
|
TVariable* tmpVar = makeInternalVariable(name, type);
|
||||||
tmpVar->getWritableType().getQualifier().makeTemporary();
|
tmpVar->getWritableType().getQualifier().makeTemporary();
|
||||||
@@ -7438,7 +7508,8 @@ TIntermSymbol* HlslParseContext::makeInternalVariableNode(const TSourceLoc& loc,
|
|||||||
//
|
//
|
||||||
// Return the successfully declared variable.
|
// Return the successfully declared variable.
|
||||||
//
|
//
|
||||||
TVariable* HlslParseContext::declareNonArray(const TSourceLoc& loc, const TString& identifier, const TType& type, bool track)
|
TVariable* HlslParseContext::declareNonArray(const TSourceLoc& loc, const TString& identifier, const TType& type,
|
||||||
|
bool track)
|
||||||
{
|
{
|
||||||
// make a new variable
|
// make a new variable
|
||||||
TVariable* variable = new TVariable(&identifier, type);
|
TVariable* variable = new TVariable(&identifier, type);
|
||||||
@@ -7460,7 +7531,8 @@ TVariable* HlslParseContext::declareNonArray(const TSourceLoc& loc, const TStrin
|
|||||||
// Returning nullptr just means there is no code to execute to handle the
|
// Returning nullptr just means there is no code to execute to handle the
|
||||||
// initializer, which will, for example, be the case for constant initializers.
|
// initializer, which will, for example, be the case for constant initializers.
|
||||||
//
|
//
|
||||||
TIntermNode* HlslParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyped* initializer, TVariable* variable, bool flattened)
|
TIntermNode* HlslParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyped* initializer, TVariable* variable,
|
||||||
|
bool flattened)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Identifier must be of type constant, a global, or a temporary, and
|
// Identifier must be of type constant, a global, or a temporary, and
|
||||||
@@ -7624,7 +7696,8 @@ TIntermTyped* HlslParseContext::convertInitializerList(const TSourceLoc& loc, co
|
|||||||
// recursively process each element
|
// recursively process each element
|
||||||
TType elementType(arrayType, 0); // dereferenced type
|
TType elementType(arrayType, 0); // dereferenced type
|
||||||
for (int i = 0; i < arrayType.getOuterArraySize(); ++i) {
|
for (int i = 0; i < arrayType.getOuterArraySize(); ++i) {
|
||||||
initList->getSequence()[i] = convertInitializerList(loc, elementType, initList->getSequence()[i]->getAsTyped(), scalarInit);
|
initList->getSequence()[i] = convertInitializerList(loc, elementType,
|
||||||
|
initList->getSequence()[i]->getAsTyped(), scalarInit);
|
||||||
if (initList->getSequence()[i] == nullptr)
|
if (initList->getSequence()[i] == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -7639,7 +7712,8 @@ TIntermTyped* HlslParseContext::convertInitializerList(const TSourceLoc& loc, co
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < type.getStruct()->size(); ++i) {
|
for (size_t i = 0; i < type.getStruct()->size(); ++i) {
|
||||||
initList->getSequence()[i] = convertInitializerList(loc, *(*type.getStruct())[i].type, initList->getSequence()[i]->getAsTyped(), scalarInit);
|
initList->getSequence()[i] = convertInitializerList(loc, *(*type.getStruct())[i].type,
|
||||||
|
initList->getSequence()[i]->getAsTyped(), scalarInit);
|
||||||
if (initList->getSequence()[i] == nullptr)
|
if (initList->getSequence()[i] == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -7658,7 +7732,8 @@ TIntermTyped* HlslParseContext::convertInitializerList(const TSourceLoc& loc, co
|
|||||||
}
|
}
|
||||||
TType vectorType(type, 0); // dereferenced type
|
TType vectorType(type, 0); // dereferenced type
|
||||||
for (int i = 0; i < type.getMatrixCols(); ++i) {
|
for (int i = 0; i < type.getMatrixCols(); ++i) {
|
||||||
initList->getSequence()[i] = convertInitializerList(loc, vectorType, initList->getSequence()[i]->getAsTyped(), scalarInit);
|
initList->getSequence()[i] = convertInitializerList(loc, vectorType,
|
||||||
|
initList->getSequence()[i]->getAsTyped(), scalarInit);
|
||||||
if (initList->getSequence()[i] == nullptr)
|
if (initList->getSequence()[i] == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -7669,7 +7744,8 @@ TIntermTyped* HlslParseContext::convertInitializerList(const TSourceLoc& loc, co
|
|||||||
|
|
||||||
// error check; we're at bottom, so work is finished below
|
// error check; we're at bottom, so work is finished below
|
||||||
if (type.getVectorSize() != (int)initList->getSequence().size()) {
|
if (type.getVectorSize() != (int)initList->getSequence().size()) {
|
||||||
error(loc, "wrong vector size (or rows in a matrix column):", "initializer list", type.getCompleteString().c_str());
|
error(loc, "wrong vector size (or rows in a matrix column):", "initializer list",
|
||||||
|
type.getCompleteString().c_str());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
} else if (type.isScalar()) {
|
} else if (type.isScalar()) {
|
||||||
@@ -7856,7 +7932,8 @@ TIntermTyped* HlslParseContext::addConstructor(const TSourceLoc& loc, TIntermTyp
|
|||||||
//
|
//
|
||||||
// Returns nullptr for an error or the constructed node.
|
// Returns nullptr for an error or the constructed node.
|
||||||
//
|
//
|
||||||
TIntermTyped* HlslParseContext::constructBuiltIn(const TType& type, TOperator op, TIntermTyped* node, const TSourceLoc& loc, bool subset)
|
TIntermTyped* HlslParseContext::constructBuiltIn(const TType& type, TOperator op, TIntermTyped* node,
|
||||||
|
const TSourceLoc& loc, bool subset)
|
||||||
{
|
{
|
||||||
TIntermTyped* newNode;
|
TIntermTyped* newNode;
|
||||||
TOperator basicOp;
|
TOperator basicOp;
|
||||||
@@ -8208,7 +8285,8 @@ void HlslParseContext::declareBlock(const TSourceLoc& loc, TType& type, const TS
|
|||||||
TVariable& variable = *new TVariable(instanceName, blockType);
|
TVariable& variable = *new TVariable(instanceName, blockType);
|
||||||
if (! symbolTable.insert(variable)) {
|
if (! symbolTable.insert(variable)) {
|
||||||
if (*instanceName == "")
|
if (*instanceName == "")
|
||||||
error(loc, "nameless block contains a member that already has a name at global scope", "" /* blockName->c_str() */, "");
|
error(loc, "nameless block contains a member that already has a name at global scope",
|
||||||
|
"" /* blockName->c_str() */, "");
|
||||||
else
|
else
|
||||||
error(loc, "block instance name redefinition", variable.getName().c_str(), "");
|
error(loc, "block instance name redefinition", variable.getName().c_str(), "");
|
||||||
|
|
||||||
@@ -8256,7 +8334,8 @@ void HlslParseContext::fixBlockLocations(const TSourceLoc& loc, TQualifier& qual
|
|||||||
memberQualifier.layoutLocation = nextLocation;
|
memberQualifier.layoutLocation = nextLocation;
|
||||||
memberQualifier.layoutComponent = 0;
|
memberQualifier.layoutComponent = 0;
|
||||||
}
|
}
|
||||||
nextLocation = memberQualifier.layoutLocation + intermediate.computeTypeLocationSize(*typeList[member].type);
|
nextLocation = memberQualifier.layoutLocation +
|
||||||
|
intermediate.computeTypeLocationSize(*typeList[member].type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8319,8 +8398,9 @@ void HlslParseContext::fixBlockUniformOffsets(const TQualifier& qualifier, TType
|
|||||||
int dummyStride;
|
int dummyStride;
|
||||||
int memberAlignment = intermediate.getBaseAlignment(*typeList[member].type, memberSize, dummyStride,
|
int memberAlignment = intermediate.getBaseAlignment(*typeList[member].type, memberSize, dummyStride,
|
||||||
qualifier.layoutPacking == ElpStd140,
|
qualifier.layoutPacking == ElpStd140,
|
||||||
subMatrixLayout != ElmNone ? subMatrixLayout == ElmRowMajor
|
subMatrixLayout != ElmNone
|
||||||
: qualifier.layoutMatrix == ElmRowMajor);
|
? subMatrixLayout == ElmRowMajor
|
||||||
|
: qualifier.layoutMatrix == ElmRowMajor);
|
||||||
if (memberQualifier.hasOffset()) {
|
if (memberQualifier.hasOffset()) {
|
||||||
// "The specified offset must be a multiple
|
// "The specified offset must be a multiple
|
||||||
// of the base alignment of the type of the block member it qualifies, or a compile-time error results."
|
// of the base alignment of the type of the block member it qualifies, or a compile-time error results."
|
||||||
@@ -8497,12 +8577,14 @@ void HlslParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc,
|
|||||||
case ElgIsolines:
|
case ElgIsolines:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error(loc, "cannot apply to input", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), "");
|
error(loc, "cannot apply to input", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry),
|
||||||
|
"");
|
||||||
}
|
}
|
||||||
} else if (publicType.qualifier.storage == EvqVaryingOut) {
|
} else if (publicType.qualifier.storage == EvqVaryingOut) {
|
||||||
handleOutputGeometry(loc, publicType.shaderQualifiers.geometry);
|
handleOutputGeometry(loc, publicType.shaderQualifiers.geometry);
|
||||||
} else
|
} else
|
||||||
error(loc, "cannot apply to:", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), GetStorageQualifierString(publicType.qualifier.storage));
|
error(loc, "cannot apply to:", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry),
|
||||||
|
GetStorageQualifierString(publicType.qualifier.storage));
|
||||||
}
|
}
|
||||||
if (publicType.shaderQualifiers.spacing != EvsNone)
|
if (publicType.shaderQualifiers.spacing != EvsNone)
|
||||||
intermediate.setVertexSpacing(publicType.shaderQualifiers.spacing);
|
intermediate.setVertexSpacing(publicType.shaderQualifiers.spacing);
|
||||||
@@ -8560,7 +8642,8 @@ void HlslParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc,
|
|||||||
globalOutputDefaults.layoutXfbBuffer = qualifier.layoutXfbBuffer;
|
globalOutputDefaults.layoutXfbBuffer = qualifier.layoutXfbBuffer;
|
||||||
if (globalOutputDefaults.hasXfbBuffer() && qualifier.hasXfbStride()) {
|
if (globalOutputDefaults.hasXfbBuffer() && qualifier.hasXfbStride()) {
|
||||||
if (! intermediate.setXfbBufferStride(globalOutputDefaults.layoutXfbBuffer, qualifier.layoutXfbStride))
|
if (! intermediate.setXfbBufferStride(globalOutputDefaults.layoutXfbBuffer, qualifier.layoutXfbStride))
|
||||||
error(loc, "all stride settings must match for xfb buffer", "xfb_stride", "%d", qualifier.layoutXfbBuffer);
|
error(loc, "all stride settings must match for xfb buffer", "xfb_stride", "%d",
|
||||||
|
qualifier.layoutXfbBuffer);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -8609,7 +8692,8 @@ void HlslParseContext::wrapupSwitchSubsequence(TIntermAggregate* statements, TIn
|
|||||||
// Turn the top-level node sequence built up of wrapupSwitchSubsequence
|
// Turn the top-level node sequence built up of wrapupSwitchSubsequence
|
||||||
// into a switch node.
|
// into a switch node.
|
||||||
//
|
//
|
||||||
TIntermNode* HlslParseContext::addSwitch(const TSourceLoc& loc, TIntermTyped* expression, TIntermAggregate* lastStatements, TSelectionControl control)
|
TIntermNode* HlslParseContext::addSwitch(const TSourceLoc& loc, TIntermTyped* expression,
|
||||||
|
TIntermAggregate* lastStatements, TSelectionControl control)
|
||||||
{
|
{
|
||||||
wrapupSwitchSubsequence(lastStatements, nullptr);
|
wrapupSwitchSubsequence(lastStatements, nullptr);
|
||||||
|
|
||||||
@@ -9268,7 +9352,8 @@ void HlslParseContext::addPatchConstantInvocation()
|
|||||||
|
|
||||||
TIntermSymbol* pcfResultVar = intermediate.addSymbol(*pcfCallResult, loc);
|
TIntermSymbol* pcfResultVar = intermediate.addSymbol(*pcfCallResult, loc);
|
||||||
TIntermNode* pcfResultAssign = handleAssign(loc, EOpAssign, pcfResultVar, pcfCall);
|
TIntermNode* pcfResultAssign = handleAssign(loc, EOpAssign, pcfResultVar, pcfCall);
|
||||||
TIntermNode* pcfResultToOut = handleAssign(loc, EOpAssign, pcfOutputSym, intermediate.addSymbol(*pcfCallResult, loc));
|
TIntermNode* pcfResultToOut = handleAssign(loc, EOpAssign, pcfOutputSym,
|
||||||
|
intermediate.addSymbol(*pcfCallResult, loc));
|
||||||
|
|
||||||
pcfCallSequence = intermediate.growAggregate(pcfCallSequence, pcfResultAssign);
|
pcfCallSequence = intermediate.growAggregate(pcfCallSequence, pcfResultAssign);
|
||||||
pcfCallSequence = intermediate.growAggregate(pcfCallSequence, pcfResultToOut);
|
pcfCallSequence = intermediate.growAggregate(pcfCallSequence, pcfResultToOut);
|
||||||
|
|||||||
Reference in New Issue
Block a user