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

@@ -15,17 +15,19 @@ local_size = (1, 1, 1)
0:? Sequence
0:4 move second child to first child ( temp int)
0:? 'dti' ( temp int)
0:? 'dti' ( in int GlobalInvocationID)
0:? Construct int ( temp int)
0:? 'dti' ( in 3-component vector of int GlobalInvocationID)
0:4 move second child to first child ( temp int)
0:? 'gti' ( temp int)
0:? 'gti' ( in int LocalInvocationID)
0:? Construct int ( temp int)
0:? 'gti' ( in 3-component vector of int LocalInvocationID)
0:4 Function Call: @main(i1;i1; ( temp void)
0:? 'dti' ( temp int)
0:? 'gti' ( temp int)
0:? Linker Objects
0:? 'a' ( shared 100-element array of 4-component vector of float)
0:? 'dti' ( in int GlobalInvocationID)
0:? 'gti' ( in int LocalInvocationID)
0:? 'dti' ( in 3-component vector of int GlobalInvocationID)
0:? 'gti' ( in 3-component vector of int LocalInvocationID)
Linked compute stage:
@@ -47,26 +49,28 @@ local_size = (1, 1, 1)
0:? Sequence
0:4 move second child to first child ( temp int)
0:? 'dti' ( temp int)
0:? 'dti' ( in int GlobalInvocationID)
0:? Construct int ( temp int)
0:? 'dti' ( in 3-component vector of int GlobalInvocationID)
0:4 move second child to first child ( temp int)
0:? 'gti' ( temp int)
0:? 'gti' ( in int LocalInvocationID)
0:? Construct int ( temp int)
0:? 'gti' ( in 3-component vector of int LocalInvocationID)
0:4 Function Call: @main(i1;i1; ( temp void)
0:? 'dti' ( temp int)
0:? 'gti' ( temp int)
0:? Linker Objects
0:? 'a' ( shared 100-element array of 4-component vector of float)
0:? 'dti' ( in int GlobalInvocationID)
0:? 'gti' ( in int LocalInvocationID)
0:? 'dti' ( in 3-component vector of int GlobalInvocationID)
0:? 'gti' ( in 3-component vector of int LocalInvocationID)
// Module Version 10000
// Generated by (magic number): 80006
// Id's are bound by 35
// Id's are bound by 38
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main" 18 21
EntryPoint GLCompute 4 "main" 19 23
ExecutionMode 4 LocalSize 1 1 1
Source HLSL 500
Name 4 "main"
@@ -74,44 +78,47 @@ local_size = (1, 1, 1)
Name 9 "dti"
Name 10 "gti"
Name 16 "dti"
Name 18 "dti"
Name 20 "gti"
Name 21 "gti"
Name 23 "param"
Name 25 "param"
Name 34 "a"
Decorate 18(dti) BuiltIn GlobalInvocationId
Decorate 21(gti) BuiltIn LocalInvocationId
Name 19 "dti"
Name 22 "gti"
Name 23 "gti"
Name 26 "param"
Name 28 "param"
Name 37 "a"
Decorate 19(dti) BuiltIn GlobalInvocationId
Decorate 23(gti) BuiltIn LocalInvocationId
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
8: TypeFunction 2 7(ptr) 7(ptr)
17: TypePointer Input 6(int)
18(dti): 17(ptr) Variable Input
21(gti): 17(ptr) Variable Input
28: TypeFloat 32
29: TypeVector 28(float) 4
30: TypeInt 32 0
31: 30(int) Constant 100
32: TypeArray 29(fvec4) 31
33: TypePointer Workgroup 32
34(a): 33(ptr) Variable Workgroup
17: TypeVector 6(int) 3
18: TypePointer Input 17(ivec3)
19(dti): 18(ptr) Variable Input
23(gti): 18(ptr) Variable Input
31: TypeFloat 32
32: TypeVector 31(float) 4
33: TypeInt 32 0
34: 33(int) Constant 100
35: TypeArray 32(fvec4) 34
36: TypePointer Workgroup 35
37(a): 36(ptr) Variable Workgroup
4(main): 2 Function None 3
5: Label
16(dti): 7(ptr) Variable Function
20(gti): 7(ptr) Variable Function
23(param): 7(ptr) Variable Function
25(param): 7(ptr) Variable Function
19: 6(int) Load 18(dti)
Store 16(dti) 19
22: 6(int) Load 21(gti)
Store 20(gti) 22
24: 6(int) Load 16(dti)
Store 23(param) 24
26: 6(int) Load 20(gti)
Store 25(param) 26
27: 2 FunctionCall 11(@main(i1;i1;) 23(param) 25(param)
22(gti): 7(ptr) Variable Function
26(param): 7(ptr) Variable Function
28(param): 7(ptr) Variable Function
20: 17(ivec3) Load 19(dti)
21: 6(int) CompositeExtract 20 0
Store 16(dti) 21
24: 17(ivec3) Load 23(gti)
25: 6(int) CompositeExtract 24 0
Store 22(gti) 25
27: 6(int) Load 16(dti)
Store 26(param) 27
29: 6(int) Load 22(gti)
Store 28(param) 29
30: 2 FunctionCall 11(@main(i1;i1;) 26(param) 28(param)
Return
FunctionEnd
11(@main(i1;i1;): 2 Function None 8