HLSL: various SPIR-V compute shader IDs must be a 3-vector of integers.

This PR forces the external definition of SV_GroupID variables to 3-vectors.
The conversion process between the shader-declared type and the external type
happens in wrapped main IO variable conversion.

The same applies to SV_DispatchThreadID and SV_GroupThreadID.

Fixes: #1371
This commit is contained in:
LoopDawg
2018-05-15 14:52:14 -06:00
parent 1831087e48
commit 91a8178efb
6 changed files with 237 additions and 67 deletions

View File

@@ -56,13 +56,14 @@ local_size = (256, 1, 1)
0:? Sequence
0:12 move second child to first child ( temp uint)
0:? 'dispatchId' ( temp uint)
0:? 'dispatchId' ( in uint GlobalInvocationID)
0:? Construct uint ( temp uint)
0:? 'dispatchId' ( in 3-component vector of uint GlobalInvocationID)
0:12 Function Call: @main(u1; ( temp void)
0:? 'dispatchId' ( temp uint)
0:? Linker Objects
0:? 'g_input' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data})
0:? 'g_output' (layout( binding=1 rg32ui) uniform uimageBuffer)
0:? 'dispatchId' ( in uint GlobalInvocationID)
0:? 'dispatchId' ( in 3-component vector of uint GlobalInvocationID)
Linked compute stage:
@@ -125,24 +126,25 @@ local_size = (256, 1, 1)
0:? Sequence
0:12 move second child to first child ( temp uint)
0:? 'dispatchId' ( temp uint)
0:? 'dispatchId' ( in uint GlobalInvocationID)
0:? Construct uint ( temp uint)
0:? 'dispatchId' ( in 3-component vector of uint GlobalInvocationID)
0:12 Function Call: @main(u1; ( temp void)
0:? 'dispatchId' ( temp uint)
0:? Linker Objects
0:? 'g_input' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data})
0:? 'g_output' (layout( binding=1 rg32ui) uniform uimageBuffer)
0:? 'dispatchId' ( in uint GlobalInvocationID)
0:? 'dispatchId' ( in 3-component vector of uint GlobalInvocationID)
// Module Version 10000
// Generated by (magic number): 80006
// Id's are bound by 61
// Id's are bound by 63
Capability Shader
Capability ImageBuffer
Capability StorageImageExtendedFormats
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main" 56
EntryPoint GLCompute 4 "main" 57
ExecutionMode 4 LocalSize 256 1 1
Source HLSL 500
Name 4 "main"
@@ -160,8 +162,8 @@ local_size = (256, 1, 1)
Name 45 "param"
Name 50 "g_output"
Name 54 "dispatchId"
Name 56 "dispatchId"
Name 58 "param"
Name 57 "dispatchId"
Name 60 "param"
Decorate 8 ArrayStride 4
MemberDecorate 9 0 NonWritable
MemberDecorate 9 0 Offset 0
@@ -171,7 +173,7 @@ local_size = (256, 1, 1)
Decorate 44(g_input) Binding 0
Decorate 50(g_output) DescriptorSet 0
Decorate 50(g_output) Binding 1
Decorate 56(dispatchId) BuiltIn GlobalInvocationId
Decorate 57(dispatchId) BuiltIn GlobalInvocationId
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
@@ -193,17 +195,19 @@ local_size = (256, 1, 1)
48: TypeImage 6(int) Buffer nonsampled format:Rg32ui
49: TypePointer UniformConstant 48
50(g_output): 49(ptr) Variable UniformConstant
55: TypePointer Input 6(int)
56(dispatchId): 55(ptr) Variable Input
55: TypeVector 6(int) 3
56: TypePointer Input 55(ivec3)
57(dispatchId): 56(ptr) Variable Input
4(main): 2 Function None 3
5: Label
54(dispatchId): 7(ptr) Variable Function
58(param): 7(ptr) Variable Function
57: 6(int) Load 56(dispatchId)
Store 54(dispatchId) 57
59: 6(int) Load 54(dispatchId)
Store 58(param) 59
60: 2 FunctionCall 19(@main(u1;) 58(param)
60(param): 7(ptr) Variable Function
58: 55(ivec3) Load 57(dispatchId)
59: 6(int) CompositeExtract 58 0
Store 54(dispatchId) 59
61: 6(int) Load 54(dispatchId)
Store 60(param) 61
62: 2 FunctionCall 19(@main(u1;) 60(param)
Return
FunctionEnd
15(testLoad(u1;block--u1[0]1;): 11(ivec2) Function None 12