mirror of
https://github.com/libretro/glslang.git
synced 2024-11-27 18:00:49 +00:00
glslang parser: Fix crash for ES shader with a uniform block with an unsized array that is later accessed. David Neto (dneto@google.com).
Instead of crashing, exit early from the implicit-sized-array-size-update routine so we can get to a real error message which is emitted later. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31109 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
1cfc71b73e
commit
bb8c3de8b3
8
Test/310implicitSizeArrayError.vert
Normal file
8
Test/310implicitSizeArrayError.vert
Normal file
@ -0,0 +1,8 @@
|
||||
#version 310 es
|
||||
layout (location=0) uniform Block {
|
||||
highp int a[];
|
||||
} uni;
|
||||
layout (location=0) out highp int o;
|
||||
void main() {
|
||||
o = uni.a[2];
|
||||
}
|
50
Test/baseResults/310implicitSizeArrayError.vert.out
Normal file
50
Test/baseResults/310implicitSizeArrayError.vert.out
Normal file
@ -0,0 +1,50 @@
|
||||
310implicitSizeArrayError.vert
|
||||
Warning, version 310 is not yet complete; most version-specific features are present, but some are missing.
|
||||
ERROR: 0:3: 'implicitly-sized array in a block' : not supported with this profile: es
|
||||
ERROR: 1 compilation errors. No code generated.
|
||||
|
||||
|
||||
Shader version: 310
|
||||
ERROR: node is still EOpNull!
|
||||
0:6 Function Definition: main( (global void)
|
||||
0:6 Function Parameters:
|
||||
0:7 Sequence
|
||||
0:7 move second child to first child (temp highp int)
|
||||
0:7 'o' (layout(location=0 ) smooth out highp int)
|
||||
0:7 direct index (layout(column_major shared ) temp highp int)
|
||||
0:7 a: direct index for structure (layout(column_major shared ) uniform implicitly-sized array of highp int)
|
||||
0:7 'uni' (layout(location=0 column_major shared ) uniform block{layout(column_major shared ) uniform implicitly-sized array of highp int a})
|
||||
0:7 Constant:
|
||||
0:7 0 (const int)
|
||||
0:7 Constant:
|
||||
0:7 2 (const int)
|
||||
0:? Linker Objects
|
||||
0:? 'uni' (layout(location=0 column_major shared ) uniform block{layout(column_major shared ) uniform implicitly-sized array of highp int a})
|
||||
0:? 'o' (layout(location=0 ) smooth out highp int)
|
||||
0:? 'gl_VertexID' (gl_VertexId highp int)
|
||||
0:? 'gl_InstanceID' (gl_InstanceId highp int)
|
||||
|
||||
|
||||
Linked vertex stage:
|
||||
|
||||
|
||||
Shader version: 310
|
||||
ERROR: node is still EOpNull!
|
||||
0:6 Function Definition: main( (global void)
|
||||
0:6 Function Parameters:
|
||||
0:7 Sequence
|
||||
0:7 move second child to first child (temp highp int)
|
||||
0:7 'o' (layout(location=0 ) smooth out highp int)
|
||||
0:7 direct index (layout(column_major shared ) temp highp int)
|
||||
0:7 a: direct index for structure (layout(column_major shared ) uniform 1-element array of highp int)
|
||||
0:7 'uni' (layout(location=0 column_major shared ) uniform block{layout(column_major shared ) uniform 1-element array of highp int a})
|
||||
0:7 Constant:
|
||||
0:7 0 (const int)
|
||||
0:7 Constant:
|
||||
0:7 2 (const int)
|
||||
0:? Linker Objects
|
||||
0:? 'uni' (layout(location=0 column_major shared ) uniform block{layout(column_major shared ) uniform 1-element array of highp int a})
|
||||
0:? 'o' (layout(location=0 ) smooth out highp int)
|
||||
0:? 'gl_VertexID' (gl_VertexId highp int)
|
||||
0:? 'gl_InstanceID' (gl_InstanceId highp int)
|
||||
|
@ -36,12 +36,13 @@ comment.frag
|
||||
300layout.frag
|
||||
300operations.frag
|
||||
300block.frag
|
||||
310.comp
|
||||
310.vert
|
||||
310.frag
|
||||
330.frag
|
||||
330comp.frag
|
||||
constErrors.frag
|
||||
310.comp
|
||||
310.vert
|
||||
310.frag
|
||||
310implicitSizeArrayError.vert
|
||||
330.frag
|
||||
330comp.frag
|
||||
constErrors.frag
|
||||
constFold.frag
|
||||
errors.frag
|
||||
forwardRef.frag
|
||||
|
@ -2551,7 +2551,10 @@ void TParseContext::updateImplicitArraySize(TSourceLoc loc, TIntermNode *node, i
|
||||
else if (node->getAsBinaryNode()) {
|
||||
const TIntermBinary* deref = node->getAsBinaryNode();
|
||||
// This has to be the result of a block dereference, unless it's bad shader code
|
||||
// If it's a uniform block, then an error will be issued elsewhere, but
|
||||
// return early now to avoid crashing later in this function.
|
||||
if (! deref->getLeft()->getAsSymbolNode() || deref->getLeft()->getBasicType() != EbtBlock ||
|
||||
deref->getLeft()->getType().getQualifier().storage == EvqUniform ||
|
||||
deref->getRight()->getAsConstantUnion() == 0)
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user