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:
steve-lunarg 2017-03-22 18:39:25 -06:00
parent 7afe1344ca
commit e752f463c5
6 changed files with 477 additions and 382 deletions

View file

@ -31,7 +31,9 @@ vertices = 4
0:? 'm_cpid' ( temp uint) 0:? 'm_cpid' ( temp uint)
0:? 'm_cpid' ( in uint InvocationID) 0:? 'm_cpid' ( in uint InvocationID)
0:26 move second child to first child ( temp 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:? '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: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:? 'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
0:? 'm_cpid' ( temp uint) 0:? 'm_cpid' ( temp uint)
@ -100,7 +102,7 @@ vertices = 4
0:38 Branch: Return with expression 0:38 Branch: Return with expression
0:38 'output' ( temp structure{ temp 2-element array of float edges}) 0:38 'output' ( temp structure{ temp 2-element array of float edges})
0:? Linker Objects 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:? 'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
0:? 'm_cpid' ( in uint InvocationID) 0:? 'm_cpid' ( in uint InvocationID)
0:? 'pid' ( in uint PrimitiveID) 0:? 'pid' ( in uint PrimitiveID)
@ -143,7 +145,9 @@ vertices = 4
0:? 'm_cpid' ( temp uint) 0:? 'm_cpid' ( temp uint)
0:? 'm_cpid' ( in uint InvocationID) 0:? 'm_cpid' ( in uint InvocationID)
0:26 move second child to first child ( temp 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:? '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: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:? 'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
0:? 'm_cpid' ( temp uint) 0:? 'm_cpid' ( temp uint)
@ -212,7 +216,7 @@ vertices = 4
0:38 Branch: Return with expression 0:38 Branch: Return with expression
0:38 'output' ( temp structure{ temp 2-element array of float edges}) 0:38 'output' ( temp structure{ temp 2-element array of float edges})
0:? Linker Objects 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:? 'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
0:? 'm_cpid' ( in uint InvocationID) 0:? 'm_cpid' ( in uint InvocationID)
0:? 'pid' ( in uint PrimitiveID) 0:? 'pid' ( in uint PrimitiveID)
@ -221,12 +225,12 @@ vertices = 4
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 89 // Id's are bound by 93
Capability Tessellation Capability Tessellation
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 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 ExecutionMode 4 OutputVertices 4
Name 4 "main" Name 4 "main"
Name 8 "VS_OUT" Name 8 "VS_OUT"
@ -245,24 +249,24 @@ vertices = 4
Name 40 "ip" Name 40 "ip"
Name 42 "m_cpid" Name 42 "m_cpid"
Name 44 "m_cpid" Name 44 "m_cpid"
Name 47 "@entryPointOutput" Name 48 "@entryPointOutput"
Name 48 "param"
Name 50 "param" Name 50 "param"
Name 61 "@patchConstantResult" Name 52 "param"
Name 62 "pid" Name 65 "@patchConstantResult"
Name 63 "param" Name 66 "pid"
Name 68 "@patchConstantOutput_edges" Name 67 "param"
Name 78 "output" Name 72 "@patchConstantOutput_edges"
Name 86 "HS_CONSTANT_OUT" Name 82 "output"
Name 88 "@patchConstantOutput" Name 90 "HS_CONSTANT_OUT"
Name 92 "@patchConstantOutput"
Decorate 40(ip) Location 0 Decorate 40(ip) Location 0
Decorate 44(m_cpid) BuiltIn InvocationId Decorate 44(m_cpid) BuiltIn InvocationId
Decorate 47(@entryPointOutput) Location 0 Decorate 48(@entryPointOutput) Location 0
Decorate 62(pid) BuiltIn PrimitiveId Decorate 66(pid) BuiltIn PrimitiveId
Decorate 68(@patchConstantOutput_edges) Patch Decorate 72(@patchConstantOutput_edges) Patch
Decorate 68(@patchConstantOutput_edges) BuiltIn TessLevelOuter Decorate 72(@patchConstantOutput_edges) BuiltIn TessLevelOuter
Decorate 88(@patchConstantOutput) Patch Decorate 92(@patchConstantOutput) Patch
Decorate 88(@patchConstantOutput) Location 1 Decorate 92(@patchConstantOutput) Location 1
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
@ -287,62 +291,66 @@ vertices = 4
40(ip): 39(ptr) Variable Input 40(ip): 39(ptr) Variable Input
43: TypePointer Input 9(int) 43: TypePointer Input 9(int)
44(m_cpid): 43(ptr) Variable Input 44(m_cpid): 43(ptr) Variable Input
46: TypePointer Output 14(HS_OUT) 46: TypeArray 14(HS_OUT) 10
47(@entryPointOutput): 46(ptr) Variable Output 47: TypePointer Output 46
53: 9(int) Constant 1 48(@entryPointOutput): 47(ptr) Variable Output
54: 9(int) Constant 0 55: TypePointer Output 14(HS_OUT)
56: TypeBool 57: 9(int) Constant 1
60: TypePointer Function 22(HS_CONSTANT_OUT) 58: 9(int) Constant 0
62(pid): 43(ptr) Variable Input 60: TypeBool
66: TypeArray 6(float) 10 64: TypePointer Function 22(HS_CONSTANT_OUT)
67: TypePointer Output 66 66(pid): 43(ptr) Variable Input
68(@patchConstantOutput_edges): 67(ptr) Variable Output 70: TypeArray 6(float) 10
69: TypePointer Function 6(float) 71: TypePointer Output 70
72: TypePointer Output 6(float) 72(@patchConstantOutput_edges): 71(ptr) Variable Output
74: 29(int) Constant 1 73: TypePointer Function 6(float)
79: 6(float) Constant 1073741824 76: TypePointer Output 6(float)
81: 6(float) Constant 1090519040 78: 29(int) Constant 1
86(HS_CONSTANT_OUT): TypeStruct 83: 6(float) Constant 1073741824
87: TypePointer Output 86(HS_CONSTANT_OUT) 85: 6(float) Constant 1090519040
88(@patchConstantOutput): 87(ptr) Variable Output 90(HS_CONSTANT_OUT): TypeStruct
91: TypePointer Output 90(HS_CONSTANT_OUT)
92(@patchConstantOutput): 91(ptr) Variable Output
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
38(ip): 12(ptr) Variable Function 38(ip): 12(ptr) Variable Function
42(m_cpid): 13(ptr) Variable Function 42(m_cpid): 13(ptr) Variable Function
48(param): 12(ptr) Variable Function 50(param): 12(ptr) Variable Function
50(param): 13(ptr) Variable Function 52(param): 13(ptr) Variable Function
61(@patchConstantResult): 60(ptr) Variable Function 65(@patchConstantResult): 64(ptr) Variable Function
63(param): 13(ptr) Variable Function 67(param): 13(ptr) Variable Function
41: 11 Load 40(ip) 41: 11 Load 40(ip)
Store 38(ip) 41 Store 38(ip) 41
45: 9(int) Load 44(m_cpid) 45: 9(int) Load 44(m_cpid)
Store 42(m_cpid) 45 Store 42(m_cpid) 45
49: 11 Load 38(ip) 49: 9(int) Load 44(m_cpid)
Store 48(param) 49 51: 11 Load 38(ip)
51: 9(int) Load 42(m_cpid)
Store 50(param) 51 Store 50(param) 51
52: 14(HS_OUT) FunctionCall 18(@main(struct-VS_OUT-vf31[4];u1;) 48(param) 50(param) 53: 9(int) Load 42(m_cpid)
Store 47(@entryPointOutput) 52 Store 52(param) 53
ControlBarrier 20 53 54 54: 14(HS_OUT) FunctionCall 18(@main(struct-VS_OUT-vf31[4];u1;) 50(param) 52(param)
55: 9(int) Load 44(m_cpid) 56: 55(ptr) AccessChain 48(@entryPointOutput) 49
57: 56(bool) IEqual 55 30 Store 56 54
SelectionMerge 59 None ControlBarrier 20 57 58
BranchConditional 57 58 59 59: 9(int) Load 44(m_cpid)
58: Label 61: 60(bool) IEqual 59 30
64: 9(int) Load 62(pid) SelectionMerge 63 None
Store 63(param) 64 BranchConditional 61 62 63
65:22(HS_CONSTANT_OUT) FunctionCall 25(PCF(u1;) 63(param) 62: Label
Store 61(@patchConstantResult) 65 68: 9(int) Load 66(pid)
70: 69(ptr) AccessChain 61(@patchConstantResult) 30 30 Store 67(param) 68
71: 6(float) Load 70 69:22(HS_CONSTANT_OUT) FunctionCall 25(PCF(u1;) 67(param)
73: 72(ptr) AccessChain 68(@patchConstantOutput_edges) 30 Store 65(@patchConstantResult) 69
Store 73 71 74: 73(ptr) AccessChain 65(@patchConstantResult) 30 30
75: 69(ptr) AccessChain 61(@patchConstantResult) 30 74 75: 6(float) Load 74
76: 6(float) Load 75 77: 76(ptr) AccessChain 72(@patchConstantOutput_edges) 30
77: 72(ptr) AccessChain 68(@patchConstantOutput_edges) 74 Store 77 75
Store 77 76 79: 73(ptr) AccessChain 65(@patchConstantResult) 30 78
Branch 59 80: 6(float) Load 79
59: Label 81: 76(ptr) AccessChain 72(@patchConstantOutput_edges) 78
Store 81 80
Branch 63
63: Label
Return Return
FunctionEnd FunctionEnd
18(@main(struct-VS_OUT-vf31[4];u1;): 14(HS_OUT) Function None 15 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 25(PCF(u1;):22(HS_CONSTANT_OUT) Function None 23
24(pid): 13(ptr) FunctionParameter 24(pid): 13(ptr) FunctionParameter
26: Label 26: Label
78(output): 60(ptr) Variable Function 82(output): 64(ptr) Variable Function
80: 69(ptr) AccessChain 78(output) 30 30 84: 73(ptr) AccessChain 82(output) 30 30
Store 80 79 Store 84 83
82: 69(ptr) AccessChain 78(output) 30 74 86: 73(ptr) AccessChain 82(output) 30 78
Store 82 81 Store 86 85
83:22(HS_CONSTANT_OUT) Load 78(output) 87:22(HS_CONSTANT_OUT) Load 82(output)
ReturnValue 83 ReturnValue 87
FunctionEnd FunctionEnd

View file

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

View file

@ -27,7 +27,9 @@ vertices = 3
0:? 'cpid' ( temp uint) 0:? 'cpid' ( temp uint)
0:? 'cpid' ( in uint InvocationID) 0:? 'cpid' ( in uint InvocationID)
0:27 move second child to first child ( temp structure{ temp 3-component vector of float val}) 0:27 move second child to first child ( temp structure{ temp 3-component vector of float val})
0:? '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float val}) 0:27 indirect index ( temp structure{ temp 3-component vector of float val})
0:? '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float val})
0:? 'cpid' ( in uint InvocationID)
0:27 Function Call: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val}) 0:27 Function Call: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val})
0:? 'i' ( temp 3-element array of structure{ temp 3-component vector of float val}) 0:? 'i' ( temp 3-element array of structure{ temp 3-component vector of float val})
0:? 'cpid' ( temp uint) 0:? 'cpid' ( temp uint)
@ -185,7 +187,7 @@ vertices = 3
0:42 Branch: Return with expression 0:42 Branch: Return with expression
0:42 'o' ( temp structure{ temp 3-element array of float tfactor, temp float flInFactor}) 0:42 'o' ( temp structure{ temp 3-element array of float tfactor, temp float flInFactor})
0:? Linker Objects 0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float val}) 0:? '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float val})
0:? 'i' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float val}) 0:? 'i' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float val})
0:? 'cpid' ( in uint InvocationID) 0:? 'cpid' ( in uint InvocationID)
0:? '@patchConstantOutput' (layout( location=1) patch out structure{}) 0:? '@patchConstantOutput' (layout( location=1) patch out structure{})
@ -224,7 +226,9 @@ vertices = 3
0:? 'cpid' ( temp uint) 0:? 'cpid' ( temp uint)
0:? 'cpid' ( in uint InvocationID) 0:? 'cpid' ( in uint InvocationID)
0:27 move second child to first child ( temp structure{ temp 3-component vector of float val}) 0:27 move second child to first child ( temp structure{ temp 3-component vector of float val})
0:? '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float val}) 0:27 indirect index ( temp structure{ temp 3-component vector of float val})
0:? '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float val})
0:? 'cpid' ( in uint InvocationID)
0:27 Function Call: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val}) 0:27 Function Call: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val})
0:? 'i' ( temp 3-element array of structure{ temp 3-component vector of float val}) 0:? 'i' ( temp 3-element array of structure{ temp 3-component vector of float val})
0:? 'cpid' ( temp uint) 0:? 'cpid' ( temp uint)
@ -382,7 +386,7 @@ vertices = 3
0:42 Branch: Return with expression 0:42 Branch: Return with expression
0:42 'o' ( temp structure{ temp 3-element array of float tfactor, temp float flInFactor}) 0:42 'o' ( temp structure{ temp 3-element array of float tfactor, temp float flInFactor})
0:? Linker Objects 0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float val}) 0:? '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float val})
0:? 'i' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float val}) 0:? 'i' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float val})
0:? 'cpid' ( in uint InvocationID) 0:? 'cpid' ( in uint InvocationID)
0:? '@patchConstantOutput' (layout( location=1) patch out structure{}) 0:? '@patchConstantOutput' (layout( location=1) patch out structure{})
@ -391,12 +395,12 @@ vertices = 3
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 124 // Id's are bound by 127
Capability Tessellation Capability Tessellation
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint TessellationControl 4 "main" 41 45 48 91 105 123 EntryPoint TessellationControl 4 "main" 41 45 48 94 108 126
ExecutionMode 4 OutputVertices 3 ExecutionMode 4 OutputVertices 3
Name 4 "main" Name 4 "main"
Name 8 "hs_in_t" Name 8 "hs_in_t"
@ -417,33 +421,33 @@ vertices = 3
Name 43 "cpid" Name 43 "cpid"
Name 45 "cpid" Name 45 "cpid"
Name 48 "@entryPointOutput" Name 48 "@entryPointOutput"
Name 49 "param" Name 50 "param"
Name 51 "param" Name 52 "param"
Name 63 "pcf_out" Name 66 "pcf_out"
Name 64 "i" Name 67 "i"
Name 65 "param" Name 68 "param"
Name 67 "param" Name 70 "param"
Name 71 "i" Name 74 "i"
Name 72 "param" Name 75 "param"
Name 74 "param" Name 77 "param"
Name 78 "i" Name 81 "i"
Name 79 "param" Name 82 "param"
Name 81 "param" Name 84 "param"
Name 85 "@patchConstantResult" Name 88 "@patchConstantResult"
Name 91 "@patchConstantOutput_tfactor" Name 94 "@patchConstantOutput_tfactor"
Name 105 "@patchConstantOutput_flInFactor" Name 108 "@patchConstantOutput_flInFactor"
Name 109 "o" Name 112 "o"
Name 121 "hs_pcf_t" Name 124 "hs_pcf_t"
Name 123 "@patchConstantOutput" Name 126 "@patchConstantOutput"
Decorate 41(i) Location 0 Decorate 41(i) Location 0
Decorate 45(cpid) BuiltIn InvocationId Decorate 45(cpid) BuiltIn InvocationId
Decorate 48(@entryPointOutput) Location 0 Decorate 48(@entryPointOutput) Location 0
Decorate 91(@patchConstantOutput_tfactor) Patch Decorate 94(@patchConstantOutput_tfactor) Patch
Decorate 91(@patchConstantOutput_tfactor) BuiltIn TessLevelOuter Decorate 94(@patchConstantOutput_tfactor) BuiltIn TessLevelOuter
Decorate 105(@patchConstantOutput_flInFactor) Patch Decorate 108(@patchConstantOutput_flInFactor) Patch
Decorate 105(@patchConstantOutput_flInFactor) BuiltIn TessLevelInner Decorate 108(@patchConstantOutput_flInFactor) BuiltIn TessLevelInner
Decorate 123(@patchConstantOutput) Patch Decorate 126(@patchConstantOutput) Patch
Decorate 123(@patchConstantOutput) Location 1 Decorate 126(@patchConstantOutput) Location 1
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
@ -468,101 +472,104 @@ vertices = 3
41(i): 40(ptr) Variable Input 41(i): 40(ptr) Variable Input
44: TypePointer Input 9(int) 44: TypePointer Input 9(int)
45(cpid): 44(ptr) Variable Input 45(cpid): 44(ptr) Variable Input
47: TypePointer Output 14(hs_out_t) 47: TypePointer Output 20
48(@entryPointOutput): 47(ptr) Variable Output 48(@entryPointOutput): 47(ptr) Variable Output
54: 9(int) Constant 2 55: TypePointer Output 14(hs_out_t)
55: 9(int) Constant 1 57: 9(int) Constant 2
56: 9(int) Constant 0 58: 9(int) Constant 1
58: TypeBool 59: 9(int) Constant 0
62: TypePointer Function 20 61: TypeBool
70: 29(int) Constant 1 65: TypePointer Function 20
77: 29(int) Constant 2 73: 29(int) Constant 1
84: TypePointer Function 22(hs_pcf_t) 80: 29(int) Constant 2
88: 9(int) Constant 4 87: TypePointer Function 22(hs_pcf_t)
89: TypeArray 6(float) 88 91: 9(int) Constant 4
90: TypePointer Output 89 92: TypeArray 6(float) 91
91(@patchConstantOutput_tfactor): 90(ptr) Variable Output 93: TypePointer Output 92
92: TypePointer Function 6(float) 94(@patchConstantOutput_tfactor): 93(ptr) Variable Output
95: TypePointer Output 6(float) 95: TypePointer Function 6(float)
103: TypeArray 6(float) 54 98: TypePointer Output 6(float)
104: TypePointer Output 103 106: TypeArray 6(float) 57
105(@patchConstantOutput_flInFactor): 104(ptr) Variable Output 107: TypePointer Output 106
116: 6(float) Constant 1082130432 108(@patchConstantOutput_flInFactor): 107(ptr) Variable Output
121(hs_pcf_t): TypeStruct 119: 6(float) Constant 1082130432
122: TypePointer Output 121(hs_pcf_t) 124(hs_pcf_t): TypeStruct
123(@patchConstantOutput): 122(ptr) Variable Output 125: TypePointer Output 124(hs_pcf_t)
126(@patchConstantOutput): 125(ptr) Variable Output
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
39(i): 12(ptr) Variable Function 39(i): 12(ptr) Variable Function
43(cpid): 13(ptr) Variable Function 43(cpid): 13(ptr) Variable Function
49(param): 12(ptr) Variable Function 50(param): 12(ptr) Variable Function
51(param): 13(ptr) Variable Function 52(param): 13(ptr) Variable Function
63(pcf_out): 62(ptr) Variable Function 66(pcf_out): 65(ptr) Variable Function
64(i): 12(ptr) Variable Function 67(i): 12(ptr) Variable Function
65(param): 12(ptr) Variable Function 68(param): 12(ptr) Variable Function
67(param): 13(ptr) Variable Function 70(param): 13(ptr) Variable Function
71(i): 12(ptr) Variable Function 74(i): 12(ptr) Variable Function
72(param): 12(ptr) Variable Function 75(param): 12(ptr) Variable Function
74(param): 13(ptr) Variable Function 77(param): 13(ptr) Variable Function
78(i): 12(ptr) Variable Function 81(i): 12(ptr) Variable Function
79(param): 12(ptr) Variable Function 82(param): 12(ptr) Variable Function
81(param): 13(ptr) Variable Function 84(param): 13(ptr) Variable Function
85(@patchConstantResult): 84(ptr) Variable Function 88(@patchConstantResult): 87(ptr) Variable Function
42: 11 Load 41(i) 42: 11 Load 41(i)
Store 39(i) 42 Store 39(i) 42
46: 9(int) Load 45(cpid) 46: 9(int) Load 45(cpid)
Store 43(cpid) 46 Store 43(cpid) 46
50: 11 Load 39(i) 49: 9(int) Load 45(cpid)
Store 49(param) 50 51: 11 Load 39(i)
52: 9(int) Load 43(cpid) Store 50(param) 51
Store 51(param) 52 53: 9(int) Load 43(cpid)
53:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 49(param) 51(param) Store 52(param) 53
Store 48(@entryPointOutput) 53 54:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 50(param) 52(param)
ControlBarrier 54 55 56 56: 55(ptr) AccessChain 48(@entryPointOutput) 49
57: 9(int) Load 45(cpid) Store 56 54
59: 58(bool) IEqual 57 30 ControlBarrier 57 58 59
SelectionMerge 61 None 60: 9(int) Load 45(cpid)
BranchConditional 59 60 61 62: 61(bool) IEqual 60 30
60: Label SelectionMerge 64 None
66: 11 Load 64(i) BranchConditional 62 63 64
Store 65(param) 66 63: Label
Store 67(param) 56 69: 11 Load 67(i)
68:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 65(param) 67(param) Store 68(param) 69
69: 27(ptr) AccessChain 63(pcf_out) 30 Store 70(param) 59
Store 69 68 71:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 68(param) 70(param)
73: 11 Load 71(i) 72: 27(ptr) AccessChain 66(pcf_out) 30
Store 72(param) 73 Store 72 71
Store 74(param) 55 76: 11 Load 74(i)
75:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 72(param) 74(param) Store 75(param) 76
76: 27(ptr) AccessChain 63(pcf_out) 70 Store 77(param) 58
Store 76 75 78:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 75(param) 77(param)
80: 11 Load 78(i) 79: 27(ptr) AccessChain 66(pcf_out) 73
Store 79(param) 80 Store 79 78
Store 81(param) 54 83: 11 Load 81(i)
82:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 79(param) 81(param) Store 82(param) 83
83: 27(ptr) AccessChain 63(pcf_out) 77 Store 84(param) 57
Store 83 82 85:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 82(param) 84(param)
86: 20 Load 63(pcf_out) 86: 27(ptr) AccessChain 66(pcf_out) 80
87:22(hs_pcf_t) FunctionCall 25(PCF(struct-hs_out_t-vf31[3];) 86 Store 86 85
Store 85(@patchConstantResult) 87 89: 20 Load 66(pcf_out)
93: 92(ptr) AccessChain 85(@patchConstantResult) 30 30 90:22(hs_pcf_t) FunctionCall 25(PCF(struct-hs_out_t-vf31[3];) 89
94: 6(float) Load 93 Store 88(@patchConstantResult) 90
96: 95(ptr) AccessChain 91(@patchConstantOutput_tfactor) 30 96: 95(ptr) AccessChain 88(@patchConstantResult) 30 30
Store 96 94 97: 6(float) Load 96
97: 92(ptr) AccessChain 85(@patchConstantResult) 30 70 99: 98(ptr) AccessChain 94(@patchConstantOutput_tfactor) 30
98: 6(float) Load 97 Store 99 97
99: 95(ptr) AccessChain 91(@patchConstantOutput_tfactor) 70 100: 95(ptr) AccessChain 88(@patchConstantResult) 30 73
Store 99 98
100: 92(ptr) AccessChain 85(@patchConstantResult) 30 77
101: 6(float) Load 100 101: 6(float) Load 100
102: 95(ptr) AccessChain 91(@patchConstantOutput_tfactor) 77 102: 98(ptr) AccessChain 94(@patchConstantOutput_tfactor) 73
Store 102 101 Store 102 101
106: 92(ptr) AccessChain 85(@patchConstantResult) 70 103: 95(ptr) AccessChain 88(@patchConstantResult) 30 80
107: 6(float) Load 106 104: 6(float) Load 103
108: 95(ptr) AccessChain 105(@patchConstantOutput_flInFactor) 30 105: 98(ptr) AccessChain 94(@patchConstantOutput_tfactor) 80
Store 108 107 Store 105 104
Branch 61 109: 95(ptr) AccessChain 88(@patchConstantResult) 73
61: Label 110: 6(float) Load 109
111: 98(ptr) AccessChain 108(@patchConstantOutput_flInFactor) 30
Store 111 110
Branch 64
64: Label
Return Return
FunctionEnd FunctionEnd
18(@main(struct-hs_in_t-vf31[3];u1;):14(hs_out_t) Function None 15 18(@main(struct-hs_in_t-vf31[3];u1;):14(hs_out_t) Function None 15
@ -581,18 +588,18 @@ vertices = 3
25(PCF(struct-hs_out_t-vf31[3];):22(hs_pcf_t) Function None 23 25(PCF(struct-hs_out_t-vf31[3];):22(hs_pcf_t) Function None 23
24(pcf_out): 20 FunctionParameter 24(pcf_out): 20 FunctionParameter
26: Label 26: Label
109(o): 84(ptr) Variable Function 112(o): 87(ptr) Variable Function
110: 6(float) CompositeExtract 24(pcf_out) 0 0 0 113: 6(float) CompositeExtract 24(pcf_out) 0 0 0
111: 92(ptr) AccessChain 109(o) 30 30 114: 95(ptr) AccessChain 112(o) 30 30
Store 111 110 Store 114 113
112: 6(float) CompositeExtract 24(pcf_out) 1 0 0 115: 6(float) CompositeExtract 24(pcf_out) 1 0 0
113: 92(ptr) AccessChain 109(o) 30 70 116: 95(ptr) AccessChain 112(o) 30 73
Store 113 112 Store 116 115
114: 6(float) CompositeExtract 24(pcf_out) 2 0 0 117: 6(float) CompositeExtract 24(pcf_out) 2 0 0
115: 92(ptr) AccessChain 109(o) 30 77 118: 95(ptr) AccessChain 112(o) 30 80
Store 115 114 Store 118 117
117: 92(ptr) AccessChain 109(o) 70 120: 95(ptr) AccessChain 112(o) 73
Store 117 116 Store 120 119
118:22(hs_pcf_t) Load 109(o) 121:22(hs_pcf_t) Load 112(o)
ReturnValue 118 ReturnValue 121
FunctionEnd FunctionEnd

View file

@ -27,7 +27,9 @@ vertices = 3
0:? 'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint}) 0:? 'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
0:? 'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint}) 0:? 'ip' (layout( location=0) in 3-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: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 3-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[3]; ( temp structure{ temp 3-component vector of float cpoint}) 0:26 Function Call: @main(struct-VS_OUT-vf31[3]; ( temp structure{ temp 3-component vector of float cpoint})
0:? 'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint}) 0:? 'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
0:? Barrier ( temp void) 0:? Barrier ( temp void)
@ -43,7 +45,7 @@ vertices = 3
0:33 Function Definition: PCF( ( temp void) 0:33 Function Definition: PCF( ( temp void)
0:33 Function Parameters: 0:33 Function Parameters:
0:? Linker Objects 0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint}) 0:? '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float cpoint})
0:? 'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint}) 0:? 'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint})
0:? 'InvocationId' ( in uint InvocationID) 0:? 'InvocationId' ( in uint InvocationID)
@ -79,7 +81,9 @@ vertices = 3
0:? 'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint}) 0:? 'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
0:? 'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint}) 0:? 'ip' (layout( location=0) in 3-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: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 3-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[3]; ( temp structure{ temp 3-component vector of float cpoint}) 0:26 Function Call: @main(struct-VS_OUT-vf31[3]; ( temp structure{ temp 3-component vector of float cpoint})
0:? 'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint}) 0:? 'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
0:? Barrier ( temp void) 0:? Barrier ( temp void)
@ -95,18 +99,18 @@ vertices = 3
0:33 Function Definition: PCF( ( temp void) 0:33 Function Definition: PCF( ( temp void)
0:33 Function Parameters: 0:33 Function Parameters:
0:? Linker Objects 0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint}) 0:? '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float cpoint})
0:? 'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint}) 0:? 'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint})
0:? 'InvocationId' ( in uint InvocationID) 0:? 'InvocationId' ( in uint InvocationID)
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 51 // Id's are bound by 55
Capability Tessellation Capability Tessellation
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint TessellationControl 4 "main" 33 36 44 EntryPoint TessellationControl 4 "main" 33 37 39
ExecutionMode 4 OutputVertices 3 ExecutionMode 4 OutputVertices 3
Name 4 "main" Name 4 "main"
Name 8 "VS_OUT" Name 8 "VS_OUT"
@ -119,12 +123,12 @@ vertices = 3
Name 21 "output" Name 21 "output"
Name 31 "ip" Name 31 "ip"
Name 33 "ip" Name 33 "ip"
Name 36 "@entryPointOutput" Name 37 "@entryPointOutput"
Name 37 "param" Name 39 "InvocationId"
Name 44 "InvocationId" Name 41 "param"
Decorate 33(ip) Location 0 Decorate 33(ip) Location 0
Decorate 36(@entryPointOutput) Location 0 Decorate 37(@entryPointOutput) Location 0
Decorate 44(InvocationId) BuiltIn InvocationId Decorate 39(InvocationId) BuiltIn InvocationId
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
@ -142,33 +146,37 @@ vertices = 3
24: TypePointer Function 7(fvec3) 24: TypePointer Function 7(fvec3)
32: TypePointer Input 11 32: TypePointer Input 11
33(ip): 32(ptr) Variable Input 33(ip): 32(ptr) Variable Input
35: TypePointer Output 13(HS_OUT) 35: TypeArray 13(HS_OUT) 10
36(@entryPointOutput): 35(ptr) Variable Output 36: TypePointer Output 35
40: 9(int) Constant 2 37(@entryPointOutput): 36(ptr) Variable Output
41: 9(int) Constant 1 38: TypePointer Input 9(int)
42: 9(int) Constant 0 39(InvocationId): 38(ptr) Variable Input
43: TypePointer Input 9(int) 44: TypePointer Output 13(HS_OUT)
44(InvocationId): 43(ptr) Variable Input 46: 9(int) Constant 2
46: TypeBool 47: 9(int) Constant 1
48: 9(int) Constant 0
50: TypeBool
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
31(ip): 12(ptr) Variable Function 31(ip): 12(ptr) Variable Function
37(param): 12(ptr) Variable Function 41(param): 12(ptr) Variable Function
34: 11 Load 33(ip) 34: 11 Load 33(ip)
Store 31(ip) 34 Store 31(ip) 34
38: 11 Load 31(ip) 40: 9(int) Load 39(InvocationId)
Store 37(param) 38 42: 11 Load 31(ip)
39: 13(HS_OUT) FunctionCall 16(@main(struct-VS_OUT-vf31[3];) 37(param) Store 41(param) 42
Store 36(@entryPointOutput) 39 43: 13(HS_OUT) FunctionCall 16(@main(struct-VS_OUT-vf31[3];) 41(param)
ControlBarrier 40 41 42 45: 44(ptr) AccessChain 37(@entryPointOutput) 40
45: 9(int) Load 44(InvocationId) Store 45 43
47: 46(bool) IEqual 45 23 ControlBarrier 46 47 48
SelectionMerge 49 None 49: 9(int) Load 39(InvocationId)
BranchConditional 47 48 49 51: 50(bool) IEqual 49 23
48: Label SelectionMerge 53 None
50: 2 FunctionCall 18(PCF() BranchConditional 51 52 53
Branch 49 52: Label
49: Label 54: 2 FunctionCall 18(PCF()
Branch 53
53: Label
Return Return
FunctionEnd FunctionEnd
16(@main(struct-VS_OUT-vf31[3];): 13(HS_OUT) Function None 14 16(@main(struct-VS_OUT-vf31[3];): 13(HS_OUT) Function None 14

View file

@ -1598,48 +1598,10 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
return paramNodes; return paramNodes;
} }
//
// Do all special handling for the entry point, including wrapping // Handle all [attrib] attribute for the shader entry point
// the shader's entry point with the official entry point that will call it. void HlslParseContext::handleEntryPointAttributes(const TSourceLoc& loc, TFunction& userFunction, const TAttributeMap& attributes)
//
// The following:
//
// retType shaderEntryPoint(args...) // shader declared entry point
// { body }
//
// Becomes
//
// out retType ret;
// in iargs<that are input>...;
// out oargs<that are output> ...;
//
// void shaderEntryPoint() // synthesized, but official, entry point
// {
// args<that are input> = iargs...;
// ret = @shaderEntryPoint(args...);
// oargs = args<that are output>...;
// }
//
// The symbol table will still map the original entry point name to the
// the modified function and it's new name:
//
// symbol table: shaderEntryPoint -> @shaderEntryPoint
//
// Returns nullptr if no entry-point tree was built, otherwise, returns
// a subtree that creates the entry point.
//
TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunction& userFunction, const TAttributeMap& attributes)
{ {
// if we aren't in the entry point, fix the IO as such and exit
if (userFunction.getName().compare(intermediate.getEntryPointName().c_str()) != 0) {
remapNonEntryPointIO(userFunction);
return nullptr;
}
entryPointFunction = &userFunction; // needed in finish()
// entry point logic...
// Handle entry-point function attributes // Handle entry-point function attributes
const TIntermAggregate* numThreads = attributes[EatNumThreads]; const TIntermAggregate* numThreads = attributes[EatNumThreads];
if (numThreads != nullptr) { if (numThreads != nullptr) {
@ -1691,7 +1653,11 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
error(loc, "unsupported domain type", domainStr.c_str(), ""); error(loc, "unsupported domain type", domainStr.c_str(), "");
} }
if (! intermediate.setInputPrimitive(domain)) { if (language == EShLangTessEvaluation) {
if (! intermediate.setInputPrimitive(domain))
error(loc, "cannot change previously set domain", TQualifier::getGeometryString(domain), "");
} else {
if (! intermediate.setOutputPrimitive(domain))
error(loc, "cannot change previously set domain", TQualifier::getGeometryString(domain), ""); error(loc, "cannot change previously set domain", TQualifier::getGeometryString(domain), "");
} }
} }
@ -1770,6 +1736,52 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
} }
} }
} }
}
//
// Do all special handling for the entry point, including wrapping
// the shader's entry point with the official entry point that will call it.
//
// The following:
//
// retType shaderEntryPoint(args...) // shader declared entry point
// { body }
//
// Becomes
//
// out retType ret;
// in iargs<that are input>...;
// out oargs<that are output> ...;
//
// void shaderEntryPoint() // synthesized, but official, entry point
// {
// args<that are input> = iargs...;
// ret = @shaderEntryPoint(args...);
// oargs = args<that are output>...;
// }
//
// The symbol table will still map the original entry point name to the
// the modified function and it's new name:
//
// symbol table: shaderEntryPoint -> @shaderEntryPoint
//
// Returns nullptr if no entry-point tree was built, otherwise, returns
// a subtree that creates the entry point.
//
TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunction& userFunction, const TAttributeMap& attributes)
{
// if we aren't in the entry point, fix the IO as such and exit
if (userFunction.getName().compare(intermediate.getEntryPointName().c_str()) != 0) {
remapNonEntryPointIO(userFunction);
return nullptr;
}
entryPointFunction = &userFunction; // needed in finish()
// Handle entry point attributes
handleEntryPointAttributes(loc, userFunction, attributes);
// entry point logic...
// Move parameters and return value to shader in/out // Move parameters and return value to shader in/out
TVariable* entryPointOutput; // gets created in remapEntryPointIO TVariable* entryPointOutput; // gets created in remapEntryPointIO
@ -1838,10 +1850,37 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
currentCaller = userFunction.getMangledName(); currentCaller = userFunction.getMangledName();
// Return value // Return value
if (entryPointOutput) if (entryPointOutput) {
intermediate.growAggregate(synthBody, handleAssign(loc, EOpAssign, TIntermTyped* returnAssign;
intermediate.addSymbol(*entryPointOutput), callReturn));
else if (language == EShLangTessControl) {
TIntermSymbol* invocationIdSym = findLinkageSymbol(EbvInvocationId);
// If there is no user declared invocation ID, we must make one.
if (invocationIdSym == nullptr) {
TType invocationIdType(EbtUint, EvqIn, 1);
TString* invocationIdName = NewPoolTString("InvocationId");
invocationIdType.getQualifier().builtIn = EbvInvocationId;
TVariable* variable = makeInternalVariable(*invocationIdName, invocationIdType);
globalQualifierFix(loc, variable->getWritableType().getQualifier());
trackLinkage(*variable);
invocationIdSym = intermediate.addSymbol(*variable);
}
TIntermTyped* element = intermediate.addIndex(EOpIndexIndirect, intermediate.addSymbol(*entryPointOutput),
invocationIdSym, loc);
element->setType(callReturn->getType());
returnAssign = handleAssign(loc, EOpAssign, element, callReturn);
} else {
returnAssign = handleAssign(loc, EOpAssign, intermediate.addSymbol(*entryPointOutput), callReturn);
}
intermediate.growAggregate(synthBody, returnAssign);
} else
intermediate.growAggregate(synthBody, callReturn); intermediate.growAggregate(synthBody, callReturn);
// Output copies // Output copies
@ -1914,11 +1953,30 @@ void HlslParseContext::remapEntryPointIO(TFunction& function, TVariable*& return
}; };
// return value is actually a shader-scoped output (out) // return value is actually a shader-scoped output (out)
if (function.getType().getBasicType() == EbtVoid) if (function.getType().getBasicType() == EbtVoid) {
returnValue = nullptr; returnValue = nullptr;
else } else {
if (language == EShLangTessControl) {
// tessellation evaluation in HLSL writes a per-ctrl-pt value, but it needs to be an
// array in SPIR-V semantics. We'll write to it indexed by invocation ID.
returnValue = makeIoVariable("@entryPointOutput", function.getWritableType(), EvqVaryingOut); returnValue = makeIoVariable("@entryPointOutput", function.getWritableType(), EvqVaryingOut);
TType outputType;
outputType.shallowCopy(function.getType());
// vertices has necessarily already been set when handling entry point attributes.
TArraySizes arraySizes;
arraySizes.addInnerSize(intermediate.getVertices());
outputType.newArraySizes(arraySizes);
clearUniformInputOutput(function.getWritableType().getQualifier());
returnValue = makeIoVariable("@entryPointOutput", outputType, EvqVaryingOut);
} else {
returnValue = makeIoVariable("@entryPointOutput", function.getWritableType(), EvqVaryingOut);
}
}
// parameters are actually shader-scoped inputs and outputs (in or out) // parameters are actually shader-scoped inputs and outputs (in or out)
for (int i = 0; i < function.getParamCount(); i++) { for (int i = 0; i < function.getParamCount(); i++) {
TType& paramType = *function[i].type; TType& paramType = *function[i].type;
@ -7410,6 +7468,17 @@ void HlslParseContext::clearUniformInputOutput(TQualifier& qualifier)
correctUniform(qualifier); correctUniform(qualifier);
} }
// Return a symbol for the linkage variable of the given TBuiltInVariable type
TIntermSymbol* HlslParseContext::findLinkageSymbol(TBuiltInVariable biType) const
{
const auto it = builtInLinkageSymbols.find(biType);
if (it == builtInLinkageSymbols.end()) // if it wasn't declared by the user, return nullptr
return nullptr;
return intermediate.addSymbol(*it->second->getAsVariable());
}
// Add patch constant function invocation // Add patch constant function invocation
void HlslParseContext::addPatchConstantInvocation() void HlslParseContext::addPatchConstantInvocation()
{ {
@ -7481,15 +7550,6 @@ void HlslParseContext::addPatchConstantInvocation()
} }
}; };
// Return a symbol for the linkage variable of the given TBuiltInVariable type
const auto findLinkageSymbol = [this](TBuiltInVariable biType) -> TIntermSymbol* {
const auto it = builtInLinkageSymbols.find(biType);
if (it == builtInLinkageSymbols.end()) // if it wasn't declared by the user, return nullptr
return nullptr;
return intermediate.addSymbol(*it->second->getAsVariable());
};
const auto isPerCtrlPt = [this](const TType& type) { const auto isPerCtrlPt = [this](const TType& type) {
// TODO: this is not sufficient to reject all such cases in malformed shaders. // TODO: this is not sufficient to reject all such cases in malformed shaders.
return type.isArray() && !type.isRuntimeSizedArray(); return type.isArray() && !type.isRuntimeSizedArray();

View file

@ -80,6 +80,7 @@ public:
void handleFunctionDeclarator(const TSourceLoc&, TFunction& function, bool prototype); void handleFunctionDeclarator(const TSourceLoc&, TFunction& function, bool prototype);
TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&, const TAttributeMap&, TIntermNode*& entryPointTree); TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&, const TAttributeMap&, TIntermNode*& entryPointTree);
TIntermNode* transformEntryPoint(const TSourceLoc&, TFunction&, const TAttributeMap&); TIntermNode* transformEntryPoint(const TSourceLoc&, TFunction&, const TAttributeMap&);
void handleEntryPointAttributes(const TSourceLoc&, TFunction&, const TAttributeMap&);
void handleFunctionBody(const TSourceLoc&, TFunction&, TIntermNode* functionBody, TIntermNode*& node); void handleFunctionBody(const TSourceLoc&, TFunction&, TIntermNode* functionBody, TIntermNode*& node);
void remapEntryPointIO(TFunction& function, TVariable*& returnValue, TVector<TVariable*>& inputs, TVector<TVariable*>& outputs); void remapEntryPointIO(TFunction& function, TVariable*& returnValue, TVector<TVariable*>& inputs, TVector<TVariable*>& outputs);
void remapNonEntryPointIO(TFunction& function); void remapNonEntryPointIO(TFunction& function);
@ -283,6 +284,9 @@ protected:
void finish() override; // post-processing void finish() override; // post-processing
// Linkage symbol helpers
TIntermSymbol* findLinkageSymbol(TBuiltInVariable biType) const;
// Current state of parsing // Current state of parsing
struct TPragma contextPragma; struct TPragma contextPragma;
int loopNestingLevel; // 0 if outside all loops int loopNestingLevel; // 0 if outside all loops