Tessellation: Implicit array sizing and consistency checking of control-shader output arrays based on layout(vertices=...).

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24518 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2013-12-13 18:38:43 +00:00
parent 116c30b6ed
commit f3e2a89452
19 changed files with 434 additions and 104 deletions

View File

@@ -35,3 +35,11 @@ void main()
gl_TessLevelOuter[3] = 3.2;
gl_TessLevelInner[1] = 1.3;
}
layout(vertices = 4) in; // ERROR
layout(vertices = 5) out; // ERROR
void foo()
{
gl_out[4].gl_PointSize; // ERROR
}

11
Test/410.tesc Normal file
View File

@@ -0,0 +1,11 @@
#version 400 core
// no layout(vertices = ...) out;
int outa[gl_out.length()]; // ERROR
patch out vec4 patchOut;
void main()
{
}

27
Test/420.tesc Normal file
View File

@@ -0,0 +1,27 @@
#version 400 core
#extension GL_ARB_separate_shader_objects : enable
layout(vertices = 4) out;
out gl_PerVertex {
vec4 gl_Position;
} gl_out[3]; // ERROR, wrong size
out int a[gl_out.length()];
out int outb[5]; // ERROR, wrong size
out int outc[];
void main()
{
vec4 p = gl_in[1].gl_Position;
float ps = gl_in[1].gl_PointSize;
float cd = gl_in[1].gl_ClipDistance[2];
int pvi = gl_PatchVerticesIn;
int pid = gl_PrimitiveID;
int iid = gl_InvocationID;
gl_out[1].gl_Position = p;
gl_out[1].gl_PointSize = ps; // ERROR
}

21
Test/420_size_gl_in.geom Normal file
View File

@@ -0,0 +1,21 @@
#version 420 core
// testing input arrays without a gl_in[] block redeclaration, see 400.geom for with
int i;
layout(triangles) in;
in vec4 colorun[];
in vec4 color3[3];
void foo()
{
gl_in.length();
gl_in[1].gl_Position;
gl_in.length();
gl_in[i].gl_Position;
}
in gl_PerVertex { // ERROR, already used
vec4 gl_Position;
} gl_in[];

View File

@@ -4,8 +4,8 @@ ERROR: 0:13: '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 be declared with a size before using this method
ERROR: 0:36: 'length' : array must be declared with a size before using this method
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:56: 'location' : repeated use of location 4
@@ -81,7 +81,7 @@ ERROR: node is still EOpNull!
Linked geometry stage:
ERROR: Linking geometry stage: At least one geometry shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one shader must specify an output layout primitive
invocations = 4
max_vertices = 127

View File

@@ -1,11 +1,13 @@
400.tesc
Warning, version 400 is not yet complete; some version-specific features are present, but many are missing.
ERROR: 0:4: 'length' : array must be declared with a size before using this method
ERROR: 0:6: 'quads' : unrecognized layout identifier, or qualifier requires assignemnt (e.g., binding = 4)
ERROR: 0:7: 'ccw' : unrecognized layout identifier, or qualifier requires assignemnt (e.g., binding = 4)
ERROR: 0:8: 'fractional_even_spacing' : unrecognized layout identifier, or qualifier requires assignemnt (e.g., binding = 4)
ERROR: 0:10: 'patch' : can only use on output in tessellation-control shader
ERROR: 5 compilation errors. No code generated.
ERROR: 0:39: 'vertices' : can only apply to 'out'
ERROR: 0:40: 'vertices' : cannot change previously set layout value
ERROR: 0:44: '[' : array index out of range '4'
ERROR: 7 compilation errors. No code generated.
vertices = 4
@@ -67,7 +69,7 @@ ERROR: node is still EOpNull!
0:31 move second child to first child (4-component vector of float)
0:31 gl_Position: direct index for structure (4-component vector of float)
0:31 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:31 'gl_out' (out unsized array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:31 'gl_out' (out 4-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:31 Constant:
0:31 1 (const int)
0:31 Constant:
@@ -76,7 +78,7 @@ ERROR: node is still EOpNull!
0:32 move second child to first child (float)
0:32 gl_PointSize: direct index for structure (float)
0:32 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:32 'gl_out' (out unsized array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:32 'gl_out' (out 4-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:32 Constant:
0:32 1 (const int)
0:32 Constant:
@@ -86,7 +88,7 @@ ERROR: node is still EOpNull!
0:33 direct index (float)
0:33 gl_ClipDistance: direct index for structure (unsized array of float)
0:33 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:33 'gl_out' (out unsized array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:33 'gl_out' (out 4-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:33 Constant:
0:33 1 (const int)
0:33 Constant:
@@ -108,11 +110,21 @@ ERROR: node is still EOpNull!
0:36 1 (const int)
0:36 Constant:
0:36 1.300000
0:42 Function Definition: foo( (void)
0:42 Function Parameters:
0:44 Sequence
0:44 gl_PointSize: direct index for structure (float)
0:44 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:44 'gl_out' (out 4-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:44 Constant:
0:44 4 (const int)
0:44 Constant:
0:44 1 (const int)
0:? Linker Objects
0:? 'outa' (1-element array of int)
0:? 'outa' (4-element array of int)
0:? 'patchIn' (patch in 4-component vector of float)
0:? 'patchOut' (patch out 4-component vector of float)
0:? 'gl_out' (out unsized array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:? 'gl_out' (out 4-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
Linked tessellation control stage:

View File

@@ -52,9 +52,9 @@ ERROR: node is still EOpNull!
Linked geometry stage:
ERROR: Linking geometry stage: At least one geometry shader must specify an input layout primitive
ERROR: Linking geometry stage: At least one geometry shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one geometry shader must specify a layout(max_vertices = value)
ERROR: Linking geometry stage: At least one shader must specify an input layout primitive
ERROR: Linking geometry stage: At least one shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
invocations = 0
max_vertices = 0

View File

@@ -0,0 +1,21 @@
410.tesc
Warning, version 400 is not yet complete; some version-specific features are present, but many are missing.
ERROR: 0:4: 'length' : array must first be sized by a redeclaration or layout qualifier
ERROR: 1 compilation errors. No code generated.
vertices = 0
ERROR: node is still EOpNull!
0:8 Function Definition: main( (void)
0:8 Function Parameters:
0:? Linker Objects
0:? 'outa' (1-element array of int)
0:? 'patchOut' (patch out 4-component vector of float)
Linked tessellation control stage:
ERROR: Linking tessellation control stage: At least one shader must specify an output layout(vertices=...)
vertices = 0

View File

@@ -1,7 +1,7 @@
420.geom
Warning, version 420 is not yet complete; some version-specific features are present, but many are missing.
ERROR: 0:9: 'length' : array must be declared with a size before using this method
ERROR: 0:11: '[' : array must be redeclared with a size before being indexed with a variable
ERROR: 0:9: 'length' : array must first be sized by a redeclaration or layout qualifier
ERROR: 0:11: '[' : array must be sized by a redeclaration or layout qualifier before being indexed with a variable
ERROR: 0:42: 'assign' : l-value required (can't modify a const)
ERROR: 0:43: 'assign' : l-value required "v4" (can't modify a uniform)
ERROR: 0:48: 'gl_PointSize' : cannot change arrayness of redeclared block member
@@ -123,8 +123,8 @@ ERROR: node is still EOpNull!
Linked geometry stage:
ERROR: Linking geometry stage: Missing entry point: Each stage requires one "void main()" entry point
ERROR: Linking geometry stage: At least one geometry shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one geometry shader must specify a layout(max_vertices = value)
ERROR: Linking geometry stage: At least one shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
invocations = 0
max_vertices = 0

View File

@@ -0,0 +1,85 @@
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: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.
vertices = 4
ERROR: node is still EOpNull!
0:15 Function Definition: main( (void)
0:15 Function Parameters:
0:17 Sequence
0:17 Sequence
0:17 move second child to first child (4-component vector of float)
0:17 'p' (4-component vector of float)
0:17 gl_Position: direct index for structure (4-component vector of float)
0:17 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:17 'gl_in' (in 32-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:17 Constant:
0:17 1 (const int)
0:17 Constant:
0:17 0 (const int)
0:18 Sequence
0:18 move second child to first child (float)
0:18 'ps' (float)
0:18 gl_PointSize: direct index for structure (float)
0:18 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:18 'gl_in' (in 32-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:18 Constant:
0:18 1 (const int)
0:18 Constant:
0:18 1 (const int)
0:19 Sequence
0:19 move second child to first child (float)
0:19 'cd' (float)
0:19 direct index (float)
0:19 gl_ClipDistance: direct index for structure (unsized array of float)
0:19 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:19 'gl_in' (in 32-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:19 Constant:
0:19 1 (const int)
0:19 Constant:
0:19 2 (const int)
0:19 Constant:
0:19 2 (const int)
0:21 Sequence
0:21 move second child to first child (int)
0:21 'pvi' (int)
0:21 'gl_PatchVerticesIn' (in int)
0:22 Sequence
0:22 move second child to first child (int)
0:22 'pid' (int)
0:22 'gl_PrimitiveID' (in int)
0:23 Sequence
0:23 move second child to first child (int)
0:23 'iid' (int)
0:23 'gl_InvocationID' (in int)
0:25 move second child to first child (4-component vector of float)
0:25 gl_Position: direct index for structure (4-component vector of float)
0:25 direct index (block{gl_Position})
0:25 'gl_out' (out 3-element array of block{gl_Position})
0:25 Constant:
0:25 1 (const int)
0:25 Constant:
0:25 0 (const int)
0:25 'p' (4-component vector of float)
0:26 direct index (block{gl_Position})
0:26 'gl_out' (out 3-element array of block{gl_Position})
0:26 Constant:
0:26 1 (const int)
0:? Linker Objects
0:? 'gl_out' (out 3-element array of block{gl_Position})
0:? 'a' (out 3-element array of int)
0:? 'outb' (out 5-element array of int)
0:? 'outc' (out 4-element array of int)
Linked tessellation control stage:
vertices = 4

View File

@@ -163,7 +163,7 @@ ERROR: node is still EOpNull!
Linked tessellation evaluation stage:
ERROR: Linking tessellation evaluation stage: At least one tessellation shader must specify an input layout primitive
ERROR: Linking tessellation evaluation stage: At least one shader must specify an input layout primitive
input primitive = none
vertex spacing = equal_spacing

View File

@@ -0,0 +1,49 @@
420_size_gl_in.geom
Warning, version 420 is not yet complete; some version-specific features are present, but many are missing.
ERROR: 0:19: 'gl_PerVertex' : can only redeclare a built-in block once, and before any use
ERROR: 1 compilation errors. No code generated.
invocations = 0
max_vertices = 0
input primitive = triangles
output primitive = none
ERROR: node is still EOpNull!
0:11 Function Definition: foo( (void)
0:11 Function Parameters:
0:13 Sequence
0:13 Constant:
0:13 3 (const int)
0:14 gl_Position: direct index for structure (4-component vector of float)
0:14 direct index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:14 'gl_in' (in 3-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:14 Constant:
0:14 1 (const int)
0:14 Constant:
0:14 0 (const int)
0:15 Constant:
0:15 3 (const int)
0:16 gl_Position: direct index for structure (4-component vector of float)
0:16 indirect index (block{gl_Position,gl_PointSize,gl_ClipDistance})
0:16 'gl_in' (in 3-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
0:16 'i' (int)
0:16 Constant:
0:16 0 (const int)
0:? Linker Objects
0:? 'i' (int)
0:? 'colorun' (in 3-element array of 4-component vector of float)
0:? 'color3' (in 3-element array of 4-component vector of float)
0:? 'gl_in' (in 3-element array of block{gl_Position,gl_PointSize,gl_ClipDistance})
Linked geometry stage:
ERROR: Linking geometry stage: Missing entry point: Each stage requires one "void main()" entry point
ERROR: Linking geometry stage: At least one shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
invocations = 0
max_vertices = 0
input primitive = triangles
output primitive = none

View File

@@ -44,8 +44,8 @@ Linked geometry stage:
ERROR: Linking geometry stage: Contradictory output layout primitives
ERROR: Linking geometry stage: Missing entry point: Each stage requires one "void main()" entry point
ERROR: Linking geometry stage: At least one geometry shader must specify an input layout primitive
ERROR: Linking geometry stage: At least one geometry shader must specify a layout(max_vertices = value)
ERROR: Linking geometry stage: At least one shader must specify an input layout primitive
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
Linked fragment stage:

View File

@@ -49,7 +49,9 @@ tokenLength.vert
300scope.vert
400.frag
420.vert
420.tesc
420.geom
420_size_gl_in.geom
430scope.vert
lineContinuation100.vert
lineContinuation.vert
@@ -58,6 +60,7 @@ numeral.frag
400.tesc
400.tese
410.geom
410.tesc
420.tese
430.vert
430.comp