Additional semantic checking for tessellation shaders and related clean up:

- non-arrayed geometry inputs and tessellation-control outputs
 - include user blocks in i/o array resizing based on primitive type
 - things belonging only to 'in' or 'out' are verified only on 'in' or 'out'
 - invocation number changing
 - move shader-scoped qualifier checking into its class
 - remove an incidental union of two levels of the node hierarchy in the yacc stack
 - remove layout(location=) default tracking when setting on a variable


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24551 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2013-12-18 03:06:24 +00:00
parent 76ea74afe0
commit 7c908d2543
20 changed files with 280 additions and 206 deletions

View File

@@ -2,7 +2,7 @@
in fromVertex {
vec3 color;
} fromV;
} fromV[];
out toFragment {
vec3 color;
@@ -29,7 +29,7 @@ void main()
EmitStreamVertex(1); // ERROR
EndStreamPrimitive(0); // ERROR
color = fromV.color;
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;
@@ -72,7 +72,7 @@ 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(triangle_strip) in vec4 bad2v4[]; // ERROR, not on a variable or input
layout(invocations = 3) out outbn { int a; }; // ERROR, not on a block
out outbn2 {
layout(invocations = 3) int a; // ERROR, not on a block member
@@ -84,16 +84,16 @@ layout(lines) out; // ERROR, not on output
layout(lines_adjancency) in;
layout(triangles) in; // ERROR, can't change it
layout(triangles_adjacency) in; // ERROR, can't change it
layout(invocations = 4, max_vertices = 300) out;
layout(invocations = 4) in;
layout(max_vertices = 300) out;
in inbn {
layout(stream = 2) int a; // ERROR, stream on input
} inbi;
} inbi[];
in sameName {
int a15;
};
} insn[];
out sameName {
float f15;

View File

@@ -51,7 +51,7 @@ shared vec4 compute_only; // ERROR
layout(packed) uniform;
layout(packed) float aoeuntaoeu;
layout(packed) float aoeuntaoeu; // ERROR, packed on variable
layout(location = 40) in float cd;
layout(location = 37) in mat4x3 ce; // ERROR, overlap

View File

@@ -6,12 +6,12 @@ void main()
EndStreamPrimitive(0);
EmitVertex();
EndPrimitive();
int id = gl_InvocationID;
}
layout(invocations = 3) out outbn { int a; }; // ERROR, not on a block
layout(max_vertices = 127, invocations = 4) out;
layout(invocations = 4) in outbn { int a; } bn[]; // ERROR, not on a block
layout(max_vertices = 127) out;
layout(invocations = 4) in;
#extension GL_ARB_separate_shader_objects : enable
@@ -55,5 +55,19 @@ layout(location = 4) in vec4 cva[3];
layout(location = 5) in vec4 cvb[3];
layout(location = 2) in mat3 cmc[3]; // ERROR, collision
patch in vec4 patchIn; // ERROR
patch out vec4 patchOut; // ERROR
patch in vec4 patchIn[]; // ERROR
patch out vec4 patchOut; // ERROR
in float scalar; // ERROR, no array
layout(max_vertices = 127, invocations = 4) out; // ERROR
layout(invocations = 4, max_vertices = 127) in; // ERROR
layout(max_vertices = 127, invocations = 4) uniform; // 2 ERRORs
in inblockscalar {
int a;
} inbls; // ERROR, not an array
in inblocka {
int a;
} inbla[17]; // ERROR, wrong array size

View File

@@ -5,8 +5,8 @@ layout(quads, cw) in;
layout(triangles) in; // ERROR
layout(isolines) in; // ERROR
layout(cw) in;
layout(ccw) in; // ERROR
layout(cw) in;
layout(fractional_odd_spacing) in;
layout(equal_spacing) in; // ERROR
@@ -60,3 +60,13 @@ in gl_PerVertex
{
float gl_ClipDistance[1];
} gl_in[gl_MaxPatchVertices];
layout(quads, cw) out; // ERROR
layout(triangles) out; // ERROR
layout(isolines) out; // ERROR
layout(cw) out; // ERROR
layout(fractional_odd_spacing) out; // ERROR
layout(equal_spacing) out; // ERROR
layout(fractional_even_spacing) out; // ERROR
layout(point_mode) out; // ERROR

View File

