HLSL: add geometry stage support for clip/cull distance
Changes:
(1) Allow clip/cull builtins as both input and output in the same shader stage. Previously,
not enough data was tracked to handle this.
(2) Handle the extra array dimension in GS inputs. The synthesized external variable can
now be created with the extra array dimension if needed, and the form conversion code is
able to handle it as well.
For example, both of these GS inputs would result in the same synthesized external type:
triangle in float4 clip[3] : SV_ClipDistance
triangle in float2 clip[3][2] : SV_ClipDistance
In the second case, the inner array dimension packs with the 2-vector of floats into an array[4],
which there is an array[3] of due to the triangle geometry.
This commit is contained in:
parent
ea0c1643ab
commit
5e5b12e931
13 changed files with 3448 additions and 204 deletions
|
|
@ -1,15 +1,10 @@
|
|||
hlsl.semantic.geom
|
||||
ERROR: 0:15: '' : unimplemented: clip/cull not currently implemented for this stage
|
||||
ERROR: 0:15: '' : unimplemented: clip/cull not currently implemented for this stage
|
||||
ERROR: 2 compilation errors. No code generated.
|
||||
|
||||
|
||||
Shader version: 500
|
||||
invocations = -1
|
||||
max_vertices = 4
|
||||
input primitive = triangles
|
||||
output primitive = line_strip
|
||||
ERROR: node is still EOpNull!
|
||||
0:? Sequence
|
||||
0:13 Function Definition: @main(u1[3];struct-S-f1-f1-f1-u1-u1-i11; ( temp void)
|
||||
0:13 Function Parameters:
|
||||
0:13 'VertexID' ( in 3-element array of uint)
|
||||
|
|
@ -23,6 +18,26 @@ ERROR: node is still EOpNull!
|
|||
0:15 's' ( temp structure{ temp float clip0, temp float clip0, temp float cull0, temp uint vpai, temp uint rtai, temp int ii})
|
||||
0:15 Constant:
|
||||
0:15 0 (const int)
|
||||
0:? Sequence
|
||||
0:15 move second child to first child ( temp float)
|
||||
0:15 direct index ( out float ClipDistance)
|
||||
0:? 'OutputStream.clip0' ( out 1-element array of float ClipDistance)
|
||||
0:15 Constant:
|
||||
0:15 0 (const int)
|
||||
0:15 clip0: direct index for structure ( temp float)
|
||||
0:15 's' ( temp structure{ temp float clip0, temp float clip0, temp float cull0, temp uint vpai, temp uint rtai, temp int ii})
|
||||
0:15 Constant:
|
||||
0:15 1 (const int)
|
||||
0:? Sequence
|
||||
0:15 move second child to first child ( temp float)
|
||||
0:15 direct index ( out float CullDistance)
|
||||
0:? 'OutputStream.cull0' ( out 1-element array of float CullDistance)
|
||||
0:15 Constant:
|
||||
0:15 0 (const int)
|
||||
0:15 cull0: direct index for structure ( temp float)
|
||||
0:15 's' ( temp structure{ temp float clip0, temp float clip0, temp float cull0, temp uint vpai, temp uint rtai, temp int ii})
|
||||
0:15 Constant:
|
||||
0:15 2 (const int)
|
||||
0:15 move second child to first child ( temp uint)
|
||||
0:? 'OutputStream.vpai' ( out uint ViewportIndex)
|
||||
0:15 vpai: direct index for structure ( temp uint)
|
||||
|
|
@ -57,6 +72,8 @@ ERROR: node is still EOpNull!
|
|||
0:? 'OutputStream.vpai' ( out uint ViewportIndex)
|
||||
0:? 'OutputStream.rtai' ( out uint Layer)
|
||||
0:? 'OutputStream.ii' (layout( location=0) out int)
|
||||
0:? 'OutputStream.clip0' ( out 1-element array of float ClipDistance)
|
||||
0:? 'OutputStream.cull0' ( out 1-element array of float CullDistance)
|
||||
|
||||
|
||||
Linked geometry stage:
|
||||
|
|
@ -67,7 +84,7 @@ invocations = 1
|
|||
max_vertices = 4
|
||||
input primitive = triangles
|
||||
output primitive = line_strip
|
||||
ERROR: node is still EOpNull!
|
||||
0:? Sequence
|
||||
0:13 Function Definition: @main(u1[3];struct-S-f1-f1-f1-u1-u1-i11; ( temp void)
|
||||
0:13 Function Parameters:
|
||||
0:13 'VertexID' ( in 3-element array of uint)
|
||||
|
|
@ -81,6 +98,26 @@ ERROR: node is still EOpNull!
|
|||
0:15 's' ( temp structure{ temp float clip0, temp float clip0, temp float cull0, temp uint vpai, temp uint rtai, temp int ii})
|
||||
0:15 Constant:
|
||||
0:15 0 (const int)
|
||||
0:? Sequence
|
||||
0:15 move second child to first child ( temp float)
|
||||
0:15 direct index ( out float ClipDistance)
|
||||
0:? 'OutputStream.clip0' ( out 1-element array of float ClipDistance)
|
||||
0:15 Constant:
|
||||
0:15 0 (const int)
|
||||
0:15 clip0: direct index for structure ( temp float)
|
||||
0:15 's' ( temp structure{ temp float clip0, temp float clip0, temp float cull0, temp uint vpai, temp uint rtai, temp int ii})
|
||||
0:15 Constant:
|
||||
0:15 1 (const int)
|
||||
0:? Sequence
|
||||
0:15 move second child to first child ( temp float)
|
||||
0:15 direct index ( out float CullDistance)
|
||||
0:? 'OutputStream.cull0' ( out 1-element array of float CullDistance)
|
||||
0:15 Constant:
|
||||
0:15 0 (const int)
|
||||
0:15 cull0: direct index for structure ( temp float)
|
||||
0:15 's' ( temp structure{ temp float clip0, temp float clip0, temp float cull0, temp uint vpai, temp uint rtai, temp int ii})
|
||||
0:15 Constant:
|
||||
0:15 2 (const int)
|
||||
0:15 move second child to first child ( temp uint)
|
||||
0:? 'OutputStream.vpai' ( out uint ViewportIndex)
|
||||
0:15 vpai: direct index for structure ( temp uint)
|
||||
|
|
@ -115,5 +152,129 @@ ERROR: node is still EOpNull!
|
|||
0:? 'OutputStream.vpai' ( out uint ViewportIndex)
|
||||
0:? 'OutputStream.rtai' ( out uint Layer)
|
||||
0:? 'OutputStream.ii' (layout( location=0) out int)
|
||||
0:? 'OutputStream.clip0' ( out 1-element array of float ClipDistance)
|
||||
0:? 'OutputStream.cull0' ( out 1-element array of float CullDistance)
|
||||
|
||||
SPIR-V is not generated for failed compile or link
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 65
|
||||
|
||||
Capability Geometry
|
||||
Capability ClipDistance
|
||||
Capability CullDistance
|
||||
Capability MultiViewport
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Geometry 4 "main" 20 29 34 40 45 50 57
|
||||
ExecutionMode 4 Triangles
|
||||
ExecutionMode 4 Invocations 1
|
||||
ExecutionMode 4 OutputLineStrip
|
||||
ExecutionMode 4 OutputVertices 4
|
||||
Source HLSL 500
|
||||
Name 4 "main"
|
||||
Name 12 "S"
|
||||
MemberName 12(S) 0 "clip0"
|
||||
MemberName 12(S) 1 "clip0"
|
||||
MemberName 12(S) 2 "cull0"
|
||||
MemberName 12(S) 3 "vpai"
|
||||
MemberName 12(S) 4 "rtai"
|
||||
MemberName 12(S) 5 "ii"
|
||||
Name 17 "@main(u1[3];struct-S-f1-f1-f1-u1-u1-i11;"
|
||||
Name 15 "VertexID"
|
||||
Name 16 "OutputStream"
|
||||
Name 20 "OutputStream.clip0"
|
||||
Name 21 "s"
|
||||
Name 29 "OutputStream.clip0"
|
||||
Name 34 "OutputStream.cull0"
|
||||
Name 40 "OutputStream.vpai"
|
||||
Name 45 "OutputStream.rtai"
|
||||
Name 50 "OutputStream.ii"
|
||||
Name 55 "VertexID"
|
||||
Name 57 "VertexID"
|
||||
Name 59 "OutputStream"
|
||||
Name 60 "param"
|
||||
Name 62 "param"
|
||||
Decorate 20(OutputStream.clip0) BuiltIn Position
|
||||
Decorate 29(OutputStream.clip0) BuiltIn ClipDistance
|
||||
Decorate 34(OutputStream.cull0) BuiltIn CullDistance
|
||||
Decorate 40(OutputStream.vpai) BuiltIn ViewportIndex
|
||||
Decorate 45(OutputStream.rtai) BuiltIn Layer
|
||||
Decorate 50(OutputStream.ii) Location 0
|
||||
Decorate 57(VertexID) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeInt 32 0
|
||||
7: 6(int) Constant 3
|
||||
8: TypeArray 6(int) 7
|
||||
9: TypePointer Function 8
|
||||
10: TypeFloat 32
|
||||
11: TypeInt 32 1
|
||||
12(S): TypeStruct 10(float) 10(float) 10(float) 6(int) 6(int) 11(int)
|
||||
13: TypePointer Function 12(S)
|
||||
14: TypeFunction 2 9(ptr) 13(ptr)
|
||||
19: TypePointer Output 10(float)
|
||||
20(OutputStream.clip0): 19(ptr) Variable Output
|
||||
22: 11(int) Constant 0
|
||||
23: TypePointer Function 10(float)
|
||||
26: 6(int) Constant 1
|
||||
27: TypeArray 10(float) 26
|
||||
28: TypePointer Output 27
|
||||
29(OutputStream.clip0): 28(ptr) Variable Output
|
||||
30: 11(int) Constant 1
|
||||
34(OutputStream.cull0): 28(ptr) Variable Output
|
||||
35: 11(int) Constant 2
|
||||
39: TypePointer Output 6(int)
|
||||
40(OutputStream.vpai): 39(ptr) Variable Output
|
||||
41: 11(int) Constant 3
|
||||
42: TypePointer Function 6(int)
|
||||
45(OutputStream.rtai): 39(ptr) Variable Output
|
||||
46: 11(int) Constant 4
|
||||
49: TypePointer Output 11(int)
|
||||
50(OutputStream.ii): 49(ptr) Variable Output
|
||||
51: 11(int) Constant 5
|
||||
52: TypePointer Function 11(int)
|
||||
56: TypePointer Input 8
|
||||
57(VertexID): 56(ptr) Variable Input
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
55(VertexID): 9(ptr) Variable Function
|
||||
59(OutputStream): 13(ptr) Variable Function
|
||||
60(param): 9(ptr) Variable Function
|
||||
62(param): 13(ptr) Variable Function
|
||||
58: 8 Load 57(VertexID)
|
||||
Store 55(VertexID) 58
|
||||
61: 8 Load 55(VertexID)
|
||||
Store 60(param) 61
|
||||
63: 2 FunctionCall 17(@main(u1[3];struct-S-f1-f1-f1-u1-u1-i11;) 60(param) 62(param)
|
||||
64: 12(S) Load 62(param)
|
||||
Store 59(OutputStream) 64
|
||||
Return
|
||||
FunctionEnd
|
||||
17(@main(u1[3];struct-S-f1-f1-f1-u1-u1-i11;): 2 Function None 14
|
||||
15(VertexID): 9(ptr) FunctionParameter
|
||||
16(OutputStream): 13(ptr) FunctionParameter
|
||||
18: Label
|
||||
21(s): 13(ptr) Variable Function
|
||||
24: 23(ptr) AccessChain 21(s) 22
|
||||
25: 10(float) Load 24
|
||||
Store 20(OutputStream.clip0) 25
|
||||
31: 23(ptr) AccessChain 21(s) 30
|
||||
32: 10(float) Load 31
|
||||
33: 19(ptr) AccessChain 29(OutputStream.clip0) 22
|
||||
Store 33 32
|
||||
36: 23(ptr) AccessChain 21(s) 35
|
||||
37: 10(float) Load 36
|
||||
38: 19(ptr) AccessChain 34(OutputStream.cull0) 22
|
||||
Store 38 37
|
||||
43: 42(ptr) AccessChain 21(s) 41
|
||||
44: 6(int) Load 43
|
||||
Store 40(OutputStream.vpai) 44
|
||||
47: 42(ptr) AccessChain 21(s) 46
|
||||
48: 6(int) Load 47
|
||||
Store 45(OutputStream.rtai) 48
|
||||
53: 52(ptr) AccessChain 21(s) 51
|
||||
54: 11(int) Load 53
|
||||
Store 50(OutputStream.ii) 54
|
||||
EmitVertex
|
||||
Return
|
||||
FunctionEnd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue