glslang AEP: The extension scheme, extension-enabled stage-existence testing, and compute-shader interface. Still needs in/out blocks, unsized arrays, etc. before real testing can be done.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31479 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2015-06-12 05:01:25 +00:00
parent 4751ce3fc1
commit 453bb26ef5
10 changed files with 627 additions and 32 deletions

143
Test/310.geom Normal file
View File

@ -0,0 +1,143 @@
#version 310 es
#extension GL_EXT_geometry_shader : enable
precision mediump float;
in fromVertex {
in vec3 color;
} fromV[];
out toFragment {
out vec3 color;
} toF;
out fromVertex { // okay to reuse a block name for another block name
vec3 color;
};
out fooB {
vec2 color;
} fromVertex; // ERROR, cannot reuse block name as block instance
int fromVertex; // ERROR, cannot reuse a block name for something else
out fooC {
vec2 color;
} fooC; // ERROR, cannot have same name for block and instance name
void main()
{
EmitVertex();
EndPrimitive();
EmitStreamVertex(1); // ERROR
EndStreamPrimitive(0); // ERROR
color = fromV[0].color;
gl_ClipDistance[3] = gl_in[1].gl_ClipDistance[2];
gl_Position = gl_in[0].gl_Position;
gl_PointSize = gl_in[3].gl_PointSize;
gl_PrimitiveID = gl_PrimitiveIDIn;
gl_Layer = 2;
}
out vec4 ov0; // stream should be 0
layout(stream = 4) out vec4 ov4;
out vec4 o1v0; // stream should be 0
layout(stream = 3) uniform; // ERROR
layout(stream = 3) in; // ERROR
layout(stream = 3) uniform int ua; // ERROR
layout(stream = 3) uniform ubb { int ua; } ibb; // ERROR
layout(line_strip, points, triangle_strip, stream = 3, points, triangle_strip) out; // just means "stream = 3, triangle_strip"
layout(stream = 3, triangle_strip) out;
out vec4 ov3; // stream should be 3
layout(stream = 6) out ooutb { vec4 a; } ouuaa6;
layout(stream = 6) out ooutb2 {
layout(stream = 6) vec4 a;
} ouua6;
layout(stream = 7) out ooutb3 {
layout(stream = 6) vec4 a; // ERROR
} ouua7;
out vec4 ov2s3; // stream should be 3
layout(max_vertices = 200) out;
layout(max_vertices = 300) out; // ERROR, too big
void foo(layout(max_vertices = 4) int a) // ERROR
{
ouuaa6.a = vec4(1.0);
}
layout(line_strip, points, triangle_strip, stream = 3, points) out; // ERROR, changing output primitive
layout(line_strip, points, stream = 3) out; // ERROR, changing output primitive
layout(triangle_strip) in; // ERROR, not an input primitive
layout(triangle_strip) uniform; // ERROR
layout(triangle_strip) out vec4 badv4; // ERROR, not on a variable
layout(triangle_strip) in vec4 bad2v4[]; // ERROR, not on a variable or input
layout(invocations = 3) out outbn { int a; }; // 2 ERROR, not on a block, not until 4.0
out outbn2 {
layout(invocations = 3) int a; // 2 ERRORs, not on a block member, not until 4.0
layout(max_vertices = 3) int b; // ERROR, not on a block member
layout(triangle_strip) int c; // ERROR, not on a block member
} outbi;
layout(lines) out; // ERROR, not on output
layout(lines_adjacency) in;
layout(triangles) in; // ERROR, can't change it
layout(triangles_adjacency) in; // ERROR, can't change it
layout(invocations = 4) in; // ERROR, not until 4.0
in inbn {
layout(stream = 2) int a; // ERROR, stream on input
} inbi[];
in sameName {
int a15;
} insn[];
out sameName {
float f15;
};
uniform sameName {
bool b15;
};
float summ = gl_MaxVertexAttribs +
gl_MaxVertexUniformComponents +
gl_MaxVaryingFloats +
gl_MaxVaryingComponents +
gl_MaxVertexOutputComponents +
gl_MaxGeometryInputComponents +
gl_MaxGeometryOutputComponents +
gl_MaxFragmentInputComponents +
gl_MaxVertexTextureImageUnits +
gl_MaxCombinedTextureImageUnits +
gl_MaxTextureImageUnits +
gl_MaxFragmentUniformComponents +
gl_MaxDrawBuffers +
gl_MaxClipDistances +
gl_MaxGeometryTextureImageUnits +
gl_MaxGeometryOutputVertices +
gl_MaxGeometryTotalOutputComponents +
gl_MaxGeometryUniformComponents +
gl_MaxGeometryVaryingComponents;
void fooe1()
{
gl_ViewportIndex = gl_MaxViewports - 1;
}
#extension GL_ARB_viewport_array : enable
void fooe2()
{
gl_ViewportIndex = gl_MaxViewports - 1;
}
out int gl_ViewportIndex;

View File

