Merge branch 'TiemoJung-semantic_handling'
This commit is contained in:
@@ -3528,7 +3528,9 @@ bool HlslGrammar::acceptPostDecls(TQualifier& qualifier)
|
||||
parseContext.handleRegister(registerDesc.loc, qualifier, profile.string, *registerDesc.string, subComponent, spaceDesc.string);
|
||||
} else {
|
||||
// semantic, in idToken.string
|
||||
parseContext.handleSemantic(idToken.loc, qualifier, mapSemantic(*idToken.string));
|
||||
TString semanticUpperCase = *idToken.string;
|
||||
std::transform(semanticUpperCase.begin(), semanticUpperCase.end(), semanticUpperCase.begin(), ::toupper);
|
||||
parseContext.handleSemantic(idToken.loc, qualifier, mapSemantic(semanticUpperCase.c_str()), semanticUpperCase);
|
||||
}
|
||||
} else if (peekTokenClass(EHTokLeftAngle)) {
|
||||
found = true;
|
||||
|
||||
@@ -4144,7 +4144,7 @@ TFunction* HlslParseContext::handleConstructorCall(const TSourceLoc& loc, const
|
||||
// Handle seeing a "COLON semantic" at the end of a type declaration,
|
||||
// by updating the type according to the semantic.
|
||||
//
|
||||
void HlslParseContext::handleSemantic(TSourceLoc loc, TQualifier& qualifier, TBuiltInVariable builtIn)
|
||||
void HlslParseContext::handleSemantic(TSourceLoc loc, TQualifier& qualifier, TBuiltInVariable builtIn, const TString& upperCase)
|
||||
{
|
||||
// adjust for stage in/out
|
||||
|
||||
@@ -4161,6 +4161,7 @@ void HlslParseContext::handleSemantic(TSourceLoc loc, TQualifier& qualifier, TBu
|
||||
}
|
||||
|
||||
qualifier.builtIn = builtIn;
|
||||
qualifier.semanticName = intermediate.addSemanticName(upperCase);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermOperator&);
|
||||
void builtInOpCheck(const TSourceLoc&, const TFunction&, TIntermOperator&);
|
||||
TFunction* handleConstructorCall(const TSourceLoc&, const TType&);
|
||||
void handleSemantic(TSourceLoc, TQualifier&, TBuiltInVariable);
|
||||
void handleSemantic(TSourceLoc, TQualifier&, TBuiltInVariable, const TString& upperCase);
|
||||
void handlePackOffset(const TSourceLoc&, TQualifier&, const glslang::TString& location,
|
||||
const glslang::TString* component);
|
||||
void handleRegister(const TSourceLoc&, TQualifier&, const glslang::TString* profile, const glslang::TString& desc,
|
||||
|
||||
@@ -467,12 +467,9 @@ void HlslScanContext::tokenize(HlslToken& token)
|
||||
token.tokenClass = tokenClass;
|
||||
}
|
||||
|
||||
glslang::TBuiltInVariable HlslScanContext::mapSemantic(const TString& semantic)
|
||||
glslang::TBuiltInVariable HlslScanContext::mapSemantic(const char* upperCase)
|
||||
{
|
||||
TString semanticUpperCase = semantic;
|
||||
std::transform(semanticUpperCase.begin(), semanticUpperCase.end(), semanticUpperCase.begin(), ::toupper);
|
||||
|
||||
auto it = SemanticMap->find(semanticUpperCase.c_str());
|
||||
auto it = SemanticMap->find(upperCase);
|
||||
if (it != SemanticMap->end())
|
||||
return it->second;
|
||||
else
|
||||
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
static void deleteKeywordMap();
|
||||
|
||||
void tokenize(HlslToken&);
|
||||
glslang::TBuiltInVariable mapSemantic(const TString& semantic);
|
||||
glslang::TBuiltInVariable mapSemantic(const char*);
|
||||
|
||||
protected:
|
||||
HlslScanContext(HlslScanContext&);
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace glslang {
|
||||
bool acceptTokenClass(EHlslTokenClass);
|
||||
EHlslTokenClass peek() const;
|
||||
bool peekTokenClass(EHlslTokenClass) const;
|
||||
glslang::TBuiltInVariable mapSemantic(const TString& semantic) { return scanner.mapSemantic(semantic); }
|
||||
glslang::TBuiltInVariable mapSemantic(const char* upperCase) { return scanner.mapSemantic(upperCase); }
|
||||
|
||||
void pushTokenStream(const TVector<HlslToken>* tokens);
|
||||
void popTokenStream();
|
||||
|
||||
Reference in New Issue
Block a user