Fix arrays dimensioned with spec constant sized gl_WorkGroupSize
diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index 81aacd1..1d8f199 100644
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -4236,6 +4236,8 @@
glslang::TIntermTyped* specNode = arraySizes.getDimNode(dim);
if (specNode != nullptr) {
builder.clearAccessChain();
+ SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder);
+ spec_constant_op_mode_setter.turnOnSpecConstantOpMode();
specNode->traverse(this);
return accessChainLoad(specNode->getAsTyped()->getType());
}
diff --git a/Test/baseResults/spv.noWorkgroup.comp.out b/Test/baseResults/spv.noWorkgroup.comp.out
index 9cd130c..a8969e0 100644
--- a/Test/baseResults/spv.noWorkgroup.comp.out
+++ b/Test/baseResults/spv.noWorkgroup.comp.out
@@ -1,7 +1,7 @@
spv.noWorkgroup.comp
// Module Version 10000
// Generated by (magic number): 8000a
-// Id's are bound by 12
+// Id's are bound by 23
Capability Shader
1: ExtInstImport "GLSL.std.450"
@@ -10,6 +10,7 @@
ExecutionMode 4 LocalSize 1 1 1
Source GLSL 450
Name 4 "main"
+ Name 22 "keys"
Decorate 7 SpecId 18
Decorate 8 SpecId 10
Decorate 9 SpecId 19
@@ -22,6 +23,17 @@
9: 6(int) SpecConstant 1
10: TypeVector 6(int) 3
11: 10(ivec3) SpecConstantComposite 7 8 9
+ 12: 6(int) Constant 0
+ 13: 6(int) SpecConstantOp 81 11 0
+ 14: 6(int) Constant 1
+ 15: 6(int) SpecConstantOp 81 11 1(GLSL.std.450)
+ 16: 6(int) SpecConstantOp 132 13 15
+ 17: TypeArray 6(int) 16
+ 18: 6(int) Constant 2
+ 19: 6(int) SpecConstantOp 81 11 2
+ 20: TypeArray 17 19
+ 21: TypePointer Workgroup 20
+ 22(keys): 21(ptr) Variable Workgroup
4(main): 2 Function None 3
5: Label
Return
diff --git a/Test/spv.noWorkgroup.comp b/Test/spv.noWorkgroup.comp
index 0c77f27..37df388 100644
--- a/Test/spv.noWorkgroup.comp
+++ b/Test/spv.noWorkgroup.comp
@@ -2,6 +2,8 @@
layout(local_size_x_id = 18, local_size_y_id=10,local_size_z_id = 19) in;
+shared uint keys[gl_WorkGroupSize.z][gl_WorkGroupSize.x * gl_WorkGroupSize.y];
+
void main()
{
}