@ -0,0 +1,299 @@
310.geom
Warning, version 310 is not yet complete; most version-specific features are present, but some are missing.
WARNING: 0:3: '#extension' : extension is only partially supported: GL_EXT_geometry_shader
ERROR: 0:7: '' : array size required
ERROR: 0:7: 'input block' : not supported with this profile: es
ERROR: 0:11: 'output block' : not supported with this profile: es
ERROR: 0:15: 'output block' : not supported with this profile: es
ERROR: 0:19: 'output block' : not supported with this profile: es
ERROR: 0:19: 'fromVertex' : block instance name redefinition
ERROR: 0:23: 'fromVertex' : redefinition
ERROR: 0:25: 'output block' : not supported with this profile: es
ERROR: 0:25: 'fooC' : block instance name redefinition
ERROR: 0:31: 'EmitVertex' : no matching overloaded function found
ERROR: 0:32: 'EndPrimitive' : no matching overloaded function found
ERROR: 0:33: 'EmitStreamVertex' : no matching overloaded function found
ERROR: 0:34: 'EndStreamPrimitive' : no matching overloaded function found
ERROR: 0:37: 'gl_ClipDistance' : undeclared identifier
ERROR: 0:37: 'gl_ClipDistance' : left of '[' is not of type array, matrix, or vector
ERROR: 0:37: 'gl_in' : undeclared identifier
ERROR: 0:37: 'gl_in' : left of '[' is not of type array, matrix, or vector
ERROR: 0:37: 'scalar swizzle' : not supported with this profile: es
ERROR: 0:37: 'gl_ClipDistance' : illegal vector field selection
ERROR: 0:37: 'expression' : left of '[' is not of type array, matrix, or vector
ERROR: 0:37: 'assign' : l-value required (can't modify a const)
ERROR: 0:38: 'gl_Position' : undeclared identifier
ERROR: 0:38: 'gl_in' : left of '[' is not of type array, matrix, or vector
ERROR: 0:38: 'scalar swizzle' : not supported with this profile: es
ERROR: 0:38: 'gl_Position' : illegal vector field selection
ERROR: 0:39: 'gl_PointSize' : undeclared identifier
ERROR: 0:39: 'gl_in' : left of '[' is not of type array, matrix, or vector
ERROR: 0:39: 'scalar swizzle' : not supported with this profile: es
ERROR: 0:39: 'gl_PointSize' : illegal vector field selection
ERROR: 0:40: 'gl_PrimitiveID' : undeclared identifier
ERROR: 0:40: 'gl_PrimitiveIDIn' : undeclared identifier
ERROR: 0:41: 'gl_Layer' : undeclared identifier
ERROR: 0:41: 'assign' : cannot convert from 'const int' to 'temp float'
ERROR: 0:48: 'stream' : can only be used on an output
ERROR: 0:49: 'stream' : can only be used on an output
ERROR: 0:50: 'stream' : can only be used on an output
ERROR: 0:51: 'stream' : can only be used on an output
ERROR: 0:51: 'stream' : can only be used on an output
ERROR: 0:57: 'output block' : not supported with this profile: es
ERROR: 0:59: 'output block' : not supported with this profile: es
ERROR: 0:63: 'output block' : not supported with this profile: es
ERROR: 0:64: 'stream' : member cannot contradict block
ERROR: 0:70: 'max_vertices' : too large, must be less than gl_MaxGeometryOutputVertices
ERROR: 0:70: 'max_vertices' : cannot change previously set layout value
ERROR: 0:71: 'max_vertices' : can only apply to a standalone qualifier
ERROR: 0:76: 'points' : cannot change previously set output primitive
ERROR: 0:77: 'points' : cannot change previously set output primitive
ERROR: 0:78: 'triangle_strip' : cannot apply to input
ERROR: 0:79: 'triangle_strip' : cannot apply to: uniform
ERROR: 0:80: 'triangle_strip' : can only apply to a standalone qualifier
ERROR: 0:81: 'triangle_strip' : can only apply to a standalone qualifier
ERROR: 0:81: '' : array size required
ERROR: 0:82: 'invocations' : can only apply to a standalone qualifier
ERROR: 0:82: 'output block' : not supported with this profile: es
ERROR: 0:84: 'invocations' : can only apply to a standalone qualifier
ERROR: 0:85: 'max_vertices' : can only apply to a standalone qualifier
ERROR: 0:86: 'triangle_strip' : can only apply to a standalone qualifier
ERROR: 0:83: 'output block' : not supported with this profile: es
ERROR: 0:89: 'lines' : cannot apply to 'out'
ERROR: 0:91: 'triangles' : cannot change previously set input primitive
ERROR: 0:92: 'triangles_adjacency' : cannot change previously set input primitive
ERROR: 0:95: '' : array size required
ERROR: 0:95: 'input block' : not supported with this profile: es
ERROR: 0:96: 'stream' : member cannot contradict block
ERROR: 0:96: 'stream' : can only be used on an output
ERROR: 0:99: '' : array size required
ERROR: 0:99: 'input block' : not supported with this profile: es
ERROR: 0:103: 'output block' : not supported with this profile: es
ERROR: 0:112: 'gl_MaxVertexUniformComponents' : undeclared identifier
ERROR: 0:111: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'const mediump int' and a right operand of type 'temp float' (or there is no acceptable conversion)
ERROR: 0:113: 'gl_MaxVaryingFloats' : undeclared identifier
ERROR: 0:112: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'const mediump int' and a right operand of type 'temp float' (or there is no acceptable conversion)
ERROR: 0:114: 'gl_MaxVaryingComponents' : undeclared identifier
ERROR: 0:113: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'const mediump int' and a right operand of type 'temp float' (or there is no acceptable conversion)
ERROR: 0:115: 'gl_MaxVertexOutputComponents' : undeclared identifier
ERROR: 0:114: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'const mediump int' and a right operand of type 'temp float' (or there is no acceptable conversion)
ERROR: 0:118: 'gl_MaxFragmentInputComponents' : undeclared identifier
ERROR: 0:117: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'const mediump int' and a right operand of type 'temp float' (or there is no acceptable conversion)
ERROR: 0:122: 'gl_MaxFragmentUniformComponents' : undeclared identifier
ERROR: 0:121: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'const mediump int' and a right operand of type 'temp float' (or there is no acceptable conversion)
ERROR: 0:124: 'gl_MaxClipDistances' : undeclared identifier
ERROR: 0:123: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'const mediump int' and a right operand of type 'temp float' (or there is no acceptable conversion)
ERROR: 0:129: 'gl_MaxGeometryVaryingComponents' : undeclared identifier
ERROR: 0:128: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'const mediump int' and a right operand of type 'temp float' (or there is no acceptable conversion)
ERROR: 0:111: '=' : cannot convert from 'const mediump int' to 'global mediump float'
ERROR: 0:133: 'gl_ViewportIndex' : undeclared identifier
ERROR: 0:133: 'gl_MaxViewports' : undeclared identifier
ERROR: 0:133: '-' : wrong operand types: no operation '-' exists that takes a left-hand operand of type 'temp float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:140: 'gl_ViewportIndex' : undeclared identifier
ERROR: 0:140: 'gl_MaxViewports' : undeclared identifier
ERROR: 0:140: '-' : wrong operand types: no operation '-' exists that takes a left-hand operand of type 'temp float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 91 compilation errors. No code generated.
Shader version: 310
Requested GL_ARB_viewport_array
Requested GL_EXT_geometry_shader
invocations = 4
max_vertices = 200
input primitive = lines_adjacency
output primitive = triangle_strip
ERROR: node is still EOpNull!
0:29 Function Definition: main( (global void)
0:29 Function Parameters:
0:31 Sequence
0:31 Constant:
0:31 0.000000
0:32 Constant:
0:32 0.000000
0:33 Constant:
0:33 0.000000
0:34 Constant:
0:34 0.000000
0:36 move second child to first child (temp mediump 3-component vector of float)
0:36 color: direct index for structure (layout(stream=0 ) out mediump 3-component vector of float)
0:36 'anon@0' (layout(stream=0 ) out block{layout(stream=0 ) out mediump 3-component vector of float color})
0:36 Constant:
0:36 0 (const uint)
0:36 color: direct index for structure (in mediump 3-component vector of float)
0:36 direct index (temp block{in mediump 3-component vector of float color})
0:36 'fromV' (in 4-element array of block{in mediump 3-component vector of float color})
0:36 Constant:
0:36 0 (const int)
0:36 Constant:
0:36 0 (const int)
0:37 move second child to first child (temp float)
0:37 Constant:
0:37 0.000000
0:37 Constant:
0:37 0.000000
0:38 move second child to first child (temp float)
0:38 'gl_Position' (temp float)
0:38 Constant:
0:38 0.000000
0:39 move second child to first child (temp float)
0:39 'gl_PointSize' (temp float)
0:39 Constant:
0:39 0.000000
0:40 move second child to first child (temp float)
0:40 'gl_PrimitiveID' (temp float)
0:40 'gl_PrimitiveIDIn' (temp float)
0:41 'gl_Layer' (temp float)
0:71 Function Definition: foo(i1; (global void)
0:71 Function Parameters:
0:71 'a' (in highp int)
0:73 Sequence
0:73 move second child to first child (temp mediump 4-component vector of float)
0:73 a: direct index for structure (layout(stream=6 ) out mediump 4-component vector of float)
0:73 'ouuaa6' (layout(stream=6 ) out block{layout(stream=6 ) out mediump 4-component vector of float a})
0:73 Constant:
0:73 0 (const int)
0:73 Constant:
0:73 1.000000
0:73 1.000000
0:73 1.000000
0:73 1.000000
0:131 Function Definition: fooe1( (global void)
0:131 Function Parameters:
0:133 Sequence
0:133 move second child to first child (temp float)
0:133 'gl_ViewportIndex' (temp float)
0:133 'gl_MaxViewports' (temp float)
0:138 Function Definition: fooe2( (global void)
0:138 Function Parameters:
0:140 Sequence
0:140 move second child to first child (temp float)
0:140 'gl_ViewportIndex' (temp float)
0:140 'gl_MaxViewports' (temp float)
0:? Linker Objects
0:? 'fromV' (in 4-element array of block{in mediump 3-component vector of float color})
0:? 'toF' (layout(stream=0 ) out block{layout(stream=0 ) out mediump 3-component vector of float color})
0:? 'anon@0' (layout(stream=0 ) out block{layout(stream=0 ) out mediump 3-component vector of float color})
0:? 'ov0' (layout(stream=0 ) out mediump 4-component vector of float)
0:? 'ov4' (layout(stream=4 ) out mediump 4-component vector of float)
0:? 'o1v0' (layout(stream=0 ) out mediump 4-component vector of float)
0:? 'ua' (layout(stream=3 ) uniform highp int)
0:? 'ibb' (layout(stream=3 column_major shared ) uniform block{layout(stream=3 column_major shared ) uniform highp int ua})
0:? 'ov3' (layout(stream=3 ) out mediump 4-component vector of float)
0:? 'ouuaa6' (layout(stream=6 ) out block{layout(stream=6 ) out mediump 4-component vector of float a})
0:? 'ouua6' (layout(stream=6 ) out block{layout(stream=6 ) out mediump 4-component vector of float a})
0:? 'ouua7' (layout(stream=7 ) out block{layout(stream=6 ) out mediump 4-component vector of float a})
0:? 'ov2s3' (layout(stream=3 ) out mediump 4-component vector of float)
0:? 'badv4' (layout(stream=3 ) out mediump 4-component vector of float)
0:? 'bad2v4' (in implicitly-sized array of mediump 4-component vector of float)
0:? 'anon@1' (layout(stream=3 ) out block{layout(stream=3 ) out highp int a})
0:? 'outbi' (layout(stream=3 ) out block{layout(stream=3 ) out highp int a, layout(stream=3 ) out highp int b, layout(stream=3 ) out highp int c})
0:? 'inbi' (in 4-element array of block{layout(stream=2 ) in highp int a})
0:? 'insn' (in 4-element array of block{in highp int a15})
0:? 'anon@2' (layout(stream=3 ) out block{layout(stream=3 ) out mediump float f15})
0:? 'anon@3' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform bool b15})
0:? 'summ' (global mediump float)
0:? 'gl_ViewportIndex' (layout(stream=3 ) out highp int)
Linked geometry stage:
Shader version: 310
Requested GL_ARB_viewport_array
Requested GL_EXT_geometry_shader
invocations = 4
max_vertices = 200
input primitive = lines_adjacency
output primitive = triangle_strip
ERROR: node is still EOpNull!
0:29 Function Definition: main( (global void)
0:29 Function Parameters:
0:31 Sequence
0:31 Constant:
0:31 0.000000
0:32 Constant:
0:32 0.000000
0:33 Constant:
0:33 0.000000
0:34 Constant:
0:34 0.000000
0:36 move second child to first child (temp mediump 3-component vector of float)
0:36 color: direct index for structure (layout(stream=0 ) out mediump 3-component vector of float)
0:36 'anon@0' (layout(stream=0 ) out block{layout(stream=0 ) out mediump 3-component vector of float color})
0:36 Constant:
0:36 0 (const uint)
0:36 color: direct index for structure (in mediump 3-component vector of float)
0:36 direct index (temp block{in mediump 3-component vector of float color})
0:36 'fromV' (in 4-element array of block{in mediump 3-component vector of float color})
0:36 Constant:
0:36 0 (const int)
0:36 Constant:
0:36 0 (const int)
0:37 move second child to first child (temp float)
0:37 Constant:
0:37 0.000000
0:37 Constant:
0:37 0.000000
0:38 move second child to first child (temp float)
0:38 'gl_Position' (temp float)
0:38 Constant:
0:38 0.000000
0:39 move second child to first child (temp float)
0:39 'gl_PointSize' (temp float)
0:39 Constant:
0:39 0.000000
0:40 move second child to first child (temp float)
0:40 'gl_PrimitiveID' (temp float)
0:40 'gl_PrimitiveIDIn' (temp float)
0:41 'gl_Layer' (temp float)
0:71 Function Definition: foo(i1; (global void)
0:71 Function Parameters:
0:71 'a' (in highp int)
0:73 Sequence
0:73 move second child to first child (temp mediump 4-component vector of float)
0:73 a: direct index for structure (layout(stream=6 ) out mediump 4-component vector of float)
0:73 'ouuaa6' (layout(stream=6 ) out block{layout(stream=6 ) out mediump 4-component vector of float a})
0:73 Constant:
0:73 0 (const int)
0:73 Constant:
0:73 1.000000
0:73 1.000000
0:73 1.000000
0:73 1.000000
0:131 Function Definition: fooe1( (global void)
0:131 Function Parameters:
0:133 Sequence
0:133 move second child to first child (temp float)
0:133 'gl_ViewportIndex' (temp float)
0:133 'gl_MaxViewports' (temp float)
0:138 Function Definition: fooe2( (global void)
0:138 Function Parameters:
0:140 Sequence
0:140 move second child to first child (temp float)
0:140 'gl_ViewportIndex' (temp float)
0:140 'gl_MaxViewports' (temp float)
0:? Linker Objects
0:? 'fromV' (in 4-element array of block{in mediump 3-component vector of float color})
0:? 'toF' (layout(stream=0 ) out block{layout(stream=0 ) out mediump 3-component vector of float color})
0:? 'anon@0' (layout(stream=0 ) out block{layout(stream=0 ) out mediump 3-component vector of float color})
0:? 'ov0' (layout(stream=0 ) out mediump 4-component vector of float)
0:? 'ov4' (layout(stream=4 ) out mediump 4-component vector of float)
0:? 'o1v0' (layout(stream=0 ) out mediump 4-component vector of float)
0:? 'ua' (layout(stream=3 ) uniform highp int)
0:? 'ibb' (layout(stream=3 column_major shared ) uniform block{layout(stream=3 column_major shared ) uniform highp int ua})
0:? 'ov3' (layout(stream=3 ) out mediump 4-component vector of float)
0:? 'ouuaa6' (layout(stream=6 ) out block{layout(stream=6 ) out mediump 4-component vector of float a})
0:? 'ouua6' (layout(stream=6 ) out block{layout(stream=6 ) out mediump 4-component vector of float a})
0:? 'ouua7' (layout(stream=7 ) out block{layout(stream=6 ) out mediump 4-component vector of float a})
0:? 'ov2s3' (layout(stream=3 ) out mediump 4-component vector of float)
0:? 'badv4' (layout(stream=3 ) out mediump 4-component vector of float)
0:? 'bad2v4' (in 1-element array of mediump 4-component vector of float)
0:? 'anon@1' (layout(stream=3 ) out block{layout(stream=3 ) out highp int a})
0:? 'outbi' (layout(stream=3 ) out block{layout(stream=3 ) out highp int a, layout(stream=3 ) out highp int b, layout(stream=3 ) out highp int c})
0:? 'inbi' (in 4-element array of block{layout(stream=2 ) in highp int a})
0:? 'insn' (in 4-element array of block{in highp int a15})
0:? 'anon@2' (layout(stream=3 ) out block{layout(stream=3 ) out mediump float f15})
0:? 'anon@3' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform bool b15})
0:? 'summ' (global mediump float)
0:? 'gl_ViewportIndex' (layout(stream=3 ) out highp int)

View File

@ -15,7 +15,7 @@ Shader version: 110
0:? Linker Objects
noMain1.geom
ERROR: #version: geometry shaders require non-es profile and version 150 or above
ERROR: #version: geometry shaders require es profile with version 310 or non-es profile with version 150 or above
ERROR: 1 compilation errors. No code generated.

View File

@ -38,6 +38,7 @@ comment.frag
300block.frag
310.comp
310.vert
310.geom
310.frag
310implicitSizeArrayError.vert
310AofA.vert

View File

@ -989,7 +989,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
"vec4 texture3DLod(sampler3D, vec3, float);" // GL_ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check
"vec4 texture3DProjLod(sampler3D, vec4, float);" // GL_ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check
"vec4 textureCubeLod(samplerCube, vec3, float);" // GL_ARB_shader_texture_lod
"\n");
}
if ( profile == ECompatibilityProfile ||
@ -1026,14 +1026,15 @@ void TBuiltIns::initialize(int version, EProfile profile)
"\n");
}
if (profile != EEsProfile && version >= 150) {
if ((profile != EEsProfile && version >= 150) ||
(profile == EEsProfile && version >= 310)) {
//============================================================================
//
// Prototypes for built-in functions seen by geometry shaders only.
//
//============================================================================
if (version >= 400) {
if (profile != EEsProfile && version >= 400) {
stageBuiltins[EShLangGeometry].append(
"void EmitStreamVertex(int);"
"void EndStreamPrimitive(int);"
@ -1093,7 +1094,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
"vec4 texture3D(sampler3D, vec3, float);" // OES_texture_3D
"vec4 texture3DProj(sampler3D, vec4, float);" // OES_texture_3D
"vec4 textureCube(samplerCube, vec3, float);"
"\n");
}
if (profile != EEsProfile && version > 100) {
@ -1105,7 +1106,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
"vec4 shadow2D(sampler2DShadow, vec3, float);"
"vec4 shadow1DProj(sampler1DShadow, vec4, float);"
"vec4 shadow2DProj(sampler2DShadow, vec4, float);"
"\n");
}
if (profile == EEsProfile) {
@ -1114,7 +1115,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
"vec4 texture2DProjLodEXT(sampler2D, vec3, float);" // GL_EXT_shader_texture_lod
"vec4 texture2DProjLodEXT(sampler2D, vec4, float);" // GL_EXT_shader_texture_lod
"vec4 textureCubeLodEXT(samplerCube, vec3, float);" // GL_EXT_shader_texture_lod
"\n");
}
@ -1128,12 +1129,12 @@ void TBuiltIns::initialize(int version, EProfile profile)
"vec2 dFdy(vec2 p);"
"vec3 dFdy(vec3 p);"
"vec4 dFdy(vec4 p);"
"float fwidth(float p);"
"vec2 fwidth(vec2 p);"
"vec3 fwidth(vec3 p);"
"vec4 fwidth(vec4 p);"
"\n");
// GL_ARB_derivative_control
@ -1143,17 +1144,17 @@ void TBuiltIns::initialize(int version, EProfile profile)
"vec2 dFdxFine(vec2 p);"
"vec3 dFdxFine(vec3 p);"
"vec4 dFdxFine(vec4 p);"
"float dFdyFine(float p);"
"vec2 dFdyFine(vec2 p);"
"vec3 dFdyFine(vec3 p);"
"vec4 dFdyFine(vec4 p);"
"float fwidthFine(float p);"
"vec2 fwidthFine(vec2 p);"
"vec3 fwidthFine(vec3 p);"
"vec4 fwidthFine(vec4 p);"
"\n");
stageBuiltins[EShLangFragment].append(
@ -1161,7 +1162,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
"vec2 dFdxCoarse(vec2 p);"
"vec3 dFdxCoarse(vec3 p);"
"vec4 dFdxCoarse(vec4 p);"
"float dFdyCoarse(float p);"
"vec2 dFdyCoarse(vec2 p);"
"vec3 dFdyCoarse(vec3 p);"
@ -1505,7 +1506,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
"float gl_PointSize;"
"float gl_ClipDistance[];"
"\n");
if (version >= 400 && profile == ECompatibilityProfile)
if (profile == ECompatibilityProfile && version >= 400)
stageBuiltins[EShLangGeometry].append(
"vec4 gl_ClipVertex;"
"vec4 gl_FrontColor;"
@ -1525,23 +1526,43 @@ void TBuiltIns::initialize(int version, EProfile profile)
"out int gl_PrimitiveID;"
"out int gl_Layer;");
if (version < 400 && profile == ECompatibilityProfile)
if (profile == ECompatibilityProfile && version < 400)
stageBuiltins[EShLangGeometry].append(
"out vec4 gl_ClipVertex;"
);
if (version >= 400 && profile != EEsProfile)
if (version >= 400)
stageBuiltins[EShLangGeometry].append(
"in int gl_InvocationID;"
);
// GL_ARB_viewport_array
if (version >= 150 && profile != EEsProfile)
if (version >= 150)
stageBuiltins[EShLangGeometry].append(
"out int gl_ViewportIndex;"
);
stageBuiltins[EShLangGeometry].append("\n");
} else if (profile == EEsProfile && version >= 310) {
stageBuiltins[EShLangGeometry].append(
"in gl_PerVertex {"
"highp vec4 gl_Position;"
"highp float gl_PointSize;"
"} gl_in[];"
"\n"
"in highp int gl_PrimitiveIDIn;"
"in highp int gl_InvocationID;"
"\n"
"out gl_PerVertex {"
"vec4 gl_Position;"
"float gl_PointSize;"
"};"
"\n"
"out int gl_PrimitiveID;"
"out int gl_Layer;"
"\n"
);
}
//============================================================================
//
// Define the interface to the tessellation control shader.
@ -2275,6 +2296,29 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
snprintf(builtInConstant, maxSize, "const mediump int gl_MaxProgramTexelOffset = %d;", resources.maxProgramTexelOffset);
s.append(builtInConstant);
}
// geometry
if (version >= 310) {
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryInputComponents = %d;", resources.maxGeometryInputComponents);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryOutputComponents = %d;", resources.maxGeometryOutputComponents);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryImageUniforms = %d;", resources.maxGeometryImageUniforms);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryTextureImageUnits = %d;", resources.maxGeometryTextureImageUnits);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryOutputVertices = %d;", resources.maxGeometryOutputVertices);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryTotalOutputComponents = %d;", resources.maxGeometryTotalOutputComponents);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryUniformComponents = %d;", resources.maxGeometryUniformComponents);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounters = %d;", resources.maxGeometryAtomicCounters);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounterBuffers = %d;", resources.maxGeometryAtomicCounterBuffers);
s.append(builtInConstant);
}
} else {
// non-ES profile

View File

@ -157,7 +157,8 @@ bool TParseContext::parseShaderStrings(TPpContext& ppContext, TInputScanner& inp
currentScanner = &input;
ppContext.setInput(input, versionWillBeError);
yyparse(this);
finalErrorCheck();
if (! parsingBuiltins)
finalErrorCheck();
return numErrors == 0;
}
@ -3105,6 +3106,30 @@ void TParseContext::finalErrorCheck()
// Check on array indexes for ES 2.0 (version 100) limitations.
for (size_t i = 0; i < needsIndexLimitationChecking.size(); ++i)
constantIndexExpressionCheck(needsIndexLimitationChecking[i]);
// Check for stages that are enabled by extension.
// Can't do this at the beginning, it is chicken and egg to add a stage by extension.
// Specific stage-specific features were correctly tested for already, this is just
// about the stage itself.
switch (language) {
case EShLangGeometry:
if (profile == EEsProfile && version == 310)
requireExtensions(getCurrentLoc(), 1, &GL_EXT_geometry_shader, "geometry shaders");
break;
case EShLangTessControl:
case EShLangTessEvaluation:
if (profile == EEsProfile && version == 310)
requireExtensions(getCurrentLoc(), 1, &GL_EXT_tessellation_shader, "tessellation shaders");
else if (profile != EEsProfile && version < 400)
requireExtensions(getCurrentLoc(), 1, &GL_ARB_tessellation_shader, "tessellation shaders");
break;
case EShLangCompute:
if (profile != EEsProfile && version < 430)
requireExtensions(getCurrentLoc(), 1, &GL_ARB_compute_shader, "tessellation shaders");
break;
default:
break;
}
}
//

