Encapsulate warnings like errors. Add warning for missing #version.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22041 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-06-17 21:47:23 +00:00
parent a622cf2dc5
commit c59d0cd9e6
6 changed files with 55 additions and 45 deletions

View file

@ -506,9 +506,12 @@ int ShCompile(
int version;
EProfile profile;
bool versionStatementMissing = false;
ScanVersion(shaderStrings, numStrings, version, profile);
if (version == 0)
if (version == 0) {
version = defaultVersion;
versionStatementMissing = true;
}
bool goodProfile = DeduceProfile(compiler->infoSink, version, profile);
TIntermediate intermediate(compiler->infoSink, version, profile);
@ -528,6 +531,8 @@ int ShCompile(
parseContext.error(1, "incorrect", "#version", "");
parseContext.initializeExtensionBehavior();
if (versionStatementMissing)
parseContext.warn(1, "statement missing: use #version on first line of shader", "#version", "");
GlobalParseContext = &parseContext;