Skip to content

Commit

Permalink
Add geometry-shader stream, invocations, max_vertices, lines, triangl…
Browse files Browse the repository at this point in the history
…es, etc. layout qualifiers, and their default/inheritance behaviors, and some other misc. geometry shader features. (Geometry shaders are not yet done though.)

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23679 e7fa87d3-cd2b-0410-9028-fcbf551c1848
  • Loading branch information
johnkslang committed Oct 23, 2013
1 parent 284231c commit 94fdd11
Show file tree
Hide file tree
Showing 24 changed files with 638 additions and 224 deletions.
54 changes: 54 additions & 0 deletions Test/150.geom
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,57 @@ void main()
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 ooutb {
layout(stream = 6) vec4 a;
} ouua6;

layout(stream = 7) out ooutb {
layout(stream = 6) vec4 a; // ERROR
} ouua7;

out vec4 ov2s3; // stream should be 3

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; }; // ERROR, not on a block
out outbn {
layout(invocations = 3) int a; // ERROR, not on a block member
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_adjancency) in;
layout(triangles) in; // ERROR, can't change it
layout(triangles_adjacency) in; // ERROR, can't change it

layout(invocations = 4, max_vertices = 127) out;

in inbn {
layout(stream = 2) int a; // ERROR, stream on input
} inbi;
3 changes: 3 additions & 0 deletions Test/400.geom
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ void main()

int id = gl_InvocationID;
}

layout(invocations = 3) out outbn { int a; }; // ERROR, not on a block
layout(max_vertices = 127, invocations = 4) out;
2 changes: 1 addition & 1 deletion Test/baseResults/100.frag.out
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ ERROR: node is still EOpNull!
0:? 'uint' (mediump int)
0:? 'v' (smooth in 3-element array of mediump 4-component vector of float)
0:? 'f' (mediump float)
0:? '__anon__0' (layout(shared ) uniform block)
0:? '__anon__0' (layout(column_major shared ) uniform block)
0:? 'fa' (unsized array of mediump float)

84 changes: 70 additions & 14 deletions Test/baseResults/150.geom.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,35 @@ ERROR: 0:19: 'fromVertex' : redefinition
ERROR: 0:21: 'fooC' : block instance name redefinition
ERROR: 0:29: 'EmitStreamVertex' : no matching overloaded function found
ERROR: 0:30: 'EndStreamPrimitive' : no matching overloaded function found
ERROR: 5 compilation errors. No code generated.
ERROR: 0:44: 'stream' : can only be used on an output
ERROR: 0:45: 'stream' : can only be used on an output
ERROR: 0:46: 'stream' : can only be used on an output
ERROR: 0:47: 'stream' : can only be used on an output
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: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
ERROR: 0:76: 'invocations' : can only apply to a standalone qualifier
ERROR: 0:78: 'invocations' : not supported for this version or the enabled extensions
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 only apply to output
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:91: 'stream' : member cannot contradict block
ERROR: 28 compilation errors. No code generated.