View File

@ -224,6 +224,7 @@ protected:
TIntermNode* executeInitializer(TSourceLoc, TIntermTyped* initializer, TVariable* variable);
TIntermTyped* convertInitializerList(TSourceLoc, const TType&, TIntermTyped* initializer);
TOperator mapTypeToConstructorOp(const TType&) const;
void updateExtensionBehavior(const char* const extension, TExtensionBehavior);
void finalErrorCheck();
public:

View File

@ -347,28 +347,32 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
// Correct for stage type...
switch (stage) {
case EShLangGeometry:
if (version < 150 || (profile != ECoreProfile && profile != ECompatibilityProfile)) {
if ((profile == EEsProfile && version < 310) ||
(profile != EEsProfile && version < 150)) {
correct = false;
infoSink.info.message(EPrefixError, "#version: geometry shaders require non-es profile and version 150 or above");
version = 150;
profile = ECoreProfile;
infoSink.info.message(EPrefixError, "#version: geometry shaders require es profile with version 310 or non-es profile with version 150 or above");
version = (profile == EEsProfile) ? 310 : 150;
if (profile == EEsProfile || profile == ENoProfile)
profile = ECoreProfile;
}
break;
case EShLangTessControl:
case EShLangTessEvaluation:
if (version < 150 || (profile != ECoreProfile && profile != ECompatibilityProfile)) {
if ((profile == EEsProfile && version < 310) ||
(profile != EEsProfile && version < 150)) {
correct = false;
infoSink.info.message(EPrefixError, "#version: tessellation shaders require non-es profile and version 150 or above");
version = 150;
profile = ECoreProfile;
infoSink.info.message(EPrefixError, "#version: tessellation shaders require es profile with version 310 or non-es profile with version 150 or above");
version = (profile == EEsProfile) ? 310 : 400; // 150 supports the extension, correction is to 400 which does not
if (profile == EEsProfile || profile == ENoProfile)
profile = ECoreProfile;
}
break;
case EShLangCompute:
if ((profile == EEsProfile && version < 310) ||
(profile != EEsProfile && version < 430)) {
(profile != EEsProfile && version < 420)) {
correct = false;
infoSink.info.message(EPrefixError, "#version: compute shaders require es profile with version 310 or above, or non-es profile with version 430 or above");
version = profile == EEsProfile ? 310 : 430;
infoSink.info.message(EPrefixError, "#version: compute shaders require es profile with version 310 or above, or non-es profile with version 420 or above");
version = profile == EEsProfile ? 310 : 430; // 420 supports the extension, correction is to 430 which does not
profile = ECoreProfile;
}
break;

View File

@ -161,6 +161,7 @@ void TParseContext::initializeExtensionBehavior()
extensionBehavior[GL_ARB_texture_gather] = EBhDisable;
extensionBehavior[GL_ARB_gpu_shader5] = EBhDisablePartial;
extensionBehavior[GL_ARB_separate_shader_objects] = EBhDisable;
extensionBehavior[GL_ARB_compute_shader] = EBhDisablePartial;
extensionBehavior[GL_ARB_tessellation_shader] = EBhDisable;
extensionBehavior[GL_ARB_enhanced_layouts] = EBhDisable;
extensionBehavior[GL_ARB_texture_cube_map_array] = EBhDisable;
@ -172,6 +173,23 @@ void TParseContext::initializeExtensionBehavior()
extensionBehavior[GL_ARB_shader_texture_image_samples] = EBhDisable;
extensionBehavior[GL_ARB_viewport_array] = EBhDisable;
// extensionBehavior[GL_ARB_cull_distance] = EBhDisable; // present for 4.5, but need extension control over block members
// AEP
extensionBehavior[GL_ANDROID_extension_pack_es31a] = EBhDisablePartial;
extensionBehavior[GL_KHR_blend_equation_advanced] = EBhDisablePartial;
extensionBehavior[GL_OES_sample_variables] = EBhDisablePartial;
extensionBehavior[GL_OES_shader_image_atomic] = EBhDisablePartial;
extensionBehavior[GL_OES_shader_multisample_interpolation] = EBhDisablePartial;
extensionBehavior[GL_OES_texture_storage_multisample_2d_array] = EBhDisablePartial;
extensionBehavior[GL_EXT_geometry_shader] = EBhDisablePartial;
extensionBehavior[GL_EXT_geometry_point_size] = EBhDisablePartial;
extensionBehavior[GL_EXT_gpu_shader5] = EBhDisablePartial;
extensionBehavior[GL_EXT_primitive_bounding_box] = EBhDisablePartial;
extensionBehavior[GL_EXT_shader_io_blocks] = EBhDisablePartial;
extensionBehavior[GL_EXT_tessellation_shader] = EBhDisablePartial;
extensionBehavior[GL_EXT_tessellation_point_size] = EBhDisablePartial;
extensionBehavior[GL_EXT_texture_buffer] = EBhDisablePartial;
extensionBehavior[GL_EXT_texture_cube_map_array] = EBhDisablePartial;
}
// Get code that is not part of a shared symbol table, is specific to this shader,
@ -187,6 +205,23 @@ const char* TParseContext::getPreamble()
"#define GL_EXT_frag_depth 1\n"
"#define GL_OES_EGL_image_external 1\n"
"#define GL_EXT_shader_texture_lod 1\n"
// AEP
"#define GL_ANDROID_extension_pack_es31a 1\n"
"#define GL_KHR_blend_equation_advanced 1\n"
"#define GL_OES_sample_variables 1\n"
"#define GL_OES_shader_image_atomic 1\n"
"#define GL_OES_shader_multisample_interpolation 1\n"
"#define GL_OES_texture_storage_multisample_2d_array 1\n"
"#define GL_EXT_geometry_shader 1\n"
"#define GL_EXT_geometry_point_size 1\n"
"#define GL_EXT_gpu_shader5 1\n"
"#define GL_EXT_primitive_bounding_box 1\n"
"#define GL_EXT_shader_io_blocks 1\n"
"#define GL_EXT_tessellation_shader 1\n"
"#define GL_EXT_tessellation_point_size 1\n"
"#define GL_EXT_texture_buffer 1\n"
"#define GL_EXT_texture_cube_map_array 1\n"
;
} else {
return
@ -196,6 +231,7 @@ const char* TParseContext::getPreamble()
"#define GL_ARB_texture_gather 1\n"
"#define GL_ARB_gpu_shader5 1\n"
"#define GL_ARB_separate_shader_objects 1\n"
"#define GL_ARB_compute_shader 1\n"
"#define GL_ARB_tessellation_shader 1\n"
"#define GL_ARB_enhanced_layouts 1\n"
"#define GL_ARB_texture_cube_map_array 1\n"
@ -434,12 +470,36 @@ void TParseContext::updateExtensionBehavior(const char* extension, const char* b
behavior = EBhDisable;
else if (! strcmp("warn", behaviorString))
behavior = EBhWarn;
else
error(getCurrentLoc(), "behavior not supported", "#extension", behaviorString);
else {
error(getCurrentLoc(), "behavior not supported:", "#extension", behaviorString);
return;
}
// update the requested extension
updateExtensionBehavior(extension, behavior);
// see if need to propagate to everything in AEP
if (strcmp(extension, "GL_ANDROID_extension_pack_es31a") == 0) {
updateExtensionBehavior("GL_KHR_blend_equation_advanced", behaviorString);
updateExtensionBehavior("GL_OES_sample_variables", behaviorString);
updateExtensionBehavior("GL_OES_shader_image_atomic", behaviorString);
updateExtensionBehavior("GL_OES_shader_multisample_interpolation", behaviorString);
updateExtensionBehavior("GL_OES_texture_storage_multisample_2d_array", behaviorString);
updateExtensionBehavior("GL_EXT_geometry_shader", behaviorString);
updateExtensionBehavior("GL_EXT_gpu_shader5", behaviorString);
updateExtensionBehavior("GL_EXT_primitive_bounding_box", behaviorString);
updateExtensionBehavior("GL_EXT_shader_io_blocks", behaviorString);
updateExtensionBehavior("GL_EXT_tessellation_shader", behaviorString);
updateExtensionBehavior("GL_EXT_texture_buffer", behaviorString);
updateExtensionBehavior("GL_EXT_texture_cube_map_array", behaviorString);
}
}
void TParseContext::updateExtensionBehavior(const char* extension, TExtensionBehavior behavior)
{
// Update the current behavior
TMap<TString, TExtensionBehavior>::iterator iter;
if (! strcmp(extension, "all")) {
if (strcmp(extension, "all") == 0) {
// special case for the 'all' extension; apply it to every extension present
if (behavior == EBhRequire || behavior == EBhEnable) {
error(getCurrentLoc(), "extension 'all' cannot have 'require' or 'enable' behavior", "#extension", "");

View File

@ -85,6 +85,7 @@ const char* const GL_ARB_shading_language_420pack = "GL_ARB_shading_language
const char* const GL_ARB_texture_gather = "GL_ARB_texture_gather";
const char* const GL_ARB_gpu_shader5 = "GL_ARB_gpu_shader5";
const char* const GL_ARB_separate_shader_objects = "GL_ARB_separate_shader_objects";
const char* const GL_ARB_compute_shader = "GL_ARB_compute_shader";
const char* const GL_ARB_tessellation_shader = "GL_ARB_tessellation_shader";
const char* const GL_ARB_enhanced_layouts = "GL_ARB_enhanced_layouts";
const char* const GL_ARB_texture_cube_map_array = "GL_ARB_texture_cube_map_array";
@ -97,6 +98,23 @@ const char* const GL_ARB_shader_texture_image_samples = "GL_ARB_shader_texture_i
const char* const GL_ARB_viewport_array = "GL_ARB_viewport_array";
//const char* const GL_ARB_cull_distance = "GL_ARB_cull_distance"; // present for 4.5, but need extension control over block members
// AEP
const char* const GL_ANDROID_extension_pack_es31a = "GL_ANDROID_extension_pack_es31a";
const char* const GL_KHR_blend_equation_advanced = "GL_KHR_blend_equation_advanced";
const char* const GL_OES_sample_variables = "GL_OES_sample_variables";
const char* const GL_OES_shader_image_atomic = "GL_OES_shader_image_atomic";
const char* const GL_OES_shader_multisample_interpolation = "GL_OES_shader_multisample_interpolation";
const char* const GL_OES_texture_storage_multisample_2d_array = "GL_OES_texture_storage_multisample_2d_array";
const char* const GL_EXT_geometry_shader = "GL_EXT_geometry_shader";
const char* const GL_EXT_geometry_point_size = "GL_EXT_geometry_point_size";
const char* const GL_EXT_gpu_shader5 = "GL_EXT_gpu_shader5";
const char* const GL_EXT_primitive_bounding_box = "GL_EXT_primitive_bounding_box";
const char* const GL_EXT_shader_io_blocks = "GL_EXT_shader_io_blocks";
const char* const GL_EXT_tessellation_shader = "GL_EXT_tessellation_shader";
const char* const GL_EXT_tessellation_point_size = "GL_EXT_tessellation_point_size";
const char* const GL_EXT_texture_buffer = "GL_EXT_texture_buffer";
const char* const GL_EXT_texture_cube_map_array = "GL_EXT_texture_cube_map_array";
} // end namespace glslang
#endif // _VERSIONS_INCLUDED_