Fix #287: pin down the io-array size before checking for out of range index.

This commit is contained in:
John Kessenich
2017-04-03 14:29:20 -06:00
parent 6f03bfc733
commit 2184c2f21a
4 changed files with 73 additions and 57 deletions

View File

@@ -8,7 +8,10 @@ out gl_PerVertex {
float gl_CullDistance[3];
};
layout(triangles) in;
void main()
{
gl_in[3].gl_Position; // ERROR, out of range
gl_CullDistance[2] = gl_in[1].gl_CullDistance[2];
}

View File

@@ -1,72 +1,83 @@
450.geom
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
ERROR: 0:15: '[' : array index out of range '3'
ERROR: 0:15: 'gl_Position' : no such field in structure
ERROR: 2 compilation errors. No code generated.
Shader version: 450
invocations = -1
max_vertices = -1
input primitive = none
input primitive = triangles
output primitive = none
0:? Sequence
0:11 Function Definition: main( ( global void)
0:11 Function Parameters:
0:13 Sequence
0:13 move second child to first child ( temp float)
0:13 direct index (layout( stream=0) temp float CullDistance)
0:13 gl_CullDistance: direct index for structure (layout( stream=0) out 3-element array of float CullDistance)
0:13 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-element array of float CullDistance gl_CullDistance})
0:13 Constant:
0:13 3 (const uint)
0:13 Constant:
0:13 2 (const int)
0:13 direct index ( temp float CullDistance)
0:13 gl_CullDistance: direct index for structure ( in 3-element array of float CullDistance)
0:13 direct index ( temp block{ in 3-element array of float CullDistance gl_CullDistance})
0:13 'gl_in' ( in implicitly-sized array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:13 Constant:
0:13 1 (const int)
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 2 (const int)
ERROR: node is still EOpNull!
0:13 Function Definition: main( ( global void)
0:13 Function Parameters:
0:15 Sequence
0:15 direct index ( temp block{ in 3-element array of float CullDistance gl_CullDistance})
0:15 'gl_in' ( in 3-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:15 Constant:
0:15 3 (const int)
0:16 move second child to first child ( temp float)
0:16 direct index (layout( stream=0) temp float CullDistance)
0:16 gl_CullDistance: direct index for structure (layout( stream=0) out 3-element array of float CullDistance)
0:16 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-element array of float CullDistance gl_CullDistance})
0:16 Constant:
0:16 3 (const uint)
0:16 Constant:
0:16 2 (const int)
0:16 direct index ( temp float CullDistance)
0:16 gl_CullDistance: direct index for structure ( in 3-element array of float CullDistance)
0:16 direct index ( temp block{ in 3-element array of float CullDistance gl_CullDistance})
0:16 'gl_in' ( in 3-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:16 Constant:
0:16 1 (const int)
0:16 Constant:
0:16 0 (const int)
0:16 Constant:
0:16 2 (const int)
0:? Linker Objects
0:? 'gl_in' ( in implicitly-sized array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'gl_in' ( in 3-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-element array of float CullDistance gl_CullDistance})
Linked geometry stage:
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)
Shader version: 450
invocations = 1
max_vertices = -1
input primitive = none
input primitive = triangles
output primitive = none
0:? Sequence
0:11 Function Definition: main( ( global void)
0:11 Function Parameters:
0:13 Sequence
0:13 move second child to first child ( temp float)
0:13 direct index (layout( stream=0) temp float CullDistance)
0:13 gl_CullDistance: direct index for structure (layout( stream=0) out 3-element array of float CullDistance)
0:13 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-element array of float CullDistance gl_CullDistance})
0:13 Constant:
0:13 3 (const uint)
0:13 Constant:
0:13 2 (const int)
0:13 direct index ( temp float CullDistance)
0:13 gl_CullDistance: direct index for structure ( in 3-element array of float CullDistance)
0:13 direct index ( temp block{ in 3-element array of float CullDistance gl_CullDistance})
0:13 'gl_in' ( in 2-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:13 Constant:
0:13 1 (const int)
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 2 (const int)
ERROR: node is still EOpNull!
0:13 Function Definition: main( ( global void)
0:13 Function Parameters:
0:15 Sequence
0:15 direct index ( temp block{ in 3-element array of float CullDistance gl_CullDistance})
0:15 'gl_in' ( in 3-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:15 Constant:
0:15 3 (const int)
0:16 move second child to first child ( temp float)
0:16 direct index (layout( stream=0) temp float CullDistance)
0:16 gl_CullDistance: direct index for structure (layout( stream=0) out 3-element array of float CullDistance)
0:16 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-element array of float CullDistance gl_CullDistance})
0:16 Constant:
0:16 3 (const uint)
0:16 Constant:
0:16 2 (const int)
0:16 direct index ( temp float CullDistance)
0:16 gl_CullDistance: direct index for structure ( in 3-element array of float CullDistance)
0:16 direct index ( temp block{ in 3-element array of float CullDistance gl_CullDistance})
0:16 'gl_in' ( in 3-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:16 Constant:
0:16 1 (const int)
0:16 Constant:
0:16 0 (const int)
0:16 Constant:
0:16 2 (const int)
0:? Linker Objects
0:? 'gl_in' ( in 2-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'gl_in' ( in 3-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-element array of float CullDistance gl_CullDistance})