Non-Functional: Whitespace, comments, replace accidentally deleted comment.

- fixed ParseHelper.cpp newlines (crlf -> lf)
- removed trailing white space in most source files
- fix some spelling issues
- extra blank lines
- tabs to spaces
- replace #include comment about no location
This commit is contained in:
John Kessenich
2017-01-06 00:34:48 -07:00
parent 3dd32293f4
commit ecba76fe73
60 changed files with 755 additions and 806 deletions

View File

@@ -95,7 +95,7 @@ namespace glslang {
if (attr != EatNone)
attributes[attr] = value;
return attr;
}
@@ -106,5 +106,5 @@ namespace glslang {
return (entry == attributes.end()) ? nullptr : entry->second;
}
} // end namespace glslang

View File

@@ -89,7 +89,7 @@ bool HlslGrammar::acceptIdentifier(HlslToken& idToken)
// they ARE still accepted as identifiers. This is not a dense space: e.g, "void" is not a
// valid identifier, nor is "linear". This code special cases the known instances of this, so
// e.g, "int sample;" or "float float;" is accepted. Other cases can be added here if needed.
TString* idString = nullptr;
switch (peek()) {
case EHTokSample: idString = NewPoolTString("sample"); break;
@@ -146,7 +146,7 @@ bool HlslGrammar::acceptCompilationUnit()
}
// sampler_state
// : LEFT_BRACE [sampler_state_assignment ... ] RIGHT_BRACE
// : LEFT_BRACE [sampler_state_assignment ... ] RIGHT_BRACE
//
// sampler_state_assignment
// : sampler_state_identifier EQUAL value SEMICOLON
@@ -171,7 +171,7 @@ bool HlslGrammar::acceptSamplerState()
return true;
parseContext.warn(token.loc, "unimplemented", "immediate sampler state", "");
do {
// read state name
HlslToken state;
@@ -250,7 +250,7 @@ bool HlslGrammar::acceptSamplerDeclarationDX9(TType& /*type*/)
{
if (! acceptTokenClass(EHTokSampler))
return false;
// TODO: remove this when DX9 style declarations are implemented.
unimplemented("Direct3D 9 sampler declaration");
@@ -269,7 +269,6 @@ bool HlslGrammar::acceptSamplerDeclarationDX9(TType& /*type*/)
return false;
}
// declaration
// : sampler_declaration_dx9 post_decls SEMICOLON
// | fully_specified_type declarator_list SEMICOLON
@@ -312,7 +311,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node)
// be possible to simultaneously compile D3D10+ style shaders and DX9 shaders. If we want to compile DX9
// HLSL shaders, this will have to be a master level switch
// As such, the sampler keyword in D3D10+ turns into an automatic sampler type, and is commonly used
// For that reason, this line is commented out
// For that reason, this line is commented out
// if (acceptSamplerDeclarationDX9(declaredType))
// return true;
@@ -352,7 +351,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node)
if (declaredType.getQualifier().storage == EvqTemporary && parseContext.symbolTable.atGlobalLevel())
declaredType.getQualifier().storage = EvqUniform;
// We can handle multiple variables per type declaration, so
// We can handle multiple variables per type declaration, so
// the number of types can expand when arrayness is different.
TType variableType;
variableType.shallowCopy(declaredType);
@@ -444,7 +443,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node)
expected(";");
return false;
}
return true;
}
@@ -620,13 +619,13 @@ bool HlslGrammar::acceptQualifier(TQualifier& qualifier)
qualifier.storage = EvqIn;
if (!parseContext.handleInputGeometry(token.loc, ElgLinesAdjacency))
return false;
break;
break;
case EHTokTriangleAdj:
qualifier.storage = EvqIn;
if (!parseContext.handleInputGeometry(token.loc, ElgTrianglesAdjacency))
return false;
break;
break;
default:
return true;
}
@@ -813,7 +812,7 @@ bool HlslGrammar::acceptMatrixTemplateType(TType& type)
expected(",");
return false;
}
// integer cols
if (! peekTokenClass(EHTokIntConstant)) {
expected("literal integer");
@@ -870,7 +869,7 @@ bool HlslGrammar::acceptStreamOutTemplateType(TType& type, TLayoutGeometry& geom
if (! acceptTokenClass(EHTokLeftAngle))
return false;
if (! acceptType(type)) {
expected("stream output type");
return false;
@@ -885,7 +884,7 @@ bool HlslGrammar::acceptStreamOutTemplateType(TType& type, TLayoutGeometry& geom
return true;
}
// annotations
// : LEFT_ANGLE declaration SEMI_COLON ... declaration SEMICOLON RIGHT_ANGLE
//
@@ -993,7 +992,7 @@ bool HlslGrammar::acceptTextureType(TType& type)
case EHTokTexture1darray: dim = Esd1D; array = true; break;
case EHTokTexture2d: dim = Esd2D; break;
case EHTokTexture2darray: dim = Esd2D; array = true; break;
case EHTokTexture3d: dim = Esd3D; break;
case EHTokTexture3d: dim = Esd3D; break;
case EHTokTextureCube: dim = EsdCube; break;
case EHTokTextureCubearray: dim = EsdCube; array = true; break;
case EHTokTexture2DMS: dim = Esd2D; ms = true; break;
@@ -1011,7 +1010,7 @@ bool HlslGrammar::acceptTextureType(TType& type)
advanceToken(); // consume the texture object keyword
TType txType(EbtFloat, EvqUniform, 4); // default type is float4
TIntermTyped* msCount = nullptr;
// texture type: required for multisample types and RWBuffer/RWTextures!
@@ -1092,14 +1091,13 @@ bool HlslGrammar::acceptTextureType(TType& type)
// Remember the declared vector size.
sampler.vectorSize = txType.getVectorSize();
type.shallowCopy(TType(sampler, EvqUniform, arraySizes));
type.getQualifier().layoutFormat = format;
return true;
}
// If token is for a type, update 'type' with the type information,
// and return true and advance.
// Otherwise, return false, and don't advance
@@ -1133,7 +1131,7 @@ bool HlslGrammar::acceptType(TType& type)
if (! parseContext.handleOutputGeometry(token.loc, geometry))
return false;
return true;
}
@@ -1261,7 +1259,6 @@ bool HlslGrammar::acceptType(TType& type)
new(&type) TType(EbtUint, EvqTemporary, 4);
break;
case EHTokBool:
new(&type) TType(EbtBool);
break;
@@ -1295,7 +1292,7 @@ bool HlslGrammar::acceptType(TType& type)
case EHTokHalf4:
new(&type) TType(half_bt, EvqTemporary, EpqMedium, 4);
break;
case EHTokMin16float:
new(&type) TType(min16float_bt, EvqTemporary, EpqMedium);
break;
@@ -1312,7 +1309,7 @@ bool HlslGrammar::acceptType(TType& type)
case EHTokMin16float4:
new(&type) TType(min16float_bt, EvqTemporary, EpqMedium, 4);
break;
case EHTokMin10float:
new(&type) TType(min10float_bt, EvqTemporary, EpqMedium);
break;
@@ -1329,7 +1326,7 @@ bool HlslGrammar::acceptType(TType& type)
case EHTokMin10float4:
new(&type) TType(min10float_bt, EvqTemporary, EpqMedium, 4);
break;
case EHTokMin16int:
new(&type) TType(min16int_bt, EvqTemporary, EpqMedium);
break;
@@ -1346,7 +1343,7 @@ bool HlslGrammar::acceptType(TType& type)
case EHTokMin16int4:
new(&type) TType(min16int_bt, EvqTemporary, EpqMedium, 4);
break;
case EHTokMin12int:
new(&type) TType(min12int_bt, EvqTemporary, EpqMedium);
break;
@@ -1363,7 +1360,7 @@ bool HlslGrammar::acceptType(TType& type)
case EHTokMin12int4:
new(&type) TType(min12int_bt, EvqTemporary, EpqMedium, 4);
break;
case EHTokMin16uint:
new(&type) TType(min16uint_bt, EvqTemporary, EpqMedium);
break;
@@ -1814,7 +1811,6 @@ bool HlslGrammar::acceptFunctionParameters(TFunction& function)
return true;
}
// default_parameter_declaration
// : EQUAL conditional_expression
// : EQUAL initializer
@@ -1837,9 +1833,9 @@ bool HlslGrammar::acceptDefaultParameterDeclaration(const TType& type, TIntermTy
return false;
TIntermTyped* arguments = nullptr;
for (int i=0; i<int(node->getAsAggregate()->getSequence().size()); i++)
for (int i = 0; i < int(node->getAsAggregate()->getSequence().size()); i++)
parseContext.handleFunctionArgument(constructor, arguments, node->getAsAggregate()->getSequence()[i]->getAsTyped());
node = parseContext.handleFunctionCall(token.loc, constructor, node);
}
@@ -2243,7 +2239,7 @@ bool HlslGrammar::acceptUnaryExpression(TIntermTyped*& node)
// peek for "op unary_expression"
TOperator unaryOp = HlslOpMap::preUnary(peek());
// postfix_expression (if no unary operator)
if (unaryOp == EOpNull)
return acceptPostfixExpression(node);
@@ -2299,7 +2295,7 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node)
return false;
}
} else if (acceptLiteral(node)) {
// literal (nothing else to do yet), go on to the
// literal (nothing else to do yet), go on to the
} else if (acceptConstructor(node)) {
// constructor (nothing else to do yet)
} else if (acceptIdentifier(idToken)) {
@@ -2703,7 +2699,7 @@ void HlslGrammar::acceptAttributes(TAttributeMap& attributes)
TIntermTyped* node;
bool expectingExpression = false;
while (acceptAssignmentExpression(node)) {
expectingExpression = false;
expressions->getSequence().push_back(node);
@@ -2990,7 +2986,7 @@ bool HlslGrammar::acceptJumpStatement(TIntermNode*& statement)
// SEMICOLON
if (! acceptTokenClass(EHTokSemicolon))
expected(";");
return true;
}
@@ -3086,7 +3082,7 @@ void HlslGrammar::acceptArraySpecifier(TArraySizes*& arraySizes)
void HlslGrammar::acceptPostDecls(TQualifier& qualifier)
{
do {
// COLON
// COLON
if (acceptTokenClass(EHTokColon)) {
HlslToken idToken;
if (peekTokenClass(EHTokLayout))

View File

@@ -44,7 +44,7 @@
namespace glslang {
class TAttributeMap; // forward declare
// Should just be the grammar aspect of HLSL.
// Described in more detail in hlslGrammar.cpp.

View File

@@ -99,7 +99,7 @@ TOperator HlslOpMap::preUnary(EHlslTokenClass op)
case EHTokDash: return EOpNegative;
case EHTokBang: return EOpLogicalNot;
case EHTokTilde: return EOpBitwiseNot;
case EHTokIncOp: return EOpPreIncrement;
case EHTokDecOp: return EOpPreDecrement;
@@ -114,7 +114,7 @@ TOperator HlslOpMap::postUnary(EHlslTokenClass op)
switch (op) {
case EHTokDot: return EOpIndexDirectStruct;
case EHTokLeftBracket: return EOpIndexIndirect;
case EHTokIncOp: return EOpPostIncrement;
case EHTokDecOp: return EOpPostDecrement;

View File

@@ -78,7 +78,7 @@ HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& int
globalInputDefaults.clear();
globalOutputDefaults.clear();
// "Shaders in the transform
// "Shaders in the transform
// feedback capturing mode have an initial global default of
// layout(xfb_buffer = 0) out;"
if (language == EShLangVertex ||
@@ -199,7 +199,7 @@ bool HlslParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, T
TIntermAggregate* lhsAsAggregate = node->getAsAggregate();
TIntermTyped* object = lhsAsAggregate->getSequence()[0]->getAsTyped();
if (!object->getType().getSampler().isImage()) {
error(loc, "operator[] on a non-RW texture must be an r-value", "", "");
return true;
@@ -217,7 +217,7 @@ bool HlslParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, T
// series of other image operations.
//
// Most things are passed through unmodified, except for error checking.
//
//
TIntermTyped* HlslParseContext::handleLvalue(const TSourceLoc& loc, const char* op, TIntermTyped* node)
{
if (node == nullptr)
@@ -344,7 +344,7 @@ TIntermTyped* HlslParseContext::handleLvalue(const TSourceLoc& loc, const char*
lhsAsAggregate = lhsAsBinary->getLeft()->getAsAggregate();
lhsIsSwizzle = true;
}
TIntermTyped* object = lhsAsAggregate->getSequence()[0]->getAsTyped();
TIntermTyped* coord = lhsAsAggregate->getSequence()[1]->getAsTyped();
@@ -402,7 +402,7 @@ TIntermTyped* HlslParseContext::handleLvalue(const TSourceLoc& loc, const char*
TIntermSymbol* rhsTmp = rhs->getAsSymbolNode();
TIntermTyped* coordTmp = coord;
if (rhsTmp == nullptr || isModifyOp || lhsIsSwizzle) {
rhsTmp = addTmpVar("storeTemp", objDerefType);
@@ -422,7 +422,7 @@ TIntermTyped* HlslParseContext::handleLvalue(const TSourceLoc& loc, const char*
// rhsTmp op= rhs.
makeBinary(assignOp, addSwizzle(intermediate.addSymbol(*rhsTmp), lhsAsBinary), rhs);
}
makeStore(object, coordTmp, rhsTmp); // add a store
return finishSequence(rhsTmp, objDerefType); // return rhsTmp from sequence
}
@@ -446,10 +446,10 @@ TIntermTyped* HlslParseContext::handleLvalue(const TSourceLoc& loc, const char*
// rhsTmp op
// OpImageStore(object, coordTmp, rhsTmp)
// rhsTmp
TIntermSymbol* rhsTmp = addTmpVar("storeTemp", objDerefType);
TIntermTyped* coordTmp = addTmpVar("coordTemp", coord->getType());
makeBinary(EOpAssign, coordTmp, coord); // coordtmp = load[param1]
makeLoad(rhsTmp, object, coordTmp, objDerefType); // rhsTmp = OpImageLoad(object, coordTmp)
makeUnary(assignOp, rhsTmp); // op rhsTmp
@@ -479,7 +479,7 @@ TIntermTyped* HlslParseContext::handleLvalue(const TSourceLoc& loc, const char*
makeStore(object, coordTmp, rhsTmp2); // OpImageStore(object, coordTmp, rhsTmp2)
return finishSequence(rhsTmp1, objDerefType); // return rhsTmp from sequence
}
default:
break;
}
@@ -488,7 +488,7 @@ TIntermTyped* HlslParseContext::handleLvalue(const TSourceLoc& loc, const char*
if (lhs)
if (lValueErrorCheck(loc, op, lhs))
return nullptr;
return node;
}
@@ -796,7 +796,7 @@ TIntermTyped* HlslParseContext::handleDotDereference(const TSourceLoc& loc, TInt
//
// methods can't be resolved until we later see the function-calling syntax.
// Save away the name in the AST for now. Processing is completed in
// Save away the name in the AST for now. Processing is completed in
// handleLengthMethod(), etc.
//
if (field == "length") {
@@ -987,7 +987,7 @@ TType& HlslParseContext::split(TType& type, TString name, const TType* outerStru
// We can ignore arrayness: it's uninvolved.
if (type.isStruct()) {
TTypeList* userStructure = type.getWritableStruct();
// Get iterator to (now at end) set of builtin iterstage IO members
const auto firstIo = std::stable_partition(userStructure->begin(), userStructure->end(),
[](const TTypeLoc& t) {return !t.type->isBuiltInInterstageIO();});
@@ -1023,7 +1023,7 @@ TType& HlslParseContext::split(TType& type, TString name, const TType* outerStru
// Determine whether we should flatten an arbitrary type.
bool HlslParseContext::shouldFlatten(const TType& type) const
{
return shouldFlattenIO(type) || shouldFlattenUniform(type);
return shouldFlattenIO(type) || shouldFlattenUniform(type);
}
// Is this an IO variable that can't be passed down the stack?
@@ -1058,13 +1058,13 @@ void HlslParseContext::flatten(const TSourceLoc& loc, const TVariable& variable)
const TType& type = variable.getType();
// emplace gives back a pair whose .first is an iterator to the item...
auto entry = flattenMap.emplace(variable.getUniqueId(),
auto entry = flattenMap.emplace(variable.getUniqueId(),
TFlattenData(type.getQualifier().layoutBinding));
// ... and the item is a map pair, so first->second is the TFlattenData itself.
flatten(loc, variable, type, entry.first->second, "");
}
// Recursively flatten the given variable at the provided type, building the flattenData as we go.
//
// This is mutually recursive with flattenStruct and flattenArray.
@@ -1109,8 +1109,8 @@ int HlslParseContext::flatten(const TSourceLoc& loc, const TVariable& variable,
// Add a single flattened member to the flattened data being tracked for the composite
// Returns true for the final flattening level.
int HlslParseContext::addFlattenedMember(const TSourceLoc& loc,
const TVariable& variable, const TType& type, TFlattenData& flattenData,
int HlslParseContext::addFlattenedMember(const TSourceLoc& loc,
const TVariable& variable, const TType& type, TFlattenData& flattenData,
const TString& memberName, bool track)
{
if (isFinalFlattening(type)) {
@@ -1141,7 +1141,7 @@ int HlslParseContext::addFlattenedMember(const TSourceLoc& loc,
// effecting a transfer of this information to the flattened variable form.
//
// Assumes shouldFlatten() or equivalent was called first.
int HlslParseContext::flattenStruct(const TSourceLoc& loc, const TVariable& variable, const TType& type,
int HlslParseContext::flattenStruct(const TSourceLoc& loc, const TVariable& variable, const TType& type,
TFlattenData& flattenData, TString name)
{
assert(type.isStruct());
@@ -1171,7 +1171,7 @@ int HlslParseContext::flattenStruct(const TSourceLoc& loc, const TVariable& vari
// equivalent set of individual variables.
//
// Assumes shouldFlatten() or equivalent was called first.
int HlslParseContext::flattenArray(const TSourceLoc& loc, const TVariable& variable, const TType& type,
int HlslParseContext::flattenArray(const TSourceLoc& loc, const TVariable& variable, const TType& type,
TFlattenData& flattenData, TString name)
{
assert(type.isArray());
@@ -1190,7 +1190,7 @@ int HlslParseContext::flattenArray(const TSourceLoc& loc, const TVariable& varia
int pos = start;
flattenData.offsets.resize(int(pos + size), -1);
for (int element=0; element < size; ++element) {
for (int element=0; element < size; ++element) {
char elementNumBuf[20]; // sufficient for MAXINT
snprintf(elementNumBuf, sizeof(elementNumBuf)-1, "[%d]", element);
const int mpos = addFlattenedMember(loc, variable, dereferencedType, flattenData,
@@ -1216,7 +1216,6 @@ bool HlslParseContext::wasSplit(const TIntermTyped* node) const
wasSplit(node->getAsSymbolNode()->getId());
}
// Turn an access into an aggregate that was flattened to instead be
// an access to the individual variable the member was flattened to.
// Assumes shouldFlatten() or equivalent was called first.
@@ -1299,7 +1298,6 @@ void HlslParseContext::splitAccessArray(const TSourceLoc& loc, TIntermTyped* bas
builtInIoIndex = index;
}
// Turn an access into an struct that was split to instead be an
// access to either the modified structure, or a direct reference to
// one of the split member variables.
@@ -1436,7 +1434,6 @@ TFunction& HlslParseContext::handleFunctionDeclarator(const TSourceLoc& loc, TFu
return function;
}
// Add interstage IO variables to the linkage in canonical order.
void HlslParseContext::addInterstageIoToLinkage()
{
@@ -1454,10 +1451,10 @@ void HlslParseContext::addInterstageIoToLinkage()
}
//
// Handle seeing the function prototype in front of a function definition in the grammar.
// Handle seeing the function prototype in front of a function definition in the grammar.
// The body is handled after this function returns.
//
TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& loc, TFunction& function,
TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& loc, TFunction& function,
const TAttributeMap& attributes)
{
currentCaller = function.getMangledName();
@@ -1565,7 +1562,7 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
const TIntermAggregate* numThreads = attributes[EatNumThreads];
if (numThreads != nullptr) {
const TIntermSequence& sequence = numThreads->getSequence();
for (int lid = 0; lid < int(sequence.size()); ++lid)
intermediate.setLocalSize(lid, sequence[lid]->getAsConstantUnion()->getConstArray()[0].getIConst());
}
@@ -1754,7 +1751,7 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
// 1. 1 item to copy: Use the RHS directly.
// 2. >1 item, simple symbol RHS: we'll create a new TIntermSymbol node for each, but no assign to temp.
// 3. >1 item, complex RHS: assign it to a new temp variable, and create a TIntermSymbol for each member.
if (memberCount <= 1) {
// case 1: we'll use the symbol directly below. Nothing to do.
} else {
@@ -1857,7 +1854,7 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
// subtree here IFF it does not itself contain any interstage built-in IO variables, so we only have to
// recurse into it if there's something for splitting to do. That can save a lot of AST verbosity for
// a bunch of memberwise copies.
if (isFinalFlattening(typeL) || (!isFlattenLeft && !isFlattenRight &&
if (isFinalFlattening(typeL) || (!isFlattenLeft && !isFlattenRight &&
!typeL.containsBuiltInInterstageIO() && !typeR.containsBuiltInInterstageIO())) {
assignList = intermediate.growAggregate(assignList, intermediate.addAssign(op, subSplitLeft, subSplitRight, loc), loc);
} else {
@@ -1910,7 +1907,7 @@ TOperator HlslParseContext::mapAtomicOp(const TSourceLoc& loc, TOperator op, boo
case EOpInterlockedOr: return isImage ? EOpImageAtomicOr : EOpAtomicOr;
case EOpInterlockedXor: return isImage ? EOpImageAtomicXor : EOpAtomicXor;
case EOpInterlockedExchange: return isImage ? EOpImageAtomicExchange : EOpAtomicExchange;
case EOpInterlockedCompareStore: // TODO: ...
case EOpInterlockedCompareStore: // TODO: ...
default:
error(loc, "unknown atomic operation", "unknown op", "");
return EOpNull;
@@ -2009,7 +2006,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
tex->getSequence().push_back(arg0); // sampler
tex->getSequence().push_back(constructCoord); // coordinate
tex->getSequence().push_back(bias); // bias
node = clampReturn(tex, sampler);
break;
@@ -2054,7 +2051,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
break;
}
case EOpMethodSampleGrad: // ...
{
TIntermTyped* argTex = argAggregate->getSequence()[0]->getAsTyped();
@@ -2161,7 +2158,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
} else {
indexedOut = sizeQueryReturn;
}
TIntermTyped* outParam = argAggregate->getSequence()[outParamBase + compNum]->getAsTyped();
TIntermTyped* compAssign = intermediate.addAssign(EOpAssign, outParam, indexedOut, loc);
@@ -2189,7 +2186,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
samplesQuery->getSequence().push_back(argTex);
samplesQuery->setType(TType(EbtUint, EvqTemporary, 1));
samplesQuery->setLoc(loc);
TIntermTyped* compAssign = intermediate.addAssign(EOpAssign, outParam, samplesQuery, loc);
compoundStatement = intermediate.growAggregate(compoundStatement, compAssign);
}
@@ -2215,7 +2212,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
// optional offset value
if (argAggregate->getSequence().size() > 4)
argOffset = argAggregate->getSequence()[4]->getAsTyped();
const int coordDimWithCmpVal = argCoord->getType().getVectorSize() + 1; // +1 for cmp
// AST wants comparison value as one of the texture coordinates
@@ -2342,12 +2339,12 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
TIntermTyped* argLod = argAggregate->getSequence()[3]->getAsTyped();
TIntermTyped* argOffset = nullptr;
const TSampler& sampler = argTex->getType().getSampler();
const int numArgs = (int)argAggregate->getSequence().size();
if (numArgs == 5) // offset, if present
argOffset = argAggregate->getSequence()[4]->getAsTyped();
const TOperator textureOp = (argOffset == nullptr ? EOpTextureLod : EOpTextureLodOffset);
TIntermAggregate* txsample = new TIntermAggregate(textureOp);
@@ -2394,7 +2391,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
break;
}
case EOpMethodGatherRed: // fall through...
case EOpMethodGatherGreen: // ...
case EOpMethodGatherBlue: // ...
@@ -2578,7 +2575,7 @@ void HlslParseContext::decomposeGeometryMethods(const TSourceLoc& loc, TIntermTy
emit->setType(TType(EbtVoid));
sequence = intermediate.growAggregate(sequence,
handleAssign(loc, EOpAssign,
handleAssign(loc, EOpAssign,
argAggregate->getSequence()[0]->getAsTyped(),
argAggregate->getSequence()[1]->getAsTyped()),
loc);
@@ -2638,7 +2635,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
if (!decomposeHlslIntrinsics || !node || !node->getAsOperator())
return;
const TIntermAggregate* argAggregate = arguments ? arguments->getAsAggregate() : nullptr;
TIntermUnary* fnUnary = node->getAsUnaryNode();
const TOperator op = node->getAsOperator()->getOp();
@@ -2735,7 +2732,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
arg0->getType().isVector()));
// calculate # of components for comparison const
const int constComponentCount =
const int constComponentCount =
std::max(arg0->getType().getVectorSize(), 1) *
std::max(arg0->getType().getMatrixCols(), 1) *
std::max(arg0->getType().getMatrixRows(), 1);
@@ -2751,12 +2748,12 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
TIntermTyped* zero = intermediate.addConstantUnion(0, type0, loc, true);
compareNode = handleBinaryMath(loc, "clip", EOpLessThan, arg0, zero);
}
TIntermBranch* killNode = intermediate.addBranch(EOpKill, loc);
node = new TIntermSelection(compareNode, killNode, nullptr);
node->setLoc(loc);
break;
}
@@ -2825,7 +2822,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
atomic->setType(arg0->getType());
atomic->getWritableType().getQualifier().makeTemporary();
atomic->setLoc(loc);
if (isImage) {
// orig_value = imageAtomicOp(image, loc, data)
imageAtomicParams(atomic, arg0);
@@ -2876,7 +2873,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
atomic->getSequence().push_back(arg1);
atomic->getSequence().push_back(arg2);
node = intermediate.addAssign(EOpAssign, arg3, atomic, loc);
break;
}
@@ -2902,7 +2899,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
intermediate.addConversion(EOpConstructFloat,
TType(EbtFloat, EvqTemporary, 2), iU),
recip16);
TIntermAggregate* interp = new TIntermAggregate(EOpInterpolateAtOffset);
interp->getSequence().push_back(arg0);
interp->getSequence().push_back(floatOffset);
@@ -2946,7 +2943,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
TIntermTyped* n_dot_h_m = handleBinaryMath(loc, "mul", EOpMul, n_dot_h, m); // n_dot_h * m
dst->getSequence().push_back(intermediate.addSelection(compare, zero, n_dot_h_m, loc));
// One:
dst->getSequence().push_back(intermediate.addConstantUnion(1.0, EbtFloat, loc, true));
@@ -2981,10 +2978,10 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
convert->setLoc(loc);
convert->setType(TType(EbtDouble, EvqTemporary));
node = convert;
break;
}
case EOpF16tof32:
case EOpF32tof16:
{
@@ -3100,7 +3097,7 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct
// for decompositions, since we want to operate on the function node, not the aggregate holding
// output conversions.
const TIntermTyped* fnNode = result;
const TIntermTyped* fnNode = result;
decomposeIntrinsic(loc, result, arguments); // HLSL->AST intrinsic decompositions
decomposeSampleMethods(loc, result, arguments); // HLSL->AST sample method decompositions
@@ -3131,7 +3128,7 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct
}
// Finish processing object.length(). This started earlier in handleDotDereference(), where
// the ".length" part was recognized and semantically checked, and finished here where the
// the ".length" part was recognized and semantically checked, and finished here where the
// function syntax "()" is recognized.
//
// Return resulting tree node.
@@ -3211,7 +3208,7 @@ void HlslParseContext::addInputArgumentConversions(const TFunction& function, TI
// object itself.
TVariable* internalAggregate = makeInternalVariable("aggShadow", *function[i].type);
internalAggregate->getWritableType().getQualifier().makeTemporary();
TIntermSymbol* internalSymbolNode = new TIntermSymbol(internalAggregate->getUniqueId(),
TIntermSymbol* internalSymbolNode = new TIntermSymbol(internalAggregate->getUniqueId(),
internalAggregate->getName(),
internalAggregate->getType());
internalSymbolNode->setLoc(arg->getLoc());
@@ -3503,8 +3500,7 @@ void HlslParseContext::handleSemantic(TSourceLoc loc, TQualifier& qualifier, con
// Also, in DX10 if a SV value is present as the input of a stage, but isn't appropriate for that
// stage, it would just be ignored as it is likely there as part of an output struct from one stage
// to the next
bool bParseDX9 = false;
if (bParseDX9) {
if (semanticUpperCase == "PSIZE")
@@ -3592,7 +3588,7 @@ void HlslParseContext::handleSemantic(TSourceLoc loc, TQualifier& qualifier, con
else if( semanticUpperCase == "SV_COVERAGE")
qualifier.builtIn = EbvSampleMask;
//TODO, these need to get refined to be more specific
//TODO, these need to get refined to be more specific
else if( semanticUpperCase == "SV_DEPTHGREATEREQUAL")
qualifier.builtIn = EbvFragDepthGreater;
else if( semanticUpperCase == "SV_DEPTHLESSEQUAL")
@@ -3794,7 +3790,6 @@ void HlslParseContext::globalCheck(const TSourceLoc& loc, const char* token)
error(loc, "not allowed in nested scope", token, "");
}
bool HlslParseContext::builtInName(const TString& /*identifier*/)
{
return false;
@@ -4666,9 +4661,9 @@ void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TQualifier& qua
qualifier.layoutComponent = value;
return;
} else if (id.compare(0, 4, "xfb_") == 0) {
// "Any shader making any static use (after preprocessing) of any of these
// *xfb_* qualifiers will cause the shader to be in a transform feedback
// capturing mode and hence responsible for describing the transform feedback
// "Any shader making any static use (after preprocessing) of any of these
// *xfb_* qualifiers will cause the shader to be in a transform feedback
// capturing mode and hence responsible for describing the transform feedback
// setup."
intermediate.setXfbMode();
if (id == "xfb_buffer") {
@@ -4688,7 +4683,7 @@ void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TQualifier& qua
qualifier.layoutXfbOffset = value;
return;
} else if (id == "xfb_stride") {
// "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."
if (value > 4 * resources.maxTransformFeedbackInterleavedComponents)
error(loc, "1/4 stride is too large:", id.c_str(), "gl_MaxTransformFeedbackInterleavedComponents is %d", resources.maxTransformFeedbackInterleavedComponents);
@@ -4815,17 +4810,17 @@ void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TQualifier& qua
// Merge any layout qualifier information from src into dst, leaving everything else in dst alone
//
// "More than one layout qualifier may appear in a single declaration.
// Additionally, the same layout-qualifier-name can occur multiple times
// within a layout qualifier or across multiple layout qualifiers in the
// same declaration. When the same layout-qualifier-name occurs
// multiple times, in a single declaration, the last occurrence overrides
// the former occurrence(s). Further, if such a layout-qualifier-name
// will effect subsequent declarations or other observable behavior, it
// is only the last occurrence that will have any effect, behaving as if
// the earlier occurrence(s) within the declaration are not present.
// This is also true for overriding layout-qualifier-names, where one
// overrides the other (e.g., row_major vs. column_major); only the last
// occurrence has any effect."
// Additionally, the same layout-qualifier-name can occur multiple times
// within a layout qualifier or across multiple layout qualifiers in the
// same declaration. When the same layout-qualifier-name occurs
// multiple times, in a single declaration, the last occurrence overrides
// the former occurrence(s). Further, if such a layout-qualifier-name
// will effect subsequent declarations or other observable behavior, it
// is only the last occurrence that will have any effect, behaving as if
// the earlier occurrence(s) within the declaration are not present.
// This is also true for overriding layout-qualifier-names, where one
// overrides the other (e.g., row_major vs. column_major); only the last
// occurrence has any effect."
//
void HlslParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifier& src, bool inheritOnly)
{
@@ -4880,7 +4875,7 @@ void HlslParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQuali
// Look up a function name in the symbol table, and make sure it is a function.
//
// First, look for an exact match. If there is none, use the generic selector
// TParseContextBase::selectFunction() to find one, parameterized by the
// TParseContextBase::selectFunction() to find one, parameterized by the
// convertible() and better() predicates defined below.
//
// Return the function symbol if found, otherwise nullptr.
@@ -4905,7 +4900,7 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, TFunction
// create list of candidates to send
TVector<const TFunction*> candidateList;
symbolTable.findFunctionNameList(call.getMangledName(), candidateList, builtIn);
// These builtin ops can accept any type, so we bypass the argument selection
if (candidateList.size() == 1 && builtIn &&
(candidateList[0]->getBuiltInOp() == EOpMethodAppend ||
@@ -4922,7 +4917,7 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, TFunction
return true;
// no aggregate conversions
if (from.isArray() || to.isArray() ||
if (from.isArray() || to.isArray() ||
from.isStruct() || to.isStruct())
return false;
@@ -4939,7 +4934,7 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, TFunction
// We do not promote the texture or image type for these ocodes. Normally that would not
// be an issue because it's a buffer, but we haven't decomposed the opcode yet, and at this
// stage it's merely e.g, a basic integer type.
//
//
// Instead, we want to promote other arguments, but stay within the same family. In other
// words, InterlockedAdd(RWBuffer<int>, ...) will always use the int flavor, never the uint flavor,
// but it is allowed to promote its other arguments.
@@ -5030,7 +5025,7 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, TFunction
// for ambiguity reporting
bool tie = false;
// send to the generic selector
const TFunction* bestMatch = selectFunction(candidateList, call, convertible, better, tie);
@@ -5131,7 +5126,7 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, TFunction
//
// Do everything necessary to handle a typedef declaration, for a single symbol.
//
//
// 'parseType' is the type part of the declaration (to the left)
// 'arraySizes' is the arrayness tagged on the identifier (to the right)
//
@@ -5798,9 +5793,9 @@ void HlslParseContext::declareBlock(const TSourceLoc& loc, TType& type, const TS
error(memberLoc, "member cannot contradict block", "stream", "");
}
// "This includes a block's inheritance of the
// current global default buffer, a block member's inheritance of the block's
// buffer, and the requirement that any *xfb_buffer* declared on a block
// "This includes a block's inheritance of the
// current global default buffer, a block member's inheritance of the block's
// buffer, and the requirement that any *xfb_buffer* declared on a block
// member must match the buffer inherited from the block."
if (memberQualifier.hasXfbBuffer()) {
if (defaultQualification.layoutXfbBuffer != memberQualifier.layoutXfbBuffer)
@@ -5877,15 +5872,15 @@ void HlslParseContext::finalizeGlobalUniformBlockLayout(TVariable& block)
}
//
// "For a block, this process applies to the entire block, or until the first member
// is reached that has a location layout qualifier. When a block member is declared with a location
// "For a block, this process applies to the entire block, or until the first member
// is reached that has a location layout qualifier. When a block member is declared with a location
// qualifier, its location comes from that qualifier: The member's location qualifier overrides the block-level
// declaration. Subsequent members are again assigned consecutive locations, based on the newest location,
// until the next member declared with a location qualifier. The values used for locations do not have to be
// declaration. Subsequent members are again assigned consecutive locations, based on the newest location,
// until the next member declared with a location qualifier. The values used for locations do not have to be
// declared in increasing order."
void HlslParseContext::fixBlockLocations(const TSourceLoc& loc, TQualifier& qualifier, TTypeList& typeList, bool memberWithLocation, bool memberWithoutLocation)
{
// "If a block has no block-level location layout qualifier, it is required that either all or none of its members
// "If a block has no block-level location layout qualifier, it is required that either all or none of its members
// have a location layout qualifier, or a compile-time error results."
if (! qualifier.hasLocation() && memberWithLocation && memberWithoutLocation)
error(loc, "either the block needs a location, or all members need a location, or no members have a location", "location", "");
@@ -5921,9 +5916,9 @@ void HlslParseContext::fixBlockLocations(const TSourceLoc& loc, TQualifier& qual
void HlslParseContext::fixBlockXfbOffsets(TQualifier& qualifier, TTypeList& typeList)
{
// "If a block is qualified with xfb_offset, all its
// members are assigned transform feedback buffer offsets. If a block is not qualified with xfb_offset, any
// members of that block not qualified with an xfb_offset will not be assigned transform feedback buffer
// "If a block is qualified with xfb_offset, all its
// members are assigned transform feedback buffer offsets. If a block is not qualified with xfb_offset, any
// members of that block not qualified with an xfb_offset will not be assigned transform feedback buffer
// offsets."
if (! qualifier.hasXfbBuffer() || ! qualifier.hasXfbOffset())
@@ -5950,10 +5945,10 @@ void HlslParseContext::fixBlockXfbOffsets(TQualifier& qualifier, TTypeList& type
qualifier.layoutXfbOffset = TQualifier::layoutXfbOffsetEnd;
}
// Calculate and save the offset of each block member, using the recursively
// Calculate and save the offset of each block member, using the recursively
// defined block offset rules and the user-provided offset and align.
//
// Also, compute and save the total size of the block. For the block's size, arrayness
// Also, compute and save the total size of the block. For the block's size, arrayness
// is not taken into account, as each element is backed by a separate buffer.
//
void HlslParseContext::fixBlockUniformOffsets(const TQualifier& qualifier, TTypeList& typeList)
@@ -5979,25 +5974,25 @@ void HlslParseContext::fixBlockUniformOffsets(const TQualifier& qualifier, TType
subMatrixLayout != ElmNone ? subMatrixLayout == ElmRowMajor
: qualifier.layoutMatrix == ElmRowMajor);
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."
if (! IsMultipleOfPow2(memberQualifier.layoutOffset, memberAlignment))
error(memberLoc, "must be a multiple of the member's alignment", "offset", "");
// "The offset qualifier forces the qualified member to start at or after the specified
// integral-constant expression, which will be its byte offset from the beginning of the buffer.
// "The actual offset of a member is computed as
// "The offset qualifier forces the qualified member to start at or after the specified
// integral-constant expression, which will be its byte offset from the beginning of the buffer.
// "The actual offset of a member is computed as
// follows: If offset was declared, start with that offset, otherwise start with the next available offset."
offset = std::max(offset, memberQualifier.layoutOffset);
}
// "The actual alignment of a member will be the greater of the specified align alignment and the standard
// "The actual alignment of a member will be the greater of the specified align alignment and the standard
// (e.g., std140) base alignment for the member's type."
if (memberQualifier.hasAlign())
memberAlignment = std::max(memberAlignment, memberQualifier.layoutAlign);
// "If the resulting offset is not a multiple of the actual alignment,
// increase it to the first offset that is a multiple of
// increase it to the first offset that is a multiple of
// the actual alignment."
RoundToPow2(offset, memberAlignment);
typeList[member].type->getQualifier().layoutOffset = offset;
@@ -6288,5 +6283,4 @@ void HlslParseContext::finish()
TParseContextBase::finish();
}
} // end namespace glslang

View File

@@ -286,7 +286,7 @@ protected:
// * note, that appropriately gives an error if redeclaring a block that
// was already used and hence already copied-up
//
// - on seeing a layout declaration that sizes the array, fix everything in the
// - on seeing a layout declaration that sizes the array, fix everything in the
// resize-list, giving errors for mismatch
//
// - on seeing an array size declaration, give errors on mismatch between it and previous

View File

@@ -34,7 +34,7 @@
//
//
// Create strings that declare built-in definitions, add built-ins programmatically
// Create strings that declare built-in definitions, add built-ins programmatically
// that cannot be expressed in the strings, and establish mappings between
// built-in functions and operators.
//
@@ -102,14 +102,14 @@ bool IsIllegalSample(const glslang::TString& name, const char* argOrder, int dim
return true;
}
const bool isGather =
(name == "Gather" ||
const bool isGather =
(name == "Gather" ||
name == "GatherRed" ||
name == "GatherGreen" ||
name == "GatherGreen" ||
name == "GatherBlue" ||
name == "GatherAlpha");
const bool isGatherCmp =
const bool isGatherCmp =
(name == "GatherCmpRed" ||
name == "GatherCmpGreen" ||
name == "GatherCmpBlue" ||
@@ -174,7 +174,7 @@ const char* IoParam(glslang::TString& s, const char* nthArgOrder)
} else if (*nthArgOrder == '<') { // input params
++nthArgOrder;
s.append("in ");
}
}
return nthArgOrder;
}
@@ -195,9 +195,8 @@ inline bool IsEndOfArg(const char* arg)
return arg == nullptr || *arg == '\0' || *arg == ',';
}
// If this is a fixed vector size, such as V3, return the size. Else return 0.
int FixedVecSize(const char* arg)
int FixedVecSize(const char* arg)
{
while (!IsEndOfArg(arg)) {
if (isdigit(*arg))
@@ -208,7 +207,6 @@ int FixedVecSize(const char* arg)
return 0; // none found.
}
// Create and return a type name. This is done in GLSL, not HLSL conventions, until such
// time as builtins are parsed using the HLSL parser.
//
@@ -229,7 +227,7 @@ glslang::TString& AppendTypeName(glslang::TString& s, const char* argOrder, cons
char type = *argType;
if (isTranspose) { // Take transpose of matrix dimensions
std::swap(dim0, dim1);
std::swap(dim0, dim1);
} else if (isTexture) {
if (type == 'F') // map base type to texture of that type.
type = 'T'; // e.g, int -> itexture, uint -> utexture, etc.
@@ -255,10 +253,10 @@ glslang::TString& AppendTypeName(glslang::TString& s, const char* argOrder, cons
case 'S': s += "sampler"; break;
case 's': s += "SamplerComparisonState"; break;
case 'T': s += ((isBuffer && isImage) ? "RWBuffer" :
isBuffer ? "Buffer" :
isBuffer ? "Buffer" :
isImage ? "RWTexture" : "Texture"); break;
case 'i': s += ((isBuffer && isImage) ? "RWBuffer" :
isBuffer ? "Buffer" :
isBuffer ? "Buffer" :
isImage ? "RWTexture" : "Texture"); break;
case 'u': s += ((isBuffer && isImage) ? "RWBuffer" :
isBuffer ? "Buffer" :
@@ -322,7 +320,7 @@ glslang::TString& AppendTypeName(glslang::TString& s, const char* argOrder, cons
case 'V':
s += ('0' + char(dim0));
break;
case 'M':
case 'M':
s += ('0' + char(dim0));
s += 'x';
s += ('0' + char(dim1));
@@ -389,7 +387,6 @@ inline bool IsValid(const char* cname, char retOrder, char retType, char argOrde
return true;
}
// return position of end of argument specifier
inline const char* FindEndOfArg(const char* arg)
{
@@ -424,7 +421,7 @@ inline void FindVectorMatrixBounds(const char* argOrder, int fixedVecSize, int&
if (fixedVecSize > 0) // handle fixed sized vectors
dim0Min = dim0Max = fixedVecSize;
}
} // end anonymous namespace
namespace glslang {
@@ -433,7 +430,6 @@ TBuiltInParseablesHlsl::TBuiltInParseablesHlsl()
{
}
//
// Handle creation of mat*mat specially, since it doesn't fall conveniently out of
// the generic prototype creation code below.
@@ -476,7 +472,6 @@ void TBuiltInParseablesHlsl::createMatTimesMat()
s.append(");\n"); // close paren
// Create V*M
AppendTypeName(s, "V", "F", xCols, 1); // add return type
s.append(" "); // space between type and name
@@ -508,7 +503,7 @@ void TBuiltInParseablesHlsl::initialize(int /*version*/, EProfile /*profile*/, c
// needed for furture validation. For now, they are commented out, and set below
// to EShLangAll, to allow any intrinsic to be used in any shader, which is legal
// if it is not called.
//
//
// static const EShLanguageMask EShLangPSCS = EShLanguageMask(EShLangFragmentMask | EShLangComputeMask);
// static const EShLanguageMask EShLangVSPSGS = EShLanguageMask(EShLangVertexMask | EShLangFragmentMask | EShLangGeometryMask);
// static const EShLanguageMask EShLangCS = EShLangComputeMask;
@@ -745,7 +740,7 @@ void TBuiltInParseablesHlsl::initialize(int /*version*/, EProfile /*profile*/, c
{ "GetSamplePosition", "V2", "F", "$&2,S", "FUI,I", EShLangVSPSGS },
//
//
// UINT Width
// UINT MipLevel, UINT Width, UINT NumberOfLevels
{ "GetDimensions", /* 1D */ "-", "-", "%!~1,>S", "FUI,U", EShLangAll },
@@ -947,7 +942,7 @@ void TBuiltInParseablesHlsl::initialize(int /*version*/, EProfile /*profile*/, c
AppendTypeName(s, nthArgOrder, nthArgType, argDim0, dim1); // Add arguments
}
s.append(");\n"); // close paren and trailing semicolon
} // dim 1 loop
} // dim 0 loop
@@ -956,10 +951,10 @@ void TBuiltInParseablesHlsl::initialize(int /*version*/, EProfile /*profile*/, c
// skip over special characters
if (isTexture && isalpha(argOrder[1]))
++argOrder;
if (isdigit(argOrder[1]))
if (isdigit(argOrder[1]))
++argOrder;
} // arg order loop
if (intrinsic.stage == EShLangAll) // common builtins are only added once.
break;
}
@@ -988,7 +983,6 @@ void TBuiltInParseablesHlsl::initialize(const TBuiltInResource& /*resources*/, i
{
}
//
// Finish adding/processing context-independent built-in symbols.
// 1) Programmatically add symbols that could not be added by simple text strings above.
@@ -1167,7 +1161,7 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int /*version*/, EProfile /*profil
//
// Add context-dependent (resource-specific) built-ins not handled by the above. These
// would be ones that need to be programmatically added because they cannot
// would be ones that need to be programmatically added because they cannot
// be added by simple text strings. For these, also
// 1) Map built-in functions to operators, for those that will turn into an operation node
// instead of remaining a function call.
@@ -1179,5 +1173,4 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int /*version*/, EProfile /*profil
{
}
} // end namespace glslang

View File

@@ -52,7 +52,7 @@ public:
void initialize(const TBuiltInResource& resources, int version, EProfile, const SpvVersion& spvVersion, EShLanguage);
void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable);
void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources);
private:

View File

@@ -52,7 +52,7 @@
// preprocessor includes
#include "../glslang/MachineIndependent/preprocessor/PpContext.h"
#include "../glslang/MachineIndependent/preprocessor/PpTokens.h"
namespace {
struct str_eq
@@ -142,7 +142,7 @@ void HlslScanContext::fillInKeywordMap()
(*KeywordMap)["half"] = EHTokHalf;
(*KeywordMap)["float"] = EHTokFloat;
(*KeywordMap)["double"] = EHTokDouble;
(*KeywordMap)["min16float"] = EHTokMin16float;
(*KeywordMap)["min16float"] = EHTokMin16float;
(*KeywordMap)["min10float"] = EHTokMin10float;
(*KeywordMap)["min16int"] = EHTokMin16int;
(*KeywordMap)["min12int"] = EHTokMin12int;
@@ -316,7 +316,6 @@ void HlslScanContext::fillInKeywordMap()
(*KeywordMap)["RWTexture3D"] = EHTokRWTexture3d;
(*KeywordMap)["RWBuffer"] = EHTokRWBuffer;
(*KeywordMap)["struct"] = EHTokStruct;
(*KeywordMap)["cbuffer"] = EHTokCBuffer;
(*KeywordMap)["tbuffer"] = EHTokTBuffer;
@@ -340,7 +339,7 @@ void HlslScanContext::fillInKeywordMap()
// TODO: get correct set here
ReservedSet = new std::unordered_set<const char*, str_hash, str_eq>;
ReservedSet->insert("auto");
ReservedSet->insert("catch");
ReservedSet->insert("char");

View File

@@ -251,7 +251,6 @@ enum EHlslTokenClass {
EHTokRWTexture2darray,
EHTokRWTexture3d,
EHTokRWBuffer,
// variable, user type, ...
EHTokIdentifier,