const float b = 2 * a1;
a.x = gl_MinProgramTexelOffset + gl_MaxProgramTexelOffset; // ERROR until shading_language_420pack is fully implemented
}
+
+in float gl_FogFragCoord;
+
+#extension GL_ARB_separate_shader_objects : enable
+
+in float gl_FogFragCoord;
+in int gl_FogFragCoord;
gl_FogFragCoord; // could be ERROR, but compiling under compatibility profile\r
gl_FrontColor; // could be ERROR, but compiling under compatibility profile\r
}\r
+\r
+out vec4 gl_Position; // ERROR\r
+\r
+#extension GL_ARB_separate_shader_objects : enable\r
+\r
+out vec4 gl_Position;\r
+in vec4 gl_Position; // ERROR\r
+out vec3 gl_Position; // ERROR\r
+\r
+out float gl_PointSize;\r
+out vec4 gl_ClipVertex;\r
+out float gl_FogFragCoord;\r
ERROR: 0:130: '=' : cannot convert from 'const float' to 'int'\r
ERROR: 0:132: 'gl_MinProgramTexelOffset' : undeclared identifier \r
ERROR: 0:132: 'gl_MaxProgramTexelOffset' : undeclared identifier \r
-ERROR: 18 compilation errors. No code generated.\r
+ERROR: 0:135: 'gl_FogFragCoord' : identifiers starting with "gl_" are reserved \r
+ERROR: 0:140: 'int' : must be qualified as flat in\r
+ERROR: 0:140: 'redeclaration' : cannot change the type of gl_FogFragCoord\r
+ERROR: 21 compilation errors. No code generated.\r
\r
\r
Shader version: 130\r
Requested GL_ARB_gpu_shader5\r
+Requested GL_ARB_separate_shader_objects\r
Requested GL_ARB_shading_language_420pack\r
Requested GL_ARB_texture_cube_map_array\r
Requested GL_ARB_texture_gather\r
0:? 32 (const int)\r
0:? 'instanceName' (layout(binding=0 column_major shared ) uniform block{layout(column_major shared ) uniform int a})\r
0:? 'bounds' (layout(binding=0 ) uniform sampler2D)\r
+0:? 'gl_FogFragCoord' (smooth in float)\r
\r
\r
Linked fragment stage:\r
\r
Shader version: 130\r
Requested GL_ARB_gpu_shader5\r
+Requested GL_ARB_separate_shader_objects\r
Requested GL_ARB_shading_language_420pack\r
Requested GL_ARB_texture_cube_map_array\r
Requested GL_ARB_texture_gather\r
0:? 32 (const int)\r
0:? 'instanceName' (layout(binding=0 column_major shared ) uniform block{layout(column_major shared ) uniform int a})\r
0:? 'bounds' (layout(binding=0 ) uniform sampler2D)\r
+0:? 'gl_FogFragCoord' (smooth in float)\r
\r
140.vert\r
+ERROR: 0:23: 'gl_Position' : identifiers starting with "gl_" are reserved \r
+ERROR: 0:28: 'redeclaration' : cannot change storage, memory, or auxiliary qualification of gl_Position\r
+ERROR: 0:28: 'redeclaration' : cannot change interpolation qualification of gl_Position\r
+ERROR: 0:29: 'redeclaration' : cannot change the type of gl_Position\r
+ERROR: 0:32: 'gl_ClipVertex' : cannot redeclare after use \r
+ERROR: 0:33: 'gl_FogFragCoord' : cannot redeclare after use \r
+ERROR: 6 compilation errors. No code generated.\r
+\r
\r
Shader version: 140\r
-0:? Sequence\r
+Requested GL_ARB_separate_shader_objects\r
+ERROR: node is still EOpNull!\r
0:9 Function Definition: main( (void)\r
0:9 Function Parameters: \r
0:11 Sequence\r
0:? 'sbuf' (uniform isamplerBuffer)\r
0:? 'anon@0' (layout(column_major std140 ) uniform block{layout(column_major std140 offset=0 ) uniform int anonMem})\r
0:? 'gl_TexCoord' (smooth out implicitly-sized array of 4-component vector of float)\r
+0:? 'gl_Position' (smooth out 4-component vector of float)\r
+0:? 'gl_PointSize' (gl_PointSize float)\r
+0:? 'gl_PointSize' (gl_PointSize float)\r
+0:? 'gl_ClipVertex' (gl_ClipVertex 4-component vector of float)\r
+0:? 'gl_ClipVertex' (gl_ClipVertex 4-component vector of float)\r
+0:? 'gl_FogFragCoord' (smooth out float)\r
+0:? 'gl_FogFragCoord' (smooth out float)\r
0:? 'gl_VertexID' (gl_VertexId int)\r
0:? 'gl_InstanceID' (gl_InstanceId int)\r
\r
\r
\r
Shader version: 140\r
-0:? Sequence\r
+Requested GL_ARB_separate_shader_objects\r
+ERROR: node is still EOpNull!\r
0:9 Function Definition: main( (void)\r
0:9 Function Parameters: \r
0:11 Sequence\r
0:? 'sbuf' (uniform isamplerBuffer)\r
0:? 'anon@0' (layout(column_major std140 ) uniform block{layout(column_major std140 offset=0 ) uniform int anonMem})\r
0:? 'gl_TexCoord' (smooth out 1-element array of 4-component vector of float)\r
+0:? 'gl_Position' (smooth out 4-component vector of float)\r
+0:? 'gl_PointSize' (gl_PointSize float)\r
+0:? 'gl_PointSize' (gl_PointSize float)\r
+0:? 'gl_ClipVertex' (gl_ClipVertex 4-component vector of float)\r
+0:? 'gl_ClipVertex' (gl_ClipVertex 4-component vector of float)\r
+0:? 'gl_FogFragCoord' (smooth out float)\r
+0:? 'gl_FogFragCoord' (smooth out float)\r
0:? 'gl_VertexID' (gl_VertexId int)\r
0:? 'gl_InstanceID' (gl_InstanceId int)\r
\r
GLSL 4.1
+ Support for partitioning shaders into multiple programs to provide light-weight mixing of different shader stages.
(GL_ARB_separate_shader_objects)
- - layout qualifiers
- - redeclaration of input/output blocks
- - ...
+ + layout qualifiers
+ + redeclaration of input/output blocks
+ + ...
- Add 64-bit floating-point attributes for vertex shader inputs.
+ Support viewport arrays so where the geometry shader selects which viewport array will transform its output.
GLSL 4.2
if (profile == EEsProfile || ! builtInName(identifier) || symbolTable.atBuiltInLevel() || ! symbolTable.atGlobalLevel())
return 0;
+ // Special case when using GL_ARB_separate_shader_objects
+ bool ssoPre150 = false; // means the only reason this variable is redeclared is due to this combination
+ if (version <= 140 && extensionsTurnedOn(1, &GL_ARB_separate_shader_objects)) {
+ if (identifier == "gl_Position" ||
+ identifier == "gl_PointSize" ||
+ identifier == "gl_ClipVertex" ||
+ identifier == "gl_FogFragCoord")
+ ssoPre150 = true;
+ }
+
// Potentially redeclaring a built-in variable...
- if ((identifier == "gl_FragDepth" && version >= 420) ||
+ if (ssoPre150 ||
+ (identifier == "gl_FragDepth" && version >= 420) ||
(identifier == "gl_FragCoord" && version >= 150) ||
(identifier == "gl_ClipDistance" && version >= 130) ||
(identifier == "gl_FrontColor" && version >= 130) ||
// Now, modify the type of the copy, as per the type of the current redeclaration.
TQualifier& symbolQualifier = symbol->getWritableType().getQualifier();
- if (identifier == "gl_FrontColor" ||
- identifier == "gl_BackColor" ||
- identifier == "gl_FrontSecondaryColor" ||
- identifier == "gl_BackSecondaryColor" ||
- identifier == "gl_SecondaryColor" ||
- identifier == "gl_Color") {
+ if (ssoPre150) {
+ if (intermediate.inIoAccessed(identifier))
+ error(loc, "cannot redeclare after use", identifier.c_str(), "");
+ if (qualifier.hasLayout())
+ error(loc, "cannot apply layout qualifier to", "redeclaration", symbol->getName().c_str());
+ if (qualifier.isMemory() || qualifier.isAuxiliary() || (language == EShLangVertex && qualifier.storage != EvqVaryingOut) ||
+ (language == EShLangFragment && qualifier.storage != EvqVaryingIn))
+ error(loc, "cannot change storage, memory, or auxiliary qualification of", "redeclaration", symbol->getName().c_str());
+ if (! qualifier.smooth)
+ error(loc, "cannot change interpolation qualification of", "redeclaration", symbol->getName().c_str());
+ } else if (identifier == "gl_FrontColor" ||
+ identifier == "gl_BackColor" ||
+ identifier == "gl_FrontSecondaryColor" ||
+ identifier == "gl_BackSecondaryColor" ||
+ identifier == "gl_SecondaryColor" ||
+ identifier == "gl_Color") {
symbolQualifier.flat = qualifier.flat;
symbolQualifier.smooth = qualifier.smooth;
symbolQualifier.nopersp = qualifier.nopersp;