invocations = 4
max_vertices = 127
input primitive = lines_adjancency
output primitive = triangle_strip
ERROR: node is still EOpNull!
0:25 Function Definition: main( (void)
0:25 Function Parameters:
Expand All @@ -17,18 +44,18 @@ ERROR: node is still EOpNull!
0:30 Constant:
0:30 0.000000
0:32 move second child to first child (3-component vector of float)
0:32 color: direct index for structure (3-component vector of float)
0:32 '__anon__0' (out block)
0:32 color: direct index for structure (layout(stream=0 ) 3-component vector of float)
0:32 '__anon__0' (layout(stream=0 ) out block)
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)
0:32 Constant:
0:32 0 (const int)
0:33 move second child to first child (float)
0:33 direct index (float)
0:33 gl_ClipDistance: direct index for structure (unsized array of float)
0:33 '__anon__1' (out block)
0:33 direct index (layout(stream=0 ) float)
0:33 gl_ClipDistance: direct index for structure (layout(stream=0 ) unsized array of float)
0:33 '__anon__1' (layout(stream=0 ) out block)
0:33 Constant:
0:33 2 (const uint)
0:33 Constant:
Expand All @@ -44,8 +71,8 @@ ERROR: node is still EOpNull!
0:33 Constant:
0:33 2 (const int)
0:34 move second child to first child (4-component vector of float)
0:34 gl_Position: direct index for structure (4-component vector of float)
0:34 '__anon__1' (out block)
0:34 gl_Position: direct index for structure (layout(stream=0 ) 4-component vector of float)
0:34 '__anon__1' (layout(stream=0 ) out block)
0:34 Constant:
0:34 0 (const uint)
0:34 gl_Position: direct index for structure (4-component vector of float)
Expand All @@ -56,8 +83,8 @@ ERROR: node is still EOpNull!
0:34 Constant:
0:34 0 (const int)
0:35 move second child to first child (float)
0:35 gl_PointSize: direct index for structure (float)
0:35 '__anon__1' (out block)
0:35 gl_PointSize: direct index for structure (layout(stream=0 ) float)
0:35 '__anon__1' (layout(stream=0 ) out block)
0:35 Constant:
0:35 1 (const uint)
0:35 gl_PointSize: direct index for structure (float)
Expand All @@ -68,14 +95,43 @@ ERROR: node is still EOpNull!
0:35 Constant:
0:35 1 (const int)
0:36 move second child to first child (int)
0:36 'gl_PrimitiveID' (out int)
0:36 'gl_PrimitiveID' (layout(stream=0 ) out int)
0:36 'gl_PrimitiveIDIn' (in int)
0:37 move second child to first child (int)
0:37 'gl_Layer' (out int)
0:37 'gl_Layer' (layout(stream=0 ) out int)
0:37 Constant:
0:37 2 (const int)
0:65 Function Definition: foo(i1; (void)
0:65 Function Parameters:
0:65 'a' (in int)
0:67 Sequence
0:67 move second child to first child (4-component vector of float)
0:67 a: direct index for structure (layout(stream=6 ) 4-component vector of float)
0:67 'ouuaa6' (layout(stream=6 ) out block)
0:67 Constant:
0:67 0 (const int)
0:67 Constant:
0:67 1.000000
0:67 1.000000
0:67 1.000000
0:67 1.000000
0:? Linker Objects
0:? 'fromV' (in block)
0:? 'toF' (out block)
0:? '__anon__0' (out block)
0:? 'toF' (layout(stream=0 ) out block)
0:? '__anon__0' (layout(stream=0 ) out block)
0:? 'ov0' (layout(stream=0 ) out 4-component vector of float)
0:? 'ov4' (layout(stream=4 ) out 4-component vector of float)
0:? 'o1v0' (layout(stream=0 ) out 4-component vector of float)
0:? 'ua' (layout(stream=3 ) uniform int)
0:? 'ibb' (layout(stream=3 column_major shared ) uniform block)
0:? 'ov3' (layout(stream=3 ) out 4-component vector of float)
0:? 'ouuaa6' (layout(stream=6 ) out block)
0:? 'ouua6' (layout(stream=6 ) out block)
0:? 'ouua7' (layout(stream=7 ) out block)
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:? '__anon__1' (layout(stream=3 ) out block)
0:? 'outbi' (layout(stream=3 ) out block)
0:? 'inbi' (in block)

2 changes: 1 addition & 1 deletion Test/baseResults/150.vert.out
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ERROR: node is still EOpNull!
0:? Linker Objects
0:? 'iv4' (in 4-component vector of float)
0:? 'ps' (uniform float)
0:? '__anon__1' (layout(shared ) uniform block)
0:? '__anon__1' (layout(column_major shared ) uniform block)
0:? 'gl_VertexID' (gl_VertexId int)
0:? 'gl_InstanceID' (gl_InstanceId int)

2 changes: 1 addition & 1 deletion Test/baseResults/300.frag.out
Original file line number Diff line number Diff line change
Expand Up @@ -239,5 +239,5 @@ ERROR: node is still EOpNull!
0:? 'sc' (out lowp 3-component vector of float)
0:? 'sf' (out lowp float)
0:? 'arrayedSampler' (uniform 5-element array of lowp sampler2D)
0:? 'multiInst' (layout(shared ) uniform 2-element array of block)
0:? 'multiInst' (layout(column_major shared ) uniform 2-element array of block)

2 changes: 1 addition & 1 deletion Test/baseResults/300.vert.out
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ ERROR: node is still EOpNull!
0:? 's' (smooth out structure)
0:? 'badsize' (unsized array of highp float)
0:? 'badsize2' (unsized array of highp float)
0:? 'ubInst' (layout(shared ) uniform unsized array of block)
0:? 'ubInst' (layout(column_major shared ) uniform unsized array of block)
0:? 'okayA' (2-element array of highp float)
0:? 'gl_VertexID' (gl_VertexId highp int)
0:? 'gl_InstanceID' (gl_InstanceId highp int)
Expand Down
20 changes: 10 additions & 10 deletions Test/baseResults/300block.frag.out
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@ ERROR: node is still EOpNull!
0:44 Construct vec3 (3-component vector of float)
0:44 Convert int to float (float)
0:44 ni: direct index for structure (layout(column_major shared ) mediump int)
0:44 'inst' (layout(shared ) uniform block)
0:44 'inst' (layout(column_major shared ) uniform block)
0:44 Constant:
0:44 1 (const int)
0:44 Convert uint to float (float)
0:44 direct index (mediump uint)
0:44 bv: direct index for structure (layout(column_major shared ) mediump 4-component vector of uint)
0:44 '__anon__0' (layout(shared ) uniform block)
0:44 '__anon__0' (layout(column_major shared ) uniform block)
0:44 Constant:
0:44 0 (const uint)
0:44 Constant:
0:44 1 (const int)
0:44 Convert uint to float (float)
0:44 direct index (mediump uint)
0:44 nbv: direct index for structure (layout(column_major shared ) mediump 4-component vector of uint)
0:44 direct index (layout(shared ) uniform block)
0:44 'insts' (layout(shared ) uniform 4-element array of block)
0:44 direct index (layout(column_major shared ) uniform block)
0:44 'insts' (layout(column_major shared ) uniform 4-element array of block)
0:44 Constant:
0:44 2 (const int)
0:44 Constant:
0:44 0 (const int)
0:44 Constant:
0:44 2 (const int)
0:45 indirect index (layout(shared ) uniform block)
0:45 'insts' (layout(shared ) uniform 4-element array of block)
0:45 indirect index (layout(column_major shared ) uniform block)
0:45 'insts' (layout(column_major shared ) uniform 4-element array of block)
0:45 direct index (mediump uint)
0:45 v: direct index for structure (mediump 4-component vector of uint)
0:45 's' (uniform structure)
Expand All @@ -49,8 +49,8 @@ ERROR: node is still EOpNull!
0:45 0 (const int)
0:? Linker Objects
0:? 's' (uniform structure)
0:? '__anon__0' (layout(shared ) uniform block)
0:? 'inst' (layout(shared ) uniform block)
0:? 'insts' (layout(shared ) uniform 4-element array of block)
0:? '__anon__1' (layout(shared ) uniform block)
0:? '__anon__0' (layout(column_major shared ) uniform block)
0:? 'inst' (layout(column_major shared ) uniform block)
0:? 'insts' (layout(column_major shared ) uniform 4-element array of block)
0:? '__anon__1' (layout(column_major shared ) uniform block)

12 changes: 6 additions & 6 deletions Test/baseResults/300layout.vert.out
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ ERROR: node is still EOpNull!
0:43 add (highp 4X4 matrix of float)
0:43 add (highp 4X4 matrix of float)
0:43 M1: direct index for structure (layout(row_major std140 ) highp 4X4 matrix of float)
0:43 'tblock' (layout(std140 ) uniform block)
0:43 'tblock' (layout(row_major std140 ) uniform block)
0:43 Constant:
0:43 0 (const int)
0:43 M2: direct index for structure (layout(column_major std140 ) highp 4X4 matrix of float)
0:43 'tblock' (layout(std140 ) uniform block)
0:43 'tblock' (layout(row_major std140 ) uniform block)
0:43 Constant:
0:43 1 (const int)
0:43 M4: direct index for structure (layout(row_major shared ) highp 4X4 matrix of float)
Expand All @@ -41,15 +41,15 @@ ERROR: node is still EOpNull!
0:43 Constant:
0:43 0 (const uint)
0:43 t2m: direct index for structure (layout(row_major shared ) highp 4X4 matrix of float)
0:43 '__anon__0' (layout(shared ) uniform block)
0:43 '__anon__0' (layout(row_major shared ) uniform block)
0:43 Constant:
0:43 1 (const uint)
0:44 move second child to first child (highp 3-component vector of float)
0:44 'color' (smooth out highp 3-component vector of float)
0:44 vector-times-matrix (highp 3-component vector of float)
0:44 'c' (layout(location=7 ) in highp 3-component vector of float)
0:44 N1: direct index for structure (layout(row_major std140 ) highp 3X3 matrix of float)
0:44 'tblock' (layout(std140 ) uniform block)
0:44 'tblock' (layout(row_major std140 ) uniform block)
0:44 Constant:
0:44 2 (const int)
0:? Linker Objects
Expand All @@ -60,8 +60,8 @@ ERROR: node is still EOpNull!
0:? 'pos' (smooth out highp 4-component vector of float)
0:? 'color' (smooth out highp 3-component vector of float)
0:? 'badm4' (layout(column_major shared ) uniform highp 4X4 matrix of float)
0:? 'tblock' (layout(std140 ) uniform block)
0:? '__anon__0' (layout(shared ) uniform block)
0:? 'tblock' (layout(row_major std140 ) uniform block)
0:? '__anon__0' (layout(row_major shared ) uniform block)
0:? '__anon__2' (out block)
0:? 'badoutA' (layout(location=10 ) smooth out highp 4-component vector of float)
0:? 'compute_only' (shared highp 4-component vector of float)
Expand Down
Loading

0 comments on commit 94fdd11

Please sign in to comment.