glslang front-end: Added a callback mechanism for #line/#pragma/#version/#extension. From Andrew Woloszyn <awoloszyn@google.com>.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31507 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
47632b7aaf
commit
9288f46b95
4 changed files with 65 additions and 24 deletions
|
|
@ -743,17 +743,19 @@ int TPpContext::CPPversion(TPpToken* ppToken)
|
|||
parseContext.error(ppToken->loc, "must be followed by version number", "#version", "");
|
||||
|
||||
ppToken->ival = atoi(ppToken->name);
|
||||
|
||||
int versionNumber = ppToken->ival;
|
||||
int line = ppToken->loc.line;
|
||||
token = scanToken(ppToken);
|
||||
|
||||
if (token == '\n')
|
||||
if (token == '\n') {
|
||||
parseContext.notifyVersion(line, versionNumber, nullptr);
|
||||
return token;
|
||||
else {
|
||||
} else {
|
||||
if (ppToken->atom != coreAtom &&
|
||||
ppToken->atom != compatibilityAtom &&
|
||||
ppToken->atom != esAtom)
|
||||
parseContext.error(ppToken->loc, "bad profile name; use es, core, or compatibility", "#version", "");
|
||||
|
||||
parseContext.notifyVersion(line, versionNumber, GetAtomString(ppToken->atom));
|
||||
token = scanToken(ppToken);
|
||||
|
||||
if (token == '\n')
|
||||
|
|
@ -768,6 +770,7 @@ int TPpContext::CPPversion(TPpToken* ppToken)
|
|||
// Handle #extension
|
||||
int TPpContext::CPPextension(TPpToken* ppToken)
|
||||
{
|
||||
int line = ppToken->loc.line;
|
||||
int token = scanToken(ppToken);
|
||||
char extensionName[80];
|
||||
|
||||
|
|
@ -793,7 +796,7 @@ int TPpContext::CPPextension(TPpToken* ppToken)
|
|||
return token;
|
||||
}
|
||||
|
||||
parseContext.updateExtensionBehavior(extensionName, GetAtomString(ppToken->atom));
|
||||
parseContext.updateExtensionBehavior(line, extensionName, GetAtomString(ppToken->atom));
|
||||
|
||||
token = scanToken(ppToken);
|
||||
if (token == '\n')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue