Detect and give error on second occurrence of #version.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24347 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
@@ -694,8 +694,9 @@ int TPpContext::CPPversion(TPpToken* ppToken)
|
||||
{
|
||||
int token = currentInput->scan(this, currentInput, ppToken);
|
||||
|
||||
if (errorOnVersion)
|
||||
if (errorOnVersion || versionSeen)
|
||||
parseContext.error(ppToken->loc, "must occur first in shader", "#version", "");
|
||||
versionSeen = true;
|
||||
|
||||
if (token == '\n') {
|
||||
parseContext.error(ppToken->loc, "must be followed by version number", "#version", "");
|
||||
|
||||
@@ -155,6 +155,7 @@ void TPpContext::setInput(TInputScanner& input, bool versionWillBeError)
|
||||
in->prev = currentInput;
|
||||
currentInput = in;
|
||||
errorOnVersion = versionWillBeError;
|
||||
versionSeen = false;
|
||||
}
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
@@ -208,6 +208,7 @@ protected:
|
||||
|
||||
InputSrc *currentInput;
|
||||
bool errorOnVersion;
|
||||
bool versionSeen;
|
||||
|
||||
//
|
||||
// from Pp.cpp
|
||||
|
||||
Reference in New Issue
Block a user