Allow gl_FragColor and gl_FragData in non-forward-compatible contexts for non-ES versions 150 - 410. Also add deprecation message for attribute/varying for core profile.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20714 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-02-27 19:02:52 +00:00
parent df807514b6
commit ef8ae2e345
5 changed files with 31 additions and 3 deletions

12
Test/330.frag Normal file
View File

@ -0,0 +1,12 @@
#version 330
in vec4 inVar;
out vec4 outVar;
varying vec4 varyingVar;
void main()
{
gl_FragColor = varyingVar;
gl_FragData[1] = inVar;
}

12
Test/330comp.frag Normal file
View File

@ -0,0 +1,12 @@
#version 330 compatibility
in vec4 inVar;
out vec4 outVar;
varying vec4 varyingVar;
void main()
{
gl_FragColor = varyingVar;
gl_FragData[1] = inVar * gl_ModelViewMatrix;
}

View File

@ -22,3 +22,5 @@ array100.frag
comment.frag
300.vert
300.frag
330.frag
330comp.frag

View File

@ -44,6 +44,7 @@
#include "Initialize.h"
const int FirstProfileVersion = 150;
const bool ForwardCompatibility = false;
TBuiltIns::TBuiltIns()
{
@ -1284,7 +1285,7 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
symbolTable.insert(*new TVariable(NewPoolTString("gl_PointCoord"), TType(EbtFloat, EvqPointCoord, pq, 2)));
}
if (version < FirstProfileVersion || profile == ECompatibilityProfile) {
if (version < FirstProfileVersion || profile == ECompatibilityProfile || (! ForwardCompatibility && profile != EEsProfile && version < 420)) {
pq = profile == EEsProfile ? EpqMedium : EpqNone;
symbolTable.insert(*new TVariable(NewPoolTString("gl_FragColor"), TType(EbtFloat, EvqFragColor, pq, 4)));
}
@ -1413,7 +1414,7 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
case EShLangFragment:
// Set up gl_FragData based on current array size.
if (version < FirstProfileVersion || profile == ECompatibilityProfile) {
if (version < FirstProfileVersion || profile == ECompatibilityProfile || (! ForwardCompatibility && profile != EEsProfile && version < 420)) {
TPrecisionQualifier pq = profile == EEsProfile ? EpqMedium : EpqNone;
TType fragData(EbtFloat, EvqFragColor, 4);
TArraySizes arraySizes = NewPoolTArraySizes();

View File

@ -1699,7 +1699,7 @@ storage_qualifier
}
| ATTRIBUTE {
parseContext.requireStage($1.line, EShLangVertexMask, "attribute");
parseContext.checkDeprecated($1.line, ECoreProfile, 150, "attribute");
parseContext.checkDeprecated($1.line, ENoProfile, 140, "attribute");
parseContext.requireNotRemoved($1.line, ECoreProfile, 420, "attribute");
parseContext.requireNotRemoved($1.line, EEsProfile, 300, "attribute");
@ -1712,6 +1712,7 @@ storage_qualifier
}
| VARYING {
parseContext.checkDeprecated($1.line, ENoProfile, 140, "varying");
parseContext.checkDeprecated($1.line, ECoreProfile, 150, "varying");
parseContext.requireNotRemoved($1.line, ECoreProfile, 420, "varying");
parseContext.requireNotRemoved($1.line, EEsProfile, 300, "varying");