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:
@@ -27,7 +27,9 @@ vertices = 4
|
||||
0:? 'ip' ( temp 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: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:? 'InvocationId' ( in uint InvocationID)
|
||||
0:26 Function Call: @main(struct-VS_OUT-vf31[4]; ( 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:? Barrier ( temp void)
|
||||
@@ -97,11 +99,11 @@ 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:? 'InvocationId' ( in uint InvocationID)
|
||||
0:? 'pid' ( in uint PrimitiveID)
|
||||
0:? 'pos' ( in 4-component vector of float Position)
|
||||
0:? 'InvocationId' ( in uint InvocationID)
|
||||
0:? '@patchConstantOutput' (layout( location=1) patch out structure{})
|
||||
0:? '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
|
||||
|
||||
@@ -137,7 +139,9 @@ vertices = 4
|
||||
0:? 'ip' ( temp 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: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:? 'InvocationId' ( in uint InvocationID)
|
||||
0:26 Function Call: @main(struct-VS_OUT-vf31[4]; ( 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:? Barrier ( temp void)
|
||||
@@ -207,22 +211,22 @@ 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:? 'InvocationId' ( in uint InvocationID)
|
||||
0:? 'pid' ( in uint PrimitiveID)
|
||||
0:? 'pos' ( in 4-component vector of float Position)
|
||||
0:? 'InvocationId' ( in uint InvocationID)
|
||||
0:? '@patchConstantOutput' (layout( location=1) patch out structure{})
|
||||
0:? '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 91
|
||||
// Id's are bound by 95
|
||||
|
||||
Capability Tessellation
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint TessellationControl 4 "main" 42 45 52 60 62 70 90
|
||||
EntryPoint TessellationControl 4 "main" 42 46 48 64 66 74 94
|
||||
ExecutionMode 4 OutputVertices 4
|
||||
Name 4 "main"
|
||||
Name 8 "VS_OUT"
|
||||
@@ -239,27 +243,27 @@ vertices = 4
|
||||
Name 30 "output"
|
||||
Name 40 "ip"
|
||||
Name 42 "ip"
|
||||
Name 45 "@entryPointOutput"
|
||||
Name 46 "param"
|
||||
Name 52 "InvocationId"
|
||||
Name 59 "@patchConstantResult"
|
||||
Name 60 "pid"
|
||||
Name 62 "pos"
|
||||
Name 63 "param"
|
||||
Name 65 "param"
|
||||
Name 70 "@patchConstantOutput_edges"
|
||||
Name 80 "output"
|
||||
Name 88 "HS_CONSTANT_OUT"
|
||||
Name 90 "@patchConstantOutput"
|
||||
Name 46 "@entryPointOutput"
|
||||
Name 48 "InvocationId"
|
||||
Name 50 "param"
|
||||
Name 63 "@patchConstantResult"
|
||||
Name 64 "pid"
|
||||
Name 66 "pos"
|
||||
Name 67 "param"
|
||||
Name 69 "param"
|
||||
Name 74 "@patchConstantOutput_edges"
|
||||
Name 84 "output"
|
||||
Name 92 "HS_CONSTANT_OUT"
|
||||
Name 94 "@patchConstantOutput"
|
||||
Decorate 42(ip) Location 0
|
||||
Decorate 45(@entryPointOutput) Location 0
|
||||
Decorate 52(InvocationId) BuiltIn InvocationId
|
||||
Decorate 60(pid) BuiltIn PrimitiveId
|
||||
Decorate 62(pos) BuiltIn Position
|
||||
Decorate 70(@patchConstantOutput_edges) Patch
|
||||
Decorate 70(@patchConstantOutput_edges) BuiltIn TessLevelOuter
|
||||
Decorate 90(@patchConstantOutput) Patch
|
||||
Decorate 90(@patchConstantOutput) Location 1
|
||||
Decorate 46(@entryPointOutput) Location 0
|
||||
Decorate 48(InvocationId) BuiltIn InvocationId
|
||||
Decorate 64(pid) BuiltIn PrimitiveId
|
||||
Decorate 66(pos) BuiltIn Position
|
||||
Decorate 74(@patchConstantOutput_edges) Patch
|
||||
Decorate 74(@patchConstantOutput_edges) BuiltIn TessLevelOuter
|
||||
Decorate 94(@patchConstantOutput) Patch
|
||||
Decorate 94(@patchConstantOutput) Location 1
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
@@ -284,63 +288,67 @@ vertices = 4
|
||||
33: TypePointer Function 7(fvec3)
|
||||
41: TypePointer Input 11
|
||||
42(ip): 41(ptr) Variable Input
|
||||
44: TypePointer Output 13(HS_OUT)
|
||||
45(@entryPointOutput): 44(ptr) Variable Output
|
||||
49: 9(int) Constant 1
|
||||
50: 9(int) Constant 0
|
||||
51: TypePointer Input 9(int)
|
||||
52(InvocationId): 51(ptr) Variable Input
|
||||
54: TypeBool
|
||||
58: TypePointer Function 23(HS_CONSTANT_OUT)
|
||||
60(pid): 51(ptr) Variable Input
|
||||
61: TypePointer Input 19(fvec4)
|
||||
62(pos): 61(ptr) Variable Input
|
||||
68: TypeArray 6(float) 10
|
||||
69: TypePointer Output 68
|
||||
70(@patchConstantOutput_edges): 69(ptr) Variable Output
|
||||
71: TypePointer Function 6(float)
|
||||
74: TypePointer Output 6(float)
|
||||
76: 31(int) Constant 1
|
||||
81: 6(float) Constant 1073741824
|
||||
83: 6(float) Constant 1090519040
|
||||
88(HS_CONSTANT_OUT): TypeStruct
|
||||
89: TypePointer Output 88(HS_CONSTANT_OUT)
|
||||
90(@patchConstantOutput): 89(ptr) Variable Output
|
||||
44: TypeArray 13(HS_OUT) 10
|
||||
45: TypePointer Output 44
|
||||
46(@entryPointOutput): 45(ptr) Variable Output
|
||||
47: TypePointer Input 9(int)
|
||||
48(InvocationId): 47(ptr) Variable Input
|
||||
53: TypePointer Output 13(HS_OUT)
|
||||
55: 9(int) Constant 1
|
||||
56: 9(int) Constant 0
|
||||
58: TypeBool
|
||||
62: TypePointer Function 23(HS_CONSTANT_OUT)
|
||||
64(pid): 47(ptr) Variable Input
|
||||
65: TypePointer Input 19(fvec4)
|
||||
66(pos): 65(ptr) Variable Input
|
||||
72: TypeArray 6(float) 10
|
||||
73: TypePointer Output 72
|
||||
74(@patchConstantOutput_edges): 73(ptr) Variable Output
|
||||
75: TypePointer Function 6(float)
|
||||
78: TypePointer Output 6(float)
|
||||
80: 31(int) Constant 1
|
||||
85: 6(float) Constant 1073741824
|
||||
87: 6(float) Constant 1090519040
|
||||
92(HS_CONSTANT_OUT): TypeStruct
|
||||
93: TypePointer Output 92(HS_CONSTANT_OUT)
|
||||
94(@patchConstantOutput): 93(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
40(ip): 12(ptr) Variable Function
|
||||
46(param): 12(ptr) Variable Function
|
||||
59(@patchConstantResult): 58(ptr) Variable Function
|
||||
63(param): 18(ptr) Variable Function
|
||||
65(param): 20(ptr) Variable Function
|
||||
50(param): 12(ptr) Variable Function
|
||||
63(@patchConstantResult): 62(ptr) Variable Function
|
||||
67(param): 18(ptr) Variable Function
|
||||
69(param): 20(ptr) Variable Function
|
||||
43: 11 Load 42(ip)
|
||||
Store 40(ip) 43
|
||||
47: 11 Load 40(ip)
|
||||
Store 46(param) 47
|
||||
48: 13(HS_OUT) FunctionCall 16(@main(struct-VS_OUT-vf31[4];) 46(param)
|
||||
Store 45(@entryPointOutput) 48
|
||||
ControlBarrier 21 49 50
|
||||
53: 9(int) Load 52(InvocationId)
|
||||
55: 54(bool) IEqual 53 32
|
||||
SelectionMerge 57 None
|
||||
BranchConditional 55 56 57
|
||||
56: Label
|
||||
64: 9(int) Load 60(pid)
|
||||
Store 63(param) 64
|
||||
66: 19(fvec4) Load 62(pos)
|
||||
Store 65(param) 66
|
||||
67:23(HS_CONSTANT_OUT) FunctionCall 27(PCF(u1;vf4;) 63(param) 65(param)
|
||||
Store 59(@patchConstantResult) 67
|
||||
72: 71(ptr) AccessChain 59(@patchConstantResult) 32 32
|
||||
73: 6(float) Load 72
|
||||
75: 74(ptr) AccessChain 70(@patchConstantOutput_edges) 32
|
||||
Store 75 73
|
||||
77: 71(ptr) AccessChain 59(@patchConstantResult) 32 76
|
||||
78: 6(float) Load 77
|
||||
79: 74(ptr) AccessChain 70(@patchConstantOutput_edges) 76
|
||||
Store 79 78
|
||||
Branch 57
|
||||
57: Label
|
||||
49: 9(int) Load 48(InvocationId)
|
||||
51: 11 Load 40(ip)
|
||||
Store 50(param) 51
|
||||
52: 13(HS_OUT) FunctionCall 16(@main(struct-VS_OUT-vf31[4];) 50(param)
|
||||
54: 53(ptr) AccessChain 46(@entryPointOutput) 49
|
||||
Store 54 52
|
||||
ControlBarrier 21 55 56
|
||||
57: 9(int) Load 48(InvocationId)
|
||||
59: 58(bool) IEqual 57 32
|
||||
SelectionMerge 61 None
|
||||
BranchConditional 59 60 61
|
||||
60: Label
|
||||
68: 9(int) Load 64(pid)
|
||||
Store 67(param) 68
|
||||
70: 19(fvec4) Load 66(pos)
|
||||
Store 69(param) 70
|
||||
71:23(HS_CONSTANT_OUT) FunctionCall 27(PCF(u1;vf4;) 67(param) 69(param)
|
||||
Store 63(@patchConstantResult) 71
|
||||
76: 75(ptr) AccessChain 63(@patchConstantResult) 32 32
|
||||
77: 6(float) Load 76
|
||||
79: 78(ptr) AccessChain 74(@patchConstantOutput_edges) 32
|
||||
Store 79 77
|
||||
81: 75(ptr) AccessChain 63(@patchConstantResult) 32 80
|
||||
82: 6(float) Load 81
|
||||
83: 78(ptr) AccessChain 74(@patchConstantOutput_edges) 80
|
||||
Store 83 82
|
||||
Branch 61
|
||||
61: Label
|
||||
Return
|
||||
FunctionEnd
|
||||
16(@main(struct-VS_OUT-vf31[4];): 13(HS_OUT) Function None 14
|
||||
@@ -358,11 +366,11 @@ vertices = 4
|
||||
25(pid): 18(ptr) FunctionParameter
|
||||
26(pos): 20(ptr) FunctionParameter
|
||||
28: Label
|
||||
80(output): 58(ptr) Variable Function
|
||||
82: 71(ptr) AccessChain 80(output) 32 32
|
||||
Store 82 81
|
||||
84: 71(ptr) AccessChain 80(output) 32 76
|
||||
Store 84 83
|
||||
85:23(HS_CONSTANT_OUT) Load 80(output)
|
||||
ReturnValue 85
|
||||
84(output): 62(ptr) Variable Function
|
||||
86: 75(ptr) AccessChain 84(output) 32 32
|
||||
Store 86 85
|
||||
88: 75(ptr) AccessChain 84(output) 32 80
|
||||
Store 88 87
|
||||
89:23(HS_CONSTANT_OUT) Load 84(output)
|
||||
ReturnValue 89
|
||||
FunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user