HLSL: Fix #834: Report #version is an illegal command.

This commit is contained in:
John Kessenich 2017-04-12 17:24:34 -06:00
parent a0c578a6df
commit a4c64c988c

View File

@ -776,8 +776,12 @@ int TPpContext::CPPversion(TPpToken* ppToken)
{
int token = scanToken(ppToken);
if (errorOnVersion || versionSeen)
parseContext.ppError(ppToken->loc, "must occur first in shader", "#version", "");
if (errorOnVersion || versionSeen) {
if (parseContext.isReadingHLSL())
parseContext.ppError(ppToken->loc, "invalid preprocessor command", "#version", "");
else
parseContext.ppError(ppToken->loc, "must occur first in shader", "#version", "");
}
versionSeen = true;
if (token == '\n') {