Properly declare versions for precision qualifiers, in/out/attribute/varying.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20083 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-01-10 18:20:47 +00:00
parent f59bfa07e0
commit 564842b23b
6 changed files with 50 additions and 4 deletions

14
Test/120.frag Normal file
View File

@ -0,0 +1,14 @@
#version 120
lowp vec3 a;
mediump float b;
highp int c;
precision highp float;
in vec4 i;
out vec4 o;
void main()
{
}

14
Test/130.frag Normal file
View File

@ -0,0 +1,14 @@
#version 130
lowp vec3 a;
mediump float b;
highp int c;
precision highp float;
in vec4 i;
out vec4 o;
void main()
{
}

View File

@ -1,3 +1,10 @@
#version 140
varying vec4 v;
in vec4 i;
out vec4 o;
void main()
{
}

View File

@ -6,4 +6,6 @@ versionsClean.frag
versionsClean.vert
versionsErrors.frag
versionsErrors.vert
pre150.frag
120.frag
130.frag
140.frag

View File

@ -88,7 +88,7 @@ void TParseContext::requireStage(int line, EShLanguageMask languageMask, const c
//
// Within a profile, if a feature requires a version level or extension, use
// ProfileRequires(). This only checks if the current profile matches
// ProfileRequires(). This only checks if the current profile matches
// the passed-in profile.
//
@ -137,7 +137,8 @@ void TParseContext::checkDeprecated(int line, EProfile callingProfile, int depVe
error(line, "deprecated, may be removed in future release", featureDesc, "");
recover();
} else {
infoSink.info.message(EPrefixWarning, (TString(featureDesc) + " being used, but may be removed in future release").c_str(), line);
infoSink.info.message(EPrefixWarning, (TString(featureDesc) + " deprecated in version " +
String(depVersion) + "; may be removed in future release").c_str(), line);
}
}
}

View File

@ -1121,6 +1121,7 @@ declaration
$$ = $1.intermAggregate;
}
| PRECISION precision_qualifier type_specifier SEMICOLON {
parseContext.profileRequires($1.line, ENoProfile, 130, 0, "precision statement");
$$ = 0;
}
| type_qualifier IDENTIFIER LEFT_BRACE struct_declaration_list RIGHT_BRACE SEMICOLON {
@ -1641,15 +1642,19 @@ storage_qualifier
$$.setBasic(EbtVoid, EvqConst, $1.line);
}
| ATTRIBUTE {
//parseContext.requireProfile($1.line, (EProfileMask)(ENoProfileMask | ECompatibilityProfileMask), "attribute");
parseContext.requireStage($1.line, EShLangVertexMask, "attribute");
parseContext.checkDeprecated($1.line, ENoProfile, 140, "attribute");
parseContext.requireNotRemoved($1.line, ECoreProfile, 420, "attribute");
if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "attribute"))
parseContext.recover();
$$.setBasic(EbtVoid, EvqAttribute, $1.line);
}
| VARYING {
parseContext.checkDeprecated($1.line, ENoProfile, 140, "varying");
parseContext.requireNotRemoved($1.line, ECoreProfile, 420, "varying");
if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "varying"))
parseContext.recover();
if (parseContext.language == EShLangVertex)
@ -2396,10 +2401,13 @@ type_specifier_nonarray
precision_qualifier
: HIGH_PRECISION {
parseContext.profileRequires($1.line, ENoProfile, 130, 0, "highp precision qualifier");
}
| MEDIUM_PRECISION {
parseContext.profileRequires($1.line, ENoProfile, 130, 0, "mediump precision qualifier");
}
| LOW_PRECISION {
parseContext.profileRequires($1.line, ENoProfile, 130, 0, "lowp precision qualifier");
}
;