@@ -23,7 +23,7 @@ void foo3()
}
uniform sampler2D s2D;
in vec2 coord;
in vec2 coord[];
uniform vec4 v4;
void foo4()
@@ -37,7 +37,7 @@ void foo4()
ivec2(2,1)
};
vec4 v = textureGatherOffset(s2D, coord, offsets[i].xy);
vec4 v = textureGatherOffset(s2D, coord[0], offsets[i].xy);
offsets[i].xy = ivec2(3); // ERROR
v4.x = 3.2; // ERROR

View File

@@ -25,3 +25,5 @@ void main()
gl_out[1].gl_Position = p;
gl_out[1].gl_PointSize = ps; // ERROR
}
out float outf; // ERROR, no array

View File

@@ -13,8 +13,8 @@ ERROR: 0:60: 'stream' : member cannot contradict block
ERROR: 0:65: 'max_vertices' : can only apply to a standalone qualifier
ERROR: 0:70: 'points' : cannot change previously set output primitive
ERROR: 0:71: 'points' : cannot change previously set output primitive
ERROR: 0:72: 'triangle_strip' : does not apply to input
ERROR: 0:73: 'triangle_strip' : cannot be used here
ERROR: 0:72: 'triangle_strip' : cannot apply to input
ERROR: 0:73: 'triangle_strip' : cannot apply to: uniform
ERROR: 0:74: 'triangle_strip' : can only apply to a standalone qualifier
ERROR: 0:75: 'triangle_strip' : can only apply to a standalone qualifier
ERROR: 0:76: 'invocations' : not supported for this version or the enabled extensions
@@ -23,10 +23,10 @@ ERROR: 0:78: 'invocations' : not supported for this version or the enabled exten
ERROR: 0:78: 'invocations' : can only apply to a standalone qualifier
ERROR: 0:79: 'max_vertices' : can only apply to a standalone qualifier
ERROR: 0:80: 'triangle_strip' : can only apply to a standalone qualifier
ERROR: 0:83: 'lines' : does not apply to output
ERROR: 0:83: 'lines' : cannot apply to 'out'
ERROR: 0:85: 'triangles' : cannot change previously set input primitive
ERROR: 0:86: 'triangles_adjacency' : cannot change previously set input primitive
ERROR: 0:88: 'invocations' : not supported for this version or the enabled extensions
ERROR: 0:87: 'invocations' : not supported for this version or the enabled extensions
ERROR: 0:88: 'max_vertices' : too large, must be less than gl_MaxGeometryOutputVertices
ERROR: 0:91: 'stream' : member cannot contradict block
ERROR: 29 compilation errors. No code generated.
@@ -52,7 +52,10 @@ ERROR: node is still EOpNull!
0:32 Constant:
0:32 0 (const uint)
0:32 color: direct index for structure (3-component vector of float)
0:32 'fromV' (in block{color})
0:32 direct index (block{color})
0:32 'fromV' (in 4-element array of block{color})
0:32 Constant:
0:32 0 (const int)
0:32 Constant:
0:32 0 (const int)
0:33 move second child to first child (float)
@@ -119,7 +122,7 @@ ERROR: node is still EOpNull!
0:67 1.000000
0:67 1.000000
0:? Linker Objects
0:? 'fromV' (in block{color})
0:? 'fromV' (in 4-element array of block{color})
0:? 'toF' (layout(stream=0 ) out block{color})
0:? '__anon__0' (layout(stream=0 ) out block{color})
0:? 'gl_in' (in 4-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
@@ -134,13 +137,13 @@ ERROR: node is still EOpNull!
0:? 'ouua7' (layout(stream=7 ) out block{a})
0:? 'ov2s3' (layout(stream=3 ) out 4-component vector of float)
0:? 'badv4' (layout(stream=3 ) out 4-component vector of float)
0:? 'bad2v4' (in 4-component vector of float)
0:? 'bad2v4' (in 4-element array of 4-component vector of float)
0:? '__anon__1' (layout(stream=3 ) out block{a})
0:? 'outbi' (layout(stream=3 ) out block{a,b,c})
0:? 'inbi' (in block{a})
0:? '__anon__2' (in block{a15})
0:? '__anon__3' (layout(stream=3 ) out block{f15})
0:? '__anon__4' (layout(column_major shared ) uniform block{b15})
0:? 'inbi' (in 4-element array of block{a})
0:? 'insn' (in 4-element array of block{a15})
0:? '__anon__2' (layout(stream=3 ) out block{f15})
0:? '__anon__3' (layout(column_major shared ) uniform block{b15})
Linked geometry stage:

View File

@@ -1,17 +1,24 @@
400.geom
Warning, version 400 is not yet complete; some version-specific features are present, but many are missing.
ERROR: 0:13: 'invocations' : can only apply to a standalone qualifier
ERROR: 0:12: 'invocations' : can only apply to a standalone qualifier
ERROR: 0:20: 'patch' : not supported in this stage: geometry
ERROR: 0:20: 'gl_PointSize' : cannot add layout to redeclared block member
ERROR: 0:20: 'gl_PointSize' : cannot add patch to redeclared block member
ERROR: 0:25: 'length' : array must first be sized by a redeclaration or layout qualifier
ERROR: 0:36: 'length' : array must first be sized by a redeclaration or layout qualifier
ERROR: 0:40: 'triangles' : inconsistent input primitive for array size colorBad
ERROR: 0:44: 'triangles' : inconsistent input primitive for array size colorbad2
ERROR: 0:40: 'triangles' : inconsistent input primitive for array size of colorBad
ERROR: 0:44: 'triangles' : inconsistent input primitive for array size of colorbad2
ERROR: 0:56: 'location' : repeated use of location 4
ERROR: 0:58: 'patch' : not supported in this stage: geometry
ERROR: 0:59: 'patch' : not supported in this stage: geometry
ERROR: 11 compilation errors. No code generated.
ERROR: 0:61: 'in' : type must be an array: scalar
ERROR: 0:63: 'invocations' : can only apply to 'in'
ERROR: 0:64: 'max_vertices' : can only apply to 'out'
ERROR: 0:65: 'max_vertices' : can only apply to 'out'
ERROR: 0:65: 'invocations' : can only apply to 'in'
ERROR: 0:67: 'in' : type must be an array: inbls
ERROR: 0:71: 'triangles' : inconsistent input primitive for array size of inbla
ERROR: 18 compilation errors. No code generated.
invocations = 4
@@ -30,10 +37,10 @@ ERROR: node is still EOpNull!
0:6 0 (const int)
0:7 EmitVertex (void)
0:8 EndPrimitive (void)
0:10 Sequence
0:10 move second child to first child (int)
0:10 'id' (int)
0:10 'gl_InvocationID' (in int)
0:9 Sequence
0:9 move second child to first child (int)
0:9 'id' (int)
0:9 'gl_InvocationID' (in int)
0:23 Function Definition: foo( (void)
0:23 Function Parameters:
0:25 Sequence
@@ -65,7 +72,7 @@ ERROR: node is still EOpNull!
0:51 Constant:
0:51 3 (const int)
0:? Linker Objects
0:? '__anon__0' (layout(stream=0 ) out block{a})
0:? 'bn' (in 3-element array of block{a})
0:? 'gl_in' (in 3-element array of block{gl_Position,gl_PointSize})
0:? 'color' (in 3-element array of 4-component vector of float)
0:? 'color2' (in 3-element array of 4-component vector of float)
@@ -75,8 +82,11 @@ ERROR: node is still EOpNull!
0:? 'cva' (layout(location=4 ) in 3-element array of 4-component vector of float)
0:? 'cvb' (layout(location=5 ) in 3-element array of 4-component vector of float)
0:? 'cmc' (layout(location=2 ) in 3-element array of 3X3 matrix of float)
0:? 'patchIn' (patch in 4-component vector of float)
0:? 'patchIn' (patch in 3-element array of 4-component vector of float)
0:? 'patchOut' (layout(stream=0 ) patch out 4-component vector of float)
0:? 'scalar' (in float)
0:? 'inbls' (in block{a})
0:? 'inbla' (in 17-element array of block{a})
Linked geometry stage:

View File

@@ -3,7 +3,7 @@ Warning, version 400 is not yet complete; some version-specific features are pre
ERROR: 0:3: 'vertices' : there is no such layout identifier for this stage taking an assigned value
ERROR: 0:5: 'triangles' : cannot change previously set input primitive
ERROR: 0:6: 'isolines' : cannot change previously set input primitive
ERROR: 0:9: 'ccw' : cannot change previously set vertex order
ERROR: 0:8: 'ccw' : cannot change previously set vertex order
ERROR: 0:12: 'equal_spacing' : cannot change previously set vertex spacing
ERROR: 0:13: 'fractional_even_spacing' : cannot change previously set vertex spacing
ERROR: 0:18: 'patch' : can only use on input in tessellation-evaluation shader
@@ -14,7 +14,16 @@ ERROR: 0:49: 'patch' : cannot use interpolation qualifiers with patch
ERROR: 0:50: '' : can only have one auxiliary qualifier (centroid, patch, and sample)
ERROR: 0:54: 'gl_PerVertex' : block already declared with size, can't redeclare as unsized
ERROR: 0:59: 'gl_PerVertex' : can only redeclare a built-in block once, and before any use
ERROR: 14 compilation errors. No code generated.
ERROR: 0:64: 'quads' : cannot apply to 'out'
ERROR: 0:64: 'cw' : can only apply to 'in'
ERROR: 0:65: 'triangles' : cannot apply to 'out'
ERROR: 0:66: 'isolines' : cannot apply to 'out'
ERROR: 0:67: 'cw' : can only apply to 'in'
ERROR: 0:68: 'fractional_odd_spacing' : can only apply to 'in'
ERROR: 0:69: 'equal_spacing' : can only apply to 'in'
ERROR: 0:70: 'fractional_even_spacing' : can only apply to 'in'
ERROR: 0:71: 'point_mode' : can only apply to 'in'
ERROR: 23 compilation errors. No code generated.
input primitive = quads

View File

@@ -53,7 +53,10 @@ ERROR: node is still EOpNull!
0:40 'v' (4-component vector of float)
0:40 Function Call: textureGatherOffset(s21;vf2;vi2; (4-component vector of float)
0:40 's2D' (uniform sampler2D)
0:40 'coord' (in 2-component vector of float)
0:40 direct index (2-component vector of float)
0:40 'coord' (in 3-element array of 2-component vector of float)
0:40 Constant:
0:40 0 (const int)
0:40 vector swizzle (2-component vector of int)
0:40 indirect index (2-component vector of int)
0:40 Constant:
@@ -115,7 +118,7 @@ ERROR: node is still EOpNull!
0:? 'gl_in' (in 3-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:? 'color3' (in 3-element array of 4-component vector of float)
0:? 's2D' (uniform sampler2D)
0:? 'coord' (in 2-component vector of float)
0:? 'coord' (in 3-element array of 2-component vector of float)
0:? 'v4' (uniform 4-component vector of float)
0:? '__anon__0' (layout(stream=0 ) out block{gl_PointSize,gl_ClipDistance})

View File

@@ -1,11 +1,12 @@
420.tesc
Warning, version 400 is not yet complete; some version-specific features are present, but many are missing.
ERROR: 0:7: 'vertices' : inconsistent output number of vertices for array size gl_out
ERROR: 0:11: 'vertices' : inconsistent output number of vertices for array size a
ERROR: 0:12: 'vertices' : inconsistent output number of vertices for array size outb
ERROR: 0:7: 'vertices' : inconsistent output number of vertices for array size of gl_out
ERROR: 0:11: 'vertices' : inconsistent output number of vertices for array size of a
ERROR: 0:12: 'vertices' : inconsistent output number of vertices for array size of outb
ERROR: 0:26: 'gl_PointSize' : no such field in structure
ERROR: 0:26: 'assign' : cannot convert from 'float' to 'block{gl_Position}'
ERROR: 5 compilation errors. No code generated.
ERROR: 0:29: 'out' : type must be an array: outf
ERROR: 6 compilation errors. No code generated.
vertices = 4
@@ -76,6 +77,7 @@ ERROR: node is still EOpNull!
0:? 'a' (out 3-element array of int)
0:? 'outb' (out 5-element array of int)
0:? 'outc' (out 4-element array of int)
0:? 'outf' (out float)
Linked tessellation control stage:

View File

@@ -21,7 +21,7 @@ ERROR: 0:85: 'offset' : there is no such layout identifier for this stage taking
ERROR: 0:85: 'binding' : requires block, or sampler/image, or atomic-counter type
ERROR: 0:87: 'binding' : requires block, or sampler/image, or atomic-counter type
ERROR: 0:89: 'offset' : there is no such layout identifier for this stage taking an assigned value
WARNING: 0:89: '' : cannot set qualifier defaults when using a type and no identifier
WARNING: 0:89: 'layout' : useless application of layout qualifier
ERROR: 0:91: 'bar' : redefinition
ERROR: 0:92: 'offset' : there is no such layout identifier for this stage taking an assigned value
ERROR: 0:92: 'bar' : redefinition