diff --git a/Test/310AofA.vert b/Test/310AofA.vert new file mode 100644 index 0000000000000000000000000000000000000000..eb68d8937ea71e81e4546d1581e317d807ea65c0 --- /dev/null +++ b/Test/310AofA.vert @@ -0,0 +1,14 @@ +#version 310 es + +// Check name mangling of functions with parameters that are multi-dimensional arrays. + +#define NX 2 +#define NY 3 +#define NZ 4 +void f(bool a, float b, uint[4] c, int[NY][NX] d) { +} + +void main() { + int[NY][NX] d; + f(false, 12.1, uint[NZ](uint(0),uint(1),uint(1),uint(2)), d); +} diff --git a/Test/baseResults/120.vert.out b/Test/baseResults/120.vert.out index a5b1638bf80c562b07f050fa7d1d01db459d861d..6cc6fa3153a5c487cca2b6c6cf58d5f47b74b6be 100644 --- a/Test/baseResults/120.vert.out +++ b/Test/baseResults/120.vert.out @@ -24,11 +24,11 @@ ERROR: 0:39: 'arrays of arrays' : not supported with this profile: none ERROR: 0:40: 'arrays of arrays' : not supported with this profile: none ERROR: 0:40: 'constructor' : array constructor needs one argument per array element ERROR: 0:40: 'arrays of arrays' : not supported with this profile: none -ERROR: 0:40: '=' : cannot convert from 'const float' to 'temp 2-element array of float' +ERROR: 0:40: '=' : cannot convert from 'const float' to 'temp 2-element array of 3-element array of float' ERROR: 0:41: 'arrays of arrays' : not supported with this profile: none ERROR: 0:41: 'constructor' : array constructor needs one argument per array element ERROR: 0:41: 'arrays of arrays' : not supported with this profile: none -ERROR: 0:41: '=' : cannot convert from 'const float' to 'temp 2-element array of float' +ERROR: 0:41: '=' : cannot convert from 'const float' to 'temp 2-element array of 3-element array of float' ERROR: 0:50: 'arrays of arrays' : not supported with this profile: none ERROR: 0:51: 'arrays of arrays' : not supported with this profile: none ERROR: 0:52: 'arrays of arrays' : not supported with this profile: none diff --git a/Test/baseResults/300.frag.out b/Test/baseResults/300.frag.out index 02d5836d47a9ce9146e2e14af66ef474fd124bfc..1c0d0fafca3f48518f212fef0d8bf2d4a4de061b 100644 --- a/Test/baseResults/300.frag.out +++ b/Test/baseResults/300.frag.out @@ -389,7 +389,7 @@ 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(column_major shared ) uniform 2-element array of block{layout(column_major shared ) uniform 2-element array of mediump int a, layout(column_major shared ) uniform 2-element array of mediump int b, layout(column_major shared ) uniform 2-element array of mediump int c}) +0:? 'multiInst' (layout(column_major shared ) uniform 2-element array of 3-element array of block{layout(column_major shared ) uniform 2-element array of mediump int a, layout(column_major shared ) uniform 2-element array of 3-element array of mediump int b, layout(column_major shared ) uniform 2-element array of 3-element array of mediump int c}) 0:? 'colors' (out 4-element array of lowp 4-component vector of float) 0:? 'st1' (uniform structure{global mediump int i, global lowp sampler2D s}) 0:? 'st2' (uniform structure{global mediump int i, global lowp sampler2D s}) @@ -745,7 +745,7 @@ 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(column_major shared ) uniform 2-element array of block{layout(column_major shared ) uniform 2-element array of mediump int a, layout(column_major shared ) uniform 2-element array of mediump int b, layout(column_major shared ) uniform 2-element array of mediump int c}) +0:? 'multiInst' (layout(column_major shared ) uniform 2-element array of 3-element array of block{layout(column_major shared ) uniform 2-element array of mediump int a, layout(column_major shared ) uniform 2-element array of 3-element array of mediump int b, layout(column_major shared ) uniform 2-element array of 3-element array of mediump int c}) 0:? 'colors' (out 4-element array of lowp 4-component vector of float) 0:? 'st1' (uniform structure{global mediump int i, global lowp sampler2D s}) 0:? 'st2' (uniform structure{global mediump int i, global lowp sampler2D s}) diff --git a/Test/baseResults/310.frag.out b/Test/baseResults/310.frag.out index cba86bb0ff72a516b1622c5399d63d1ccf87c880..eeac76d074337b46ea8a45f68abf6396e9c37e7e 100644 --- a/Test/baseResults/310.frag.out +++ b/Test/baseResults/310.frag.out @@ -294,7 +294,7 @@ ERROR: node is still EOpNull! 0:? 'inb' (smooth in bool) 0:? 'ino' (smooth in highp sampler2D) 0:? 'ina' (smooth in 4-element array of mediump float) -0:? 'inaa' (smooth in 4-element array of mediump float) +0:? 'inaa' (smooth in 4-element array of 2-element array of mediump float) 0:? 'ins' (smooth in structure{global mediump float f}) 0:? 'inasa' (smooth in 4-element array of structure{global mediump float f}) 0:? 'insa' (smooth in 4-element array of structure{global mediump float f}) @@ -556,7 +556,7 @@ ERROR: node is still EOpNull! 0:? 'inb' (smooth in bool) 0:? 'ino' (smooth in highp sampler2D) 0:? 'ina' (smooth in 4-element array of mediump float) -0:? 'inaa' (smooth in 4-element array of mediump float) +0:? 'inaa' (smooth in 4-element array of 2-element array of mediump float) 0:? 'ins' (smooth in structure{global mediump float f}) 0:? 'inasa' (smooth in 4-element array of structure{global mediump float f}) 0:? 'insa' (smooth in 4-element array of structure{global mediump float f}) diff --git a/Test/baseResults/310.vert.out b/Test/baseResults/310.vert.out index 8f3b68216db41d0b4c272f7b2809fda4d379b364..5bc03f74f5a2a7878992f36e5f4ccf50a1153107 100644 --- a/Test/baseResults/310.vert.out +++ b/Test/baseResults/310.vert.out @@ -179,7 +179,7 @@ ERROR: node is still EOpNull! 0:? 'outb' (smooth out bool) 0:? 'outo' (smooth out highp sampler2D) 0:? 'outa' (smooth out 4-element array of highp float) -0:? 'outaa' (smooth out 4-element array of highp float) +0:? 'outaa' (smooth out 4-element array of 2-element array of highp float) 0:? 'outs' (smooth out structure{global highp float f}) 0:? 'outasa' (smooth out 4-element array of structure{global highp float f}) 0:? 'outsa' (smooth out 4-element array of structure{global highp float f}) @@ -354,7 +354,7 @@ ERROR: node is still EOpNull! 0:? 'outb' (smooth out bool) 0:? 'outo' (smooth out highp sampler2D) 0:? 'outa' (smooth out 4-element array of highp float) -0:? 'outaa' (smooth out 4-element array of highp float) +0:? 'outaa' (smooth out 4-element array of 2-element array of highp float) 0:? 'outs' (smooth out structure{global highp float f}) 0:? 'outasa' (smooth out 4-element array of structure{global highp float f}) 0:? 'outsa' (smooth out 4-element array of structure{global highp float f}) diff --git a/Test/baseResults/310AofA.vert.out b/Test/baseResults/310AofA.vert.out new file mode 100644 index 0000000000000000000000000000000000000000..ef63fd2d8ca5a82bc50d904399ef9f9432573809 --- /dev/null +++ b/Test/baseResults/310AofA.vert.out @@ -0,0 +1,59 @@ +310mangle.vert +Warning, version 310 is not yet complete; most version-specific features are present, but some are missing. + +Shader version: 310 +0:? Sequence +0:8 Function Definition: f(b1;f1;u1[4];i1[3][2]; (global void) +0:8 Function Parameters: +0:8 'a' (in bool) +0:8 'b' (in highp float) +0:8 'c' (in 4-element array of highp uint) +0:8 'd' (in 3-element array of 2-element array of highp int) +0:11 Function Definition: main( (global void) +0:11 Function Parameters: +0:? Sequence +0:13 Function Call: f(b1;f1;u1[4];i1[3][2]; (global void) +0:13 Constant: +0:13 false (const bool) +0:13 Constant: +0:13 12.100000 +0:13 Constant: +0:13 0 (const uint) +0:13 1 (const uint) +0:13 1 (const uint) +0:13 2 (const uint) +0:13 'd' (temp 3-element array of 2-element array of highp int) +0:? Linker Objects +0:? 'gl_VertexID' (gl_VertexId highp int) +0:? 'gl_InstanceID' (gl_InstanceId highp int) + + +Linked vertex stage: + + +Shader version: 310 +0:? Sequence +0:8 Function Definition: f(b1;f1;u1[4];i1[3][2]; (global void) +0:8 Function Parameters: +0:8 'a' (in bool) +0:8 'b' (in highp float) +0:8 'c' (in 4-element array of highp uint) +0:8 'd' (in 3-element array of 2-element array of highp int) +0:11 Function Definition: main( (global void) +0:11 Function Parameters: +0:? Sequence +0:13 Function Call: f(b1;f1;u1[4];i1[3][2]; (global void) +0:13 Constant: +0:13 false (const bool) +0:13 Constant: +0:13 12.100000 +0:13 Constant: +0:13 0 (const uint) +0:13 1 (const uint) +0:13 1 (const uint) +0:13 2 (const uint) +0:13 'd' (temp 3-element array of 2-element array of highp int) +0:? Linker Objects +0:? 'gl_VertexID' (gl_VertexId highp int) +0:? 'gl_InstanceID' (gl_InstanceId highp int) + diff --git a/Test/baseResults/450.vert.out b/Test/baseResults/450.vert.out index 529836095913e34584ac30552038d97c1faa8333..09b3bfd55e449783a6fa76317bc7f6b96716c830 100644 --- a/Test/baseResults/450.vert.out +++ b/Test/baseResults/450.vert.out @@ -25,7 +25,7 @@ ERROR: node is still EOpNull! 0:? 'outb' (smooth out bool) 0:? 'outo' (smooth out sampler2D) 0:? 'outa' (smooth out 4-element array of float) -0:? 'outaa' (smooth out 4-element array of float) +0:? 'outaa' (smooth out 4-element array of 2-element array of float) 0:? 'outs' (smooth out structure{global float f}) 0:? 'outasa' (smooth out 4-element array of structure{global float f}) 0:? 'outsa' (smooth out 4-element array of structure{global float f}) @@ -58,7 +58,7 @@ ERROR: node is still EOpNull! 0:? 'outb' (smooth out bool) 0:? 'outo' (smooth out sampler2D) 0:? 'outa' (smooth out 4-element array of float) -0:? 'outaa' (smooth out 4-element array of float) +0:? 'outaa' (smooth out 4-element array of 2-element array of float) 0:? 'outs' (smooth out structure{global float f}) 0:? 'outasa' (smooth out 4-element array of structure{global float f}) 0:? 'outsa' (smooth out 4-element array of structure{global float f}) diff --git a/Test/baseResults/specExamples.frag.out b/Test/baseResults/specExamples.frag.out index 7857d115e004e1531846292e248120eabf5020e4..5c5560e0beebd1f96972dce20fc354d8fa4fba8a 100644 --- a/Test/baseResults/specExamples.frag.out +++ b/Test/baseResults/specExamples.frag.out @@ -18,7 +18,7 @@ ERROR: 0:112: 'redeclaration' : all redeclarations must use the same depth layou ERROR: 0:118: 'redeclaration' : all redeclarations must use the same depth layout on gl_FragDepth ERROR: 0:121: 'redeclaration' : all redeclarations must use the same depth layout on gl_FragDepth ERROR: 0:150: 'constructor' : constructing from a non-dereferenced array -ERROR: 0:150: '=' : cannot convert from 'const float' to 'temp 3-element array of 4-component vector of float' +ERROR: 0:150: '=' : cannot convert from 'const float' to 'temp 3-element array of 2-element array of 4-component vector of float' ERROR: 0:152: 'constructor' : cannot convert parameter 1 from 'const 2-element array of 4-component vector of float' to 'temp 4-component vector of float' ERROR: 0:172: 'x' : undeclared identifier ERROR: 0:172: '[]' : scalar integer expression required diff --git a/Test/testlist b/Test/testlist index d87689c234e8137094fabdd9bbf91d4652109d31..85b5ba30f2d63deb36d30392d110fb3fefd2ff8a 100644 --- a/Test/testlist +++ b/Test/testlist @@ -40,6 +40,7 @@ comment.frag 310.vert 310.frag 310implicitSizeArrayError.vert +310AofA.vert 330.frag 330comp.frag constErrors.frag diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h index b76e2d50f3177060f438336750ebe694cef7b5c4..b02b70810d519e1d7564def8e10b7dbddaa7faa0 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -1261,10 +1261,14 @@ public: p += snprintf(p, end - p, "writeonly "); p += snprintf(p, end - p, "%s ", getStorageQualifierString()); if (arraySizes) { - if (arraySizes->sizes.front() == 0) + if (arraySizes->sizes.front() == 0) { p += snprintf(p, end - p, "implicitly-sized array of "); - else - p += snprintf(p, end - p, "%d-element array of ", arraySizes->sizes.front()); + } else { + for(int i = 0; i < (int)arraySizes->sizes.size() ; ++i) { +// p += snprintf(p, end - p, "%s%d", (i == 0 ? "" : "x"), arraySizes->sizes[numDimensions-1-i]); + p += snprintf(p, end - p, "%d-element array of ", arraySizes->sizes[i]); + } + } } if (qualifier.precision != EpqNone) p += snprintf(p, end - p, "%s ", getPrecisionQualifierString()); diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 2cab87883263d5bb5ef5fc83b9aa4f1441df9386..2735a9f7323a0bd6bfbd5a2a95a10456f80563ff 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -2543,12 +2543,12 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf // compute if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 430)) { snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupCount = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupCountX, - resources.maxComputeWorkGroupCountY, - resources.maxComputeWorkGroupCountZ); + resources.maxComputeWorkGroupCountY, + resources.maxComputeWorkGroupCountZ); s.append(builtInConstant); snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupSize = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupSizeX, - resources.maxComputeWorkGroupSizeY, - resources.maxComputeWorkGroupSizeZ); + resources.maxComputeWorkGroupSizeY, + resources.maxComputeWorkGroupSizeZ); s.append(builtInConstant); snprintf(builtInConstant, maxSize, "const int gl_MaxComputeUniformComponents = %d;", resources.maxComputeUniformComponents); diff --git a/glslang/MachineIndependent/SymbolTable.cpp b/glslang/MachineIndependent/SymbolTable.cpp index f1479a5b76ad9391a2f620af9b4455ca4010d007..8ec7f539a727a8d3604f7dfa8bc059cb6ac0b28a 100644 --- a/glslang/MachineIndependent/SymbolTable.cpp +++ b/glslang/MachineIndependent/SymbolTable.cpp @@ -112,10 +112,12 @@ void TType::buildMangledName(TString& mangledName) if (arraySizes) { const int maxSize = 11; char buf[maxSize]; - snprintf(buf, maxSize, "%d", arraySizes->sizes.front()); - mangledName += '['; - mangledName += buf; - mangledName += ']'; + for (int i = 0; i < (int)arraySizes->sizes.size(); ++i) { + snprintf(buf, maxSize, "%d", arraySizes->sizes[i]); + mangledName += '['; + mangledName += buf; + mangledName += ']'; + } } }