HLSL: HS return is arrayed to match SPIR-V semantics
HLSL HS outputs a per ctrl point value, and the DS reads an array of that type. (It also has a per patch frequency). The per-ctrl-pt frequency is arrayed on just one side, as opposed to SPIR-V which is arrayed on both. To match semantics, the compiler creates an array behind the scenes and indexes it by invocation ID, assigning the HS return value to it.
This commit is contained in:
parent
7afe1344ca
commit
e752f463c5
6 changed files with 477 additions and 382 deletions
|
|
@ -31,7 +31,9 @@ vertices = 4
|
|||
0:? 'm_cpid' ( temp uint)
|
||||
0:? 'm_cpid' ( in uint InvocationID)
|
||||
0:26 move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
|
||||
0:? '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
|
||||
0:26 indirect index ( temp structure{ temp 3-component vector of float cpoint})
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
|
||||
0:? 'm_cpid' ( in uint InvocationID)
|
||||
0:26 Function Call: @main(struct-VS_OUT-vf31[4];u1; ( temp structure{ temp 3-component vector of float cpoint})
|
||||
0:? 'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
|
||||
0:? 'm_cpid' ( temp uint)
|
||||
|
|
@ -100,7 +102,7 @@ vertices = 4
|
|||
0:38 Branch: Return with expression
|
||||
0:38 'output' ( temp structure{ temp 2-element array of float edges})
|
||||
0:? Linker Objects
|
||||
0:? '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
|
||||
0:? 'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
|
||||
0:? 'm_cpid' ( in uint InvocationID)
|
||||
0:? 'pid' ( in uint PrimitiveID)
|
||||
|
|
@ -143,7 +145,9 @@ vertices = 4
|
|||
0:? 'm_cpid' ( temp uint)
|
||||
0:? 'm_cpid' ( in uint InvocationID)
|
||||
0:26 move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
|
||||
0:? '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
|
||||
0:26 indirect index ( temp structure{ temp 3-component vector of float cpoint})
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
|
||||
0:? 'm_cpid' ( in uint InvocationID)
|
||||
0:26 Function Call: @main(struct-VS_OUT-vf31[4];u1; ( temp structure{ temp 3-component vector of float cpoint})
|
||||
0:? 'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
|
||||
0:? 'm_cpid' ( temp uint)
|
||||
|
|
@ -212,7 +216,7 @@ vertices = 4
|
|||
0:38 Branch: Return with expression
|
||||
0:38 'output' ( temp structure{ temp 2-element array of float edges})
|
||||
0:? Linker Objects
|
||||
0:? '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
|
||||
0:? 'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
|
||||
0:? 'm_cpid' ( in uint InvocationID)
|
||||
0:? 'pid' ( in uint PrimitiveID)
|
||||
|
|
@ -221,12 +225,12 @@ vertices = 4
|
|||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 89
|
||||
// Id's are bound by 93
|
||||
|
||||
Capability Tessellation
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint TessellationControl 4 "main" 40 44 47 62 68 88
|
||||
EntryPoint TessellationControl 4 "main" 40 44 48 66 72 92
|
||||
ExecutionMode 4 OutputVertices 4
|
||||
Name 4 "main"
|
||||
Name 8 "VS_OUT"
|
||||
|
|
@ -245,24 +249,24 @@ vertices = 4
|
|||
Name 40 "ip"
|
||||
Name 42 "m_cpid"
|
||||
Name 44 "m_cpid"
|
||||
Name 47 "@entryPointOutput"
|
||||
Name 48 "param"
|
||||
Name 48 "@entryPointOutput"
|
||||
Name 50 "param"
|
||||
Name 61 "@patchConstantResult"
|
||||
Name 62 "pid"
|
||||
Name 63 "param"
|
||||
Name 68 "@patchConstantOutput_edges"
|
||||
Name 78 "output"
|
||||
Name 86 "HS_CONSTANT_OUT"
|
||||
Name 88 "@patchConstantOutput"
|
||||
Name 52 "param"
|
||||
Name 65 "@patchConstantResult"
|
||||
Name 66 "pid"
|
||||
Name 67 "param"
|
||||
Name 72 "@patchConstantOutput_edges"
|
||||
Name 82 "output"
|
||||
Name 90 "HS_CONSTANT_OUT"
|
||||
Name 92 "@patchConstantOutput"
|
||||
Decorate 40(ip) Location 0
|
||||
Decorate 44(m_cpid) BuiltIn InvocationId
|
||||
Decorate 47(@entryPointOutput) Location 0
|
||||
Decorate 62(pid) BuiltIn PrimitiveId
|
||||
Decorate 68(@patchConstantOutput_edges) Patch
|
||||
Decorate 68(@patchConstantOutput_edges) BuiltIn TessLevelOuter
|
||||
Decorate 88(@patchConstantOutput) Patch
|
||||
Decorate 88(@patchConstantOutput) Location 1
|
||||
Decorate 48(@entryPointOutput) Location 0
|
||||
Decorate 66(pid) BuiltIn PrimitiveId
|
||||
Decorate 72(@patchConstantOutput_edges) Patch
|
||||
Decorate 72(@patchConstantOutput_edges) BuiltIn TessLevelOuter
|
||||
Decorate 92(@patchConstantOutput) Patch
|
||||
Decorate 92(@patchConstantOutput) Location 1
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
|
|
@ -287,62 +291,66 @@ vertices = 4
|
|||
40(ip): 39(ptr) Variable Input
|
||||
43: TypePointer Input 9(int)
|
||||
44(m_cpid): 43(ptr) Variable Input
|
||||
46: TypePointer Output 14(HS_OUT)
|
||||
47(@entryPointOutput): 46(ptr) Variable Output
|
||||
53: 9(int) Constant 1
|
||||
54: 9(int) Constant 0
|
||||
56: TypeBool
|
||||
60: TypePointer Function 22(HS_CONSTANT_OUT)
|
||||
62(pid): 43(ptr) Variable Input
|
||||
66: TypeArray 6(float) 10
|
||||
67: TypePointer Output 66
|
||||
68(@patchConstantOutput_edges): 67(ptr) Variable Output
|
||||
69: TypePointer Function 6(float)
|
||||
72: TypePointer Output 6(float)
|
||||
74: 29(int) Constant 1
|
||||
79: 6(float) Constant 1073741824
|
||||
81: 6(float) Constant 1090519040
|
||||
86(HS_CONSTANT_OUT): TypeStruct
|
||||
87: TypePointer Output 86(HS_CONSTANT_OUT)
|
||||
88(@patchConstantOutput): 87(ptr) Variable Output
|
||||
46: TypeArray 14(HS_OUT) 10
|
||||
47: TypePointer Output 46
|
||||
48(@entryPointOutput): 47(ptr) Variable Output
|
||||
55: TypePointer Output 14(HS_OUT)
|
||||
57: 9(int) Constant 1
|
||||
58: 9(int) Constant 0
|
||||
60: TypeBool
|
||||
64: TypePointer Function 22(HS_CONSTANT_OUT)
|
||||
66(pid): 43(ptr) Variable Input
|
||||
70: TypeArray 6(float) 10
|
||||
71: TypePointer Output 70
|
||||
72(@patchConstantOutput_edges): 71(ptr) Variable Output
|
||||
73: TypePointer Function 6(float)
|
||||
76: TypePointer Output 6(float)
|
||||
78: 29(int) Constant 1
|
||||
83: 6(float) Constant 1073741824
|
||||
85: 6(float) Constant 1090519040
|
||||
90(HS_CONSTANT_OUT): TypeStruct
|
||||
91: TypePointer Output 90(HS_CONSTANT_OUT)
|
||||
92(@patchConstantOutput): 91(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
38(ip): 12(ptr) Variable Function
|
||||
42(m_cpid): 13(ptr) Variable Function
|
||||
48(param): 12(ptr) Variable Function
|
||||
50(param): 13(ptr) Variable Function
|
||||
61(@patchConstantResult): 60(ptr) Variable Function
|
||||
63(param): 13(ptr) Variable Function
|
||||
50(param): 12(ptr) Variable Function
|
||||
52(param): 13(ptr) Variable Function
|
||||
65(@patchConstantResult): 64(ptr) Variable Function
|
||||
67(param): 13(ptr) Variable Function
|
||||
41: 11 Load 40(ip)
|
||||
Store 38(ip) 41
|
||||
45: 9(int) Load 44(m_cpid)
|
||||
Store 42(m_cpid) 45
|
||||
49: 11 Load 38(ip)
|
||||
Store 48(param) 49
|
||||
51: 9(int) Load 42(m_cpid)
|
||||
49: 9(int) Load 44(m_cpid)
|
||||
51: 11 Load 38(ip)
|
||||
Store 50(param) 51
|
||||
52: 14(HS_OUT) FunctionCall 18(@main(struct-VS_OUT-vf31[4];u1;) 48(param) 50(param)
|
||||
Store 47(@entryPointOutput) 52
|
||||
ControlBarrier 20 53 54
|
||||
55: 9(int) Load 44(m_cpid)
|
||||
57: 56(bool) IEqual 55 30
|
||||
SelectionMerge 59 None
|
||||
BranchConditional 57 58 59
|
||||
58: Label
|
||||
64: 9(int) Load 62(pid)
|
||||
Store 63(param) 64
|
||||
65:22(HS_CONSTANT_OUT) FunctionCall 25(PCF(u1;) 63(param)
|
||||
Store 61(@patchConstantResult) 65
|
||||
70: 69(ptr) AccessChain 61(@patchConstantResult) 30 30
|
||||
71: 6(float) Load 70
|
||||
73: 72(ptr) AccessChain 68(@patchConstantOutput_edges) 30
|
||||
Store 73 71
|
||||
75: 69(ptr) AccessChain 61(@patchConstantResult) 30 74
|
||||
76: 6(float) Load 75
|
||||
77: 72(ptr) AccessChain 68(@patchConstantOutput_edges) 74
|
||||
Store 77 76
|
||||
Branch 59
|
||||
59: Label
|
||||
53: 9(int) Load 42(m_cpid)
|
||||
Store 52(param) 53
|
||||
54: 14(HS_OUT) FunctionCall 18(@main(struct-VS_OUT-vf31[4];u1;) 50(param) 52(param)
|
||||
56: 55(ptr) AccessChain 48(@entryPointOutput) 49
|
||||
Store 56 54
|
||||
ControlBarrier 20 57 58
|
||||
59: 9(int) Load 44(m_cpid)
|
||||
61: 60(bool) IEqual 59 30
|
||||
SelectionMerge 63 None
|
||||
BranchConditional 61 62 63
|
||||
62: Label
|
||||
68: 9(int) Load 66(pid)
|
||||
Store 67(param) 68
|
||||
69:22(HS_CONSTANT_OUT) FunctionCall 25(PCF(u1;) 67(param)
|
||||
Store 65(@patchConstantResult) 69
|
||||
74: 73(ptr) AccessChain 65(@patchConstantResult) 30 30
|
||||
75: 6(float) Load 74
|
||||
77: 76(ptr) AccessChain 72(@patchConstantOutput_edges) 30
|
||||
Store 77 75
|
||||
79: 73(ptr) AccessChain 65(@patchConstantResult) 30 78
|
||||
80: 6(float) Load 79
|
||||
81: 76(ptr) AccessChain 72(@patchConstantOutput_edges) 78
|
||||
Store 81 80
|
||||
Branch 63
|
||||
63: Label
|
||||
Return
|
||||
FunctionEnd
|
||||
18(@main(struct-VS_OUT-vf31[4];u1;): 14(HS_OUT) Function None 15
|
||||
|
|
@ -360,11 +368,11 @@ vertices = 4
|
|||
25(PCF(u1;):22(HS_CONSTANT_OUT) Function None 23
|
||||
24(pid): 13(ptr) FunctionParameter
|
||||
26: Label
|
||||
78(output): 60(ptr) Variable Function
|
||||
80: 69(ptr) AccessChain 78(output) 30 30
|
||||
Store 80 79
|
||||
82: 69(ptr) AccessChain 78(output) 30 74
|
||||
Store 82 81
|
||||
83:22(HS_CONSTANT_OUT) Load 78(output)
|
||||
ReturnValue 83
|
||||
82(output): 64(ptr) Variable Function
|
||||
84: 73(ptr) AccessChain 82(output) 30 30
|
||||
Store 84 83
|
||||
86: 73(ptr) AccessChain 82(output) 30 78
|
||||
Store 86 85
|
||||
87:22(HS_CONSTANT_OUT) Load 82(output)
|
||||
ReturnValue 87
|
||||
FunctionEnd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue