Add GL_EXT_frag_depth.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24003 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-11-11 20:51:50 +00:00
parent 06a37c3964
commit 99296369d3
6 changed files with 50 additions and 7 deletions

View File

@ -100,4 +100,14 @@ void foo236()
dFdx(v[0]);
dFdy(3.2);
fwidth(f13);
gl_FragDepth = f13; // ERROR
gl_FragDepthEXT = f13; // ERROR
}
#extension GL_EXT_frag_depth : enable
void foo239()
{
gl_FragDepth = f13; // ERROR
gl_FragDepthEXT = f13;
}

View File

@ -45,7 +45,10 @@ ERROR: 0:80: 'sampler/image' : type requires declaration of default precision qu
ERROR: 0:91: 'dFdx' : required extension not requested: GL_OES_standard_derivatives
ERROR: 0:92: 'dFdy' : required extension not requested: GL_OES_standard_derivatives
ERROR: 0:93: 'fwidth' : required extension not requested: GL_OES_standard_derivatives
ERROR: 40 compilation errors. No code generated.
ERROR: 0:103: 'gl_FragDepth' : undeclared identifier
ERROR: 0:104: 'gl_FragDepthEXT' : required extension not requested: GL_EXT_frag_depth
ERROR: 0:111: 'gl_FragDepth' : undeclared identifier
ERROR: 43 compilation errors. No code generated.
ERROR: node is still EOpNull!
0:3 Sequence
@ -166,6 +169,21 @@ ERROR: node is still EOpNull!
0:101 0.000000
0:102 fwidth (mediump float)
0:102 'f13' (invariant mediump float)
0:103 move second child to first child (mediump float)
0:103 'gl_FragDepth' (mediump float)
0:103 'f13' (invariant mediump float)
0:104 move second child to first child (highp float)
0:104 'gl_FragDepthEXT' (gl_FragDepth highp float)
0:104 'f13' (invariant mediump float)
0:109 Function Definition: foo239( (void)
0:109 Function Parameters:
0:111 Sequence
0:111 move second child to first child (mediump float)
0:111 'gl_FragDepth' (mediump float)
0:111 'f13' (invariant mediump float)
0:112 move second child to first child (highp float)
0:112 'gl_FragDepthEXT' (gl_FragDepth highp float)
0:112 'f13' (invariant mediump float)
0:? Linker Objects
0:? 'a' (3-element array of mediump int)
0:? 'uint' (mediump int)

View File

@ -1425,6 +1425,9 @@ void TBuiltIns::initialize(int version, EProfile profile)
"mediump vec2 gl_PointCoord;" // needs qualifier fixed later
"highp float gl_FragDepth;" // needs qualifier fixed later
);
stageBuiltins[EShLangFragment].append(
"highp float gl_FragDepthEXT;" // GL_EXT_frag_depth
);
}
stageBuiltins[EShLangFragment].append("\n");
@ -2143,11 +2146,13 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
SpecialQualifier("gl_PointCoord", EvqPointCoord, symbolTable);
SpecialQualifier("gl_FragColor", EvqFragColor, symbolTable);
SpecialQualifier("gl_FragDepth", EvqFragDepth, symbolTable);
SpecialQualifier("gl_FragDepthEXT", EvqFragDepth, symbolTable);
if (version == 100) {
symbolTable.setFunctionExtensions("dFdx", 1, &GL_OES_standard_derivatives);
symbolTable.setFunctionExtensions("dFdy", 1, &GL_OES_standard_derivatives);
symbolTable.setFunctionExtensions("fwidth", 1, &GL_OES_standard_derivatives);
}
symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &GL_EXT_frag_depth);
break;
case EShLangCompute:

View File

@ -574,6 +574,13 @@ public:
table[level]->setFunctionExtensions(name, num, extensions);
}
void setVariableExtensions(const char* name, int num, const char* const extensions[])
{
TSymbol* symbol = find(TString(name));
if (symbol)
symbol->setExtensions(num, extensions);
}
int getMaxSymbolId() { return uniqueId; }
void dump(TInfoSink &infoSink) const;
void copyTable(const TSymbolTable& copyOf);

View File

@ -151,6 +151,7 @@ void TParseContext::initializeExtensionBehavior()
{
extensionBehavior[GL_OES_texture_3D] = EBhDisable;
extensionBehavior[GL_OES_standard_derivatives] = EBhDisable;
extensionBehavior[GL_EXT_frag_depth] = EBhDisable;
extensionBehavior[GL_ARB_texture_rectangle] = EBhDisable;
extensionBehavior[GL_3DL_array_objects] = EBhDisable;
@ -167,7 +168,8 @@ const char* TParseContext::getPreamble()
return
"#define GL_ES 1\n"
"#define GL_OES_texture_3D 1\n"
"#define GL_OES_standard_derivatives 1\n";
"#define GL_OES_standard_derivatives 1\n"
"#define GL_EXT_frag_depth 1\n";
} else {
return
"#define GL_FRAGMENT_PRECISION_HIGH 1\n"

View File

@ -74,6 +74,7 @@ typedef enum {
//
const char* const GL_OES_texture_3D = "GL_OES_texture_3D";
const char* const GL_OES_standard_derivatives = "GL_OES_standard_derivatives";
const char* const GL_EXT_frag_depth = "GL_EXT_frag_depth";
const char* const GL_ARB_texture_rectangle = "GL_ARB_texture_rectangle";
const char* const GL_3DL_array_objects = "GL_3DL_array_objects";