Fix arrays dimensioned with spec constant sized gl_WorkGroupSize

This commit is contained in:
Greg Fischer 2021-05-06 18:01:20 -06:00
parent 41e39c615b
commit 1464d036b8
3 changed files with 17 additions and 1 deletions

View File

@ -4236,6 +4236,8 @@ spv::Id TGlslangToSpvTraverser::makeArraySizeId(const glslang::TArraySizes& arra
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());
}

View File

@ -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 @@ spv.noWorkgroup.comp
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 @@ spv.noWorkgroup.comp
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

View File

@ -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()
{
}