diff --git a/Test/450.geom b/Test/450.geom index af6768137860548e83c053dd1a1e56abf443b57e..83d99aa6277540301ff19489668dbb06677fcf13 100644 --- a/Test/450.geom +++ b/Test/450.geom @@ -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]; } diff --git a/Test/baseResults/450.geom.out b/Test/baseResults/450.geom.out index 5e6c88f9d19b470b8a7b781c73f3b10998e3f467..8d313c8dfc6b7a917b25efc50833afdbf0cc9781 100644 --- a/Test/baseResults/450.geom.out +++ b/Test/baseResults/450.geom.out @@ -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}) diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index c53275c5d9cabb509393b076e53e87f47c54000a..175e4888f9fe9966515d5b034b7dc9602bb4b538 100644 --- a/glslang/Include/revision.h +++ b/glslang/Include/revision.h @@ -2,5 +2,5 @@ // For the version, it uses the latest git tag followed by the number of commits. // For the date, it uses the current date (when then script is run). -#define GLSLANG_REVISION "Overload400-PrecQual.1958" -#define GLSLANG_DATE "31-Mar-2017" +#define GLSLANG_REVISION "Overload400-PrecQual.1965" +#define GLSLANG_DATE "03-Apr-2017" diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index ccd5bf7ac6a9dce9e6c7ee348f80ca8131b0c7ed..bc439861478c58cd62fae42f2c6854063ed81754 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -342,10 +342,8 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn TIntermTyped* result = nullptr; int indexValue = 0; - if (index->getQualifier().isFrontEndConstant()) { + if (index->getQualifier().isFrontEndConstant()) indexValue = index->getAsConstantUnion()->getConstArray()[0].getIConst(); - checkIndex(loc, base->getType(), indexValue); - } variableCheck(base); if (! base->isArray() && ! base->isMatrix() && ! base->isVector()) { @@ -353,10 +351,12 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn error(loc, " left of '[' is not of type array, matrix, or vector ", base->getAsSymbolNode()->getName().c_str(), ""); else error(loc, " left of '[' is not of type array, matrix, or vector ", "expression", ""); - } else if (base->getType().getQualifier().isFrontEndConstant() && index->getQualifier().isFrontEndConstant()) + } else if (base->getType().getQualifier().isFrontEndConstant() && index->getQualifier().isFrontEndConstant()) { + // both base and index are front-end constants + checkIndex(loc, base->getType(), indexValue); return intermediate.foldDereference(base, indexValue, loc); - else { - // at least one of base and index is variable... + } else { + // at least one of base and index is not a front-end constant variable... if (base->getAsSymbolNode() && isIoResizeArray(base->getType())) handleIoResizeArrayAccess(loc, base); @@ -364,6 +364,8 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn if (index->getQualifier().isFrontEndConstant()) { if (base->getType().isImplicitlySizedArray()) updateImplicitArraySize(loc, base, indexValue); + else + checkIndex(loc, base->getType(), indexValue); result = intermediate.addIndex(EOpIndexDirect, base, index, loc); } else { if (base->getType().isImplicitlySizedArray()) {