HLSL: require tessellation factors to be fixed size arrays
SPIR-V requires that tessellation factor arrays be size 4 (outer) or 2 (inner). HLSL allows other sizes such as 3, or even scalars. This commit converts between them by forcing the IO types to be the SPIR-V size, and allowing copies between the internal and IO types to handle these cases.
This commit is contained in:
parent
9cee73e028
commit
194f0f39ec
6 changed files with 216 additions and 162 deletions
|
|
@ -51,7 +51,7 @@ vertices = 4
|
|||
0:? Sequence
|
||||
0:? move second child to first child ( temp float)
|
||||
0:? direct index ( patch out float TessLevelOuter)
|
||||
0:? '@patchConstantOutput_edges' ( patch out 2-element array of float TessLevelOuter)
|
||||
0:? '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
|
||||
0:? Constant:
|
||||
0:? 0 (const int)
|
||||
0:? direct index ( temp float)
|
||||
|
|
@ -63,7 +63,7 @@ vertices = 4
|
|||
0:? 0 (const int)
|
||||
0:? move second child to first child ( temp float)
|
||||
0:? direct index ( patch out float TessLevelOuter)
|
||||
0:? '@patchConstantOutput_edges' ( patch out 2-element array of float TessLevelOuter)
|
||||
0:? '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
|
||||
0:? Constant:
|
||||
0:? 1 (const int)
|
||||
0:? direct index ( temp float)
|
||||
|
|
@ -105,7 +105,7 @@ vertices = 4
|
|||
0:? 'm_cpid' ( in uint InvocationID)
|
||||
0:? 'pid' ( in uint PrimitiveID)
|
||||
0:? '@patchConstantOutput' (layout( location=1) patch out structure{})
|
||||
0:? '@patchConstantOutput_edges' ( patch out 2-element array of float TessLevelOuter)
|
||||
0:? '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
|
||||
|
||||
|
||||
Linked tessellation control stage:
|
||||
|
|
@ -163,7 +163,7 @@ vertices = 4
|
|||
0:? Sequence
|
||||
0:? move second child to first child ( temp float)
|
||||
0:? direct index ( patch out float TessLevelOuter)
|
||||
0:? '@patchConstantOutput_edges' ( patch out 2-element array of float TessLevelOuter)
|
||||
0:? '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
|
||||
0:? Constant:
|
||||
0:? 0 (const int)
|
||||
0:? direct index ( temp float)
|
||||
|
|
@ -175,7 +175,7 @@ vertices = 4
|
|||
0:? 0 (const int)
|
||||
0:? move second child to first child ( temp float)
|
||||
0:? direct index ( patch out float TessLevelOuter)
|
||||
0:? '@patchConstantOutput_edges' ( patch out 2-element array of float TessLevelOuter)
|
||||
0:? '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
|
||||
0:? Constant:
|
||||
0:? 1 (const int)
|
||||
0:? direct index ( temp float)
|
||||
|
|
@ -217,16 +217,16 @@ vertices = 4
|
|||
0:? 'm_cpid' ( in uint InvocationID)
|
||||
0:? 'pid' ( in uint PrimitiveID)
|
||||
0:? '@patchConstantOutput' (layout( location=1) patch out structure{})
|
||||
0:? '@patchConstantOutput_edges' ( patch out 2-element array of float TessLevelOuter)
|
||||
0:? '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 88
|
||||
// Id's are bound by 89
|
||||
|
||||
Capability Tessellation
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint TessellationControl 4 "main" 40 44 47 62 67 87
|
||||
EntryPoint TessellationControl 4 "main" 40 44 47 62 68 88
|
||||
ExecutionMode 4 OutputVertices 4
|
||||
Name 4 "main"
|
||||
Name 8 "VS_OUT"
|
||||
|
|
@ -251,18 +251,18 @@ vertices = 4
|
|||
Name 61 "@patchConstantResult"
|
||||
Name 62 "pid"
|
||||
Name 63 "param"
|
||||
Name 67 "@patchConstantOutput_edges"
|
||||
Name 77 "output"
|
||||
Name 85 "HS_CONSTANT_OUT"
|
||||
Name 87 "@patchConstantOutput"
|
||||
Name 68 "@patchConstantOutput_edges"
|
||||
Name 78 "output"
|
||||
Name 86 "HS_CONSTANT_OUT"
|
||||
Name 88 "@patchConstantOutput"
|
||||
Decorate 40(ip) Location 0
|
||||
Decorate 44(m_cpid) BuiltIn InvocationId
|
||||
Decorate 47(@entryPointOutput) Location 0
|
||||
Decorate 62(pid) BuiltIn PrimitiveId
|
||||
Decorate 67(@patchConstantOutput_edges) Patch
|
||||
Decorate 67(@patchConstantOutput_edges) BuiltIn TessLevelOuter
|
||||
Decorate 87(@patchConstantOutput) Patch
|
||||
Decorate 87(@patchConstantOutput) Location 1
|
||||
Decorate 68(@patchConstantOutput_edges) Patch
|
||||
Decorate 68(@patchConstantOutput_edges) BuiltIn TessLevelOuter
|
||||
Decorate 88(@patchConstantOutput) Patch
|
||||
Decorate 88(@patchConstantOutput) Location 1
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
|
|
@ -294,16 +294,17 @@ vertices = 4
|
|||
56: TypeBool
|
||||
60: TypePointer Function 22(HS_CONSTANT_OUT)
|
||||
62(pid): 43(ptr) Variable Input
|
||||
66: TypePointer Output 21
|
||||
67(@patchConstantOutput_edges): 66(ptr) Variable Output
|
||||
68: TypePointer Function 6(float)
|
||||
71: TypePointer Output 6(float)
|
||||
73: 29(int) Constant 1
|
||||
78: 6(float) Constant 1073741824
|
||||
80: 6(float) Constant 1090519040
|
||||
85(HS_CONSTANT_OUT): TypeStruct
|
||||
86: TypePointer Output 85(HS_CONSTANT_OUT)
|
||||
87(@patchConstantOutput): 86(ptr) Variable Output
|
||||
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
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
38(ip): 12(ptr) Variable Function
|
||||
|
|
@ -332,14 +333,14 @@ vertices = 4
|
|||
Store 63(param) 64
|
||||
65:22(HS_CONSTANT_OUT) FunctionCall 25(PCF(u1;) 63(param)
|
||||
Store 61(@patchConstantResult) 65
|
||||
69: 68(ptr) AccessChain 61(@patchConstantResult) 30 30
|
||||
70: 6(float) Load 69
|
||||
72: 71(ptr) AccessChain 67(@patchConstantOutput_edges) 30
|
||||
Store 72 70
|
||||
74: 68(ptr) AccessChain 61(@patchConstantResult) 30 73
|
||||
75: 6(float) Load 74
|
||||
76: 71(ptr) AccessChain 67(@patchConstantOutput_edges) 73
|
||||
Store 76 75
|
||||
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
|
||||
Return
|
||||
|
|
@ -359,11 +360,11 @@ vertices = 4
|
|||
25(PCF(u1;):22(HS_CONSTANT_OUT) Function None 23
|
||||
24(pid): 13(ptr) FunctionParameter
|
||||
26: Label
|
||||
77(output): 60(ptr) Variable Function
|
||||
79: 68(ptr) AccessChain 77(output) 30 30
|
||||
Store 79 78
|
||||
81: 68(ptr) AccessChain 77(output) 30 73
|
||||
Store 81 80
|
||||
82:22(HS_CONSTANT_OUT) Load 77(output)
|
||||
ReturnValue 82
|
||||
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
|
||||
FunctionEnd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue