diff --git a/Test/300.vert b/Test/300.vert index 6270c1d5..83b9bb11 100644 --- a/Test/300.vert +++ b/Test/300.vert @@ -174,3 +174,14 @@ layout(std430) uniform B430 { int a; } B430i; // ERROR struct SNA { int a[]; // ERROR }; + +void fooDeeparray() +{ + float[] x = float[] (1.0, 2.0, 3.0), + y = float[] (1.0, 2.0, 3.0, 4.0); + float xp[3], yp[4]; + xp = x; + yp = y; + xp = y; // ERROR, wrong size + yp = x; // ERROR, wrong size +} diff --git a/Test/baseResults/300.vert.out b/Test/baseResults/300.vert.out index d3d7cba3..6f3fdadc 100644 --- a/Test/baseResults/300.vert.out +++ b/Test/baseResults/300.vert.out @@ -41,7 +41,9 @@ ERROR: 0:170: 'Bfoo' : cannot add storage, auxiliary, memory, interpolation, lay ERROR: 0:172: 'std430' : not supported for this version or the enabled extensions ERROR: 0:172: 'std430 on a uniform block' : not supported with this profile: es ERROR: 0:175: '' : array size required -ERROR: 42 compilation errors. No code generated. +ERROR: 0:185: 'assign' : cannot convert from 'temp 4-element array of highp float' to 'temp 3-element array of highp float' +ERROR: 0:186: 'assign' : cannot convert from 'temp 3-element array of highp float' to 'temp 4-element array of highp float' +ERROR: 44 compilation errors. No code generated. Shader version: 300 @@ -262,6 +264,31 @@ ERROR: node is still EOpNull! 0:158 Branch: Return with expression 0:158 Constant: 0:158 2 (const int) +0:178 Function Definition: fooDeeparray( (global void) +0:178 Function Parameters: +0:181 Sequence +0:181 Sequence +0:180 move second child to first child (temp 3-element array of highp float) +0:180 'x' (temp 3-element array of highp float) +0:180 Constant: +0:180 1.000000 +0:180 2.000000 +0:180 3.000000 +0:181 move second child to first child (temp 4-element array of highp float) +0:181 'y' (temp 4-element array of highp float) +0:181 Constant: +0:181 1.000000 +0:181 2.000000 +0:181 3.000000 +0:181 4.000000 +0:183 move second child to first child (temp 3-element array of highp float) +0:183 'xp' (temp 3-element array of highp float) +0:183 'x' (temp 3-element array of highp float) +0:184 move second child to first child (temp 4-element array of highp float) +0:184 'yp' (temp 4-element array of highp float) +0:184 'y' (temp 4-element array of highp float) +0:185 'xp' (temp 3-element array of highp float) +0:186 'yp' (temp 4-element array of highp float) 0:? Linker Objects 0:? 'm43' (uniform highp 4X3 matrix of float) 0:? 'm33' (uniform highp 3X3 matrix of float) @@ -521,6 +548,31 @@ ERROR: node is still EOpNull! 0:158 Branch: Return with expression 0:158 Constant: 0:158 2 (const int) +0:178 Function Definition: fooDeeparray( (global void) +0:178 Function Parameters: +0:181 Sequence +0:181 Sequence +0:180 move second child to first child (temp 3-element array of highp float) +0:180 'x' (temp 3-element array of highp float) +0:180 Constant: +0:180 1.000000 +0:180 2.000000 +0:180 3.000000 +0:181 move second child to first child (temp 4-element array of highp float) +0:181 'y' (temp 4-element array of highp float) +0:181 Constant: +0:181 1.000000 +0:181 2.000000 +0:181 3.000000 +0:181 4.000000 +0:183 move second child to first child (temp 3-element array of highp float) +0:183 'xp' (temp 3-element array of highp float) +0:183 'x' (temp 3-element array of highp float) +0:184 move second child to first child (temp 4-element array of highp float) +0:184 'yp' (temp 4-element array of highp float) +0:184 'y' (temp 4-element array of highp float) +0:185 'xp' (temp 3-element array of highp float) +0:186 'yp' (temp 4-element array of highp float) 0:? Linker Objects 0:? 'm43' (uniform highp 4X3 matrix of float) 0:? 'm33' (uniform highp 3X3 matrix of float) diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h index e9433699..ec179439 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -930,7 +930,7 @@ public: qualifier.precision = p; assert(p >= 0 && p <= EpqHigh); } - // for turning a TPublicType into a TType + // for turning a TPublicType into a TType, using a shallow copy explicit TType(const TPublicType& p) : basicType(p.basicType), vectorSize(p.vectorSize), matrixCols(p.matrixCols), matrixRows(p.matrixRows), arraySizes(p.arraySizes), structure(nullptr), fieldName(nullptr), typeName(nullptr) diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index 0a7786d4..7f6f6774 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 "SPIRV99.798" -#define GLSLANG_DATE "16-Nov-2015" +#define GLSLANG_REVISION "SPIRV99.807" +#define GLSLANG_DATE "28-Nov-2015" diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 96e18f63..6d50cbe6 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -4447,7 +4447,13 @@ void TParseContext::declareTypeDefaults(const TSourceLoc& loc, const TPublicType // TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& identifier, const TPublicType& publicType, TArraySizes* arraySizes, TIntermTyped* initializer) { - TType type(publicType); + TType type(publicType); // shallow copy; 'type' shares the arrayness and structure definition with 'publicType' + if (type.isImplicitlySizedArray()) { + // Because "int[] a = int[2](...), b = int[3](...)" makes two arrays a and b + // of different sizes, for this case sharing the shallow copy of arrayness + // with the publicType oversubscribes it, so get a deep copy of the arrayness. + type.newArraySizes(*publicType.arraySizes); + } if (voidErrorCheck(loc, identifier, type.getBasicType())) return nullptr;