HLSL: Wrap the entry-point; need to write 'in' args, and support 'inout' args.

This needs some render testing, but is destined to be part of master.

This also leads to a variety of other simplifications.
 - IO are global symbols, so only need one list of linkage nodes (deferred)
 - no longer need parse-context-wide 'inEntryPoint' state, entry-point is localized
 - several parts of splitting/flattening are now localized
This commit is contained in:
John Kessenich 2017-01-19 15:41:47 -07:00
parent 18adbdbbb8
commit 02467d8d94
171 changed files with 37604 additions and 32679 deletions

View file

@ -5,11 +5,11 @@ max_vertices = 4
input primitive = triangles
output primitive = line_strip
0:? Sequence
0:16 Function Definition: main(u1[3];u1[3];struct-PSInput-f1-i11; (temp void)
0:16 Function Definition: @main(u1[3];u1[3];struct-PSInput-f1-i11; (temp void)
0:16 Function Parameters:
0:16 'VertexID' (layout(location=0 ) in 3-element array of uint)
0:16 'test' (layout(location=3 ) in 3-element array of uint)
0:16 'OutputStream' (layout(location=0 ) out structure{temp float myfloat, temp int something})
0:16 'VertexID' (in 3-element array of uint)
0:16 'test' (in 3-element array of uint)
0:16 'OutputStream' (out structure{temp float myfloat, temp int something})
0:? Sequence
0:19 move second child to first child (temp float)
0:19 myfloat: direct index for structure (temp float)
@ -19,16 +19,16 @@ output primitive = line_strip
0:19 Convert uint to float (temp float)
0:19 add (temp uint)
0:19 add (temp uint)
0:19 direct index (layout(location=3 ) temp uint)
0:19 'test' (layout(location=3 ) in 3-element array of uint)
0:19 direct index (temp uint)
0:19 'test' (in 3-element array of uint)
0:19 Constant:
0:19 0 (const int)
0:19 direct index (layout(location=3 ) temp uint)
0:19 'test' (layout(location=3 ) in 3-element array of uint)
0:19 direct index (temp uint)
0:19 'test' (in 3-element array of uint)
0:19 Constant:
0:19 1 (const int)
0:19 direct index (layout(location=3 ) temp uint)
0:19 'test' (layout(location=3 ) in 3-element array of uint)
0:19 direct index (temp uint)
0:19 'test' (in 3-element array of uint)
0:19 Constant:
0:19 2 (const int)
0:20 move second child to first child (temp int)
@ -37,25 +37,37 @@ output primitive = line_strip
0:20 Constant:
0:20 1 (const int)
0:20 Convert uint to int (temp int)
0:20 direct index (layout(location=0 ) temp uint)
0:20 'VertexID' (layout(location=0 ) in 3-element array of uint)
0:20 direct index (temp uint)
0:20 'VertexID' (in 3-element array of uint)
0:20 Constant:
0:20 0 (const int)
0:22 Sequence
0:22 move second child to first child (temp structure{temp float myfloat, temp int something})
0:22 'OutputStream' (layout(location=0 ) out structure{temp float myfloat, temp int something})
0:22 'OutputStream' (out structure{temp float myfloat, temp int something})
0:22 'Vert' (temp structure{temp float myfloat, temp int something})
0:22 EmitVertex (temp void)
0:23 Sequence
0:23 move second child to first child (temp structure{temp float myfloat, temp int something})
0:23 'OutputStream' (layout(location=0 ) out structure{temp float myfloat, temp int something})
0:23 'OutputStream' (out structure{temp float myfloat, temp int something})
0:23 'Vert' (temp structure{temp float myfloat, temp int something})
0:23 EmitVertex (temp void)
0:24 EndPrimitive (temp void)
0:16 Function Definition: main( (temp void)
0:16 Function Parameters:
0:? Sequence
0:16 move second child to first child (temp 3-element array of uint)
0:? 'VertexID' (temp 3-element array of uint)
0:? 'VertexID' (layout(location=0 ) in 3-element array of uint)
0:16 move second child to first child (temp 3-element array of uint)
0:? 'test' (temp 3-element array of uint)
0:? 'test' (layout(location=3 ) in 3-element array of uint)
0:16 Function Call: @main(u1[3];u1[3];struct-PSInput-f1-i11; (temp void)
0:? 'VertexID' (temp 3-element array of uint)
0:? 'test' (temp 3-element array of uint)
0:? 'OutputStream' (temp structure{temp float myfloat, temp int something})
0:? Linker Objects
0:? 'VertexID' (layout(location=0 ) in 3-element array of uint)
0:? 'test' (layout(location=3 ) in 3-element array of uint)
0:? 'OutputStream' (layout(location=0 ) out structure{temp float myfloat, temp int something})
Linked geometry stage:
@ -67,11 +79,11 @@ max_vertices = 4
input primitive = triangles
output primitive = line_strip
0:? Sequence
0:16 Function Definition: main(u1[3];u1[3];struct-PSInput-f1-i11; (temp void)
0:16 Function Definition: @main(u1[3];u1[3];struct-PSInput-f1-i11; (temp void)
0:16 Function Parameters:
0:16 'VertexID' (layout(location=0 ) in 3-element array of uint)
0:16 'test' (layout(location=3 ) in 3-element array of uint)
0:16 'OutputStream' (layout(location=0 ) out structure{temp float myfloat, temp int something})
0:16 'VertexID' (in 3-element array of uint)
0:16 'test' (in 3-element array of uint)
0:16 'OutputStream' (out structure{temp float myfloat, temp int something})
0:? Sequence
0:19 move second child to first child (temp float)
0:19 myfloat: direct index for structure (temp float)
@ -81,16 +93,16 @@ output primitive = line_strip
0:19 Convert uint to float (temp float)
0:19 add (temp uint)
0:19 add (temp uint)
0:19 direct index (layout(location=3 ) temp uint)
0:19 'test' (layout(location=3 ) in 3-element array of uint)
0:19 direct index (temp uint)
0:19 'test' (in 3-element array of uint)
0:19 Constant:
0:19 0 (const int)
0:19 direct index (layout(location=3 ) temp uint)
0:19 'test' (layout(location=3 ) in 3-element array of uint)
0:19 direct index (temp uint)
0:19 'test' (in 3-element array of uint)
0:19 Constant:
0:19 1 (const int)
0:19 direct index (layout(location=3 ) temp uint)
0:19 'test' (layout(location=3 ) in 3-element array of uint)
0:19 direct index (temp uint)
0:19 'test' (in 3-element array of uint)
0:19 Constant:
0:19 2 (const int)
0:20 move second child to first child (temp int)
@ -99,93 +111,135 @@ output primitive = line_strip
0:20 Constant:
0:20 1 (const int)
0:20 Convert uint to int (temp int)
0:20 direct index (layout(location=0 ) temp uint)
0:20 'VertexID' (layout(location=0 ) in 3-element array of uint)
0:20 direct index (temp uint)
0:20 'VertexID' (in 3-element array of uint)
0:20 Constant:
0:20 0 (const int)
0:22 Sequence
0:22 move second child to first child (temp structure{temp float myfloat, temp int something})
0:22 'OutputStream' (layout(location=0 ) out structure{temp float myfloat, temp int something})
0:22 'OutputStream' (out structure{temp float myfloat, temp int something})
0:22 'Vert' (temp structure{temp float myfloat, temp int something})
0:22 EmitVertex (temp void)
0:23 Sequence
0:23 move second child to first child (temp structure{temp float myfloat, temp int something})
0:23 'OutputStream' (layout(location=0 ) out structure{temp float myfloat, temp int something})
0:23 'OutputStream' (out structure{temp float myfloat, temp int something})
0:23 'Vert' (temp structure{temp float myfloat, temp int something})
0:23 EmitVertex (temp void)
0:24 EndPrimitive (temp void)
0:16 Function Definition: main( (temp void)
0:16 Function Parameters:
0:? Sequence
0:16 move second child to first child (temp 3-element array of uint)
0:? 'VertexID' (temp 3-element array of uint)
0:? 'VertexID' (layout(location=0 ) in 3-element array of uint)
0:16 move second child to first child (temp 3-element array of uint)
0:? 'test' (temp 3-element array of uint)
0:? 'test' (layout(location=3 ) in 3-element array of uint)
0:16 Function Call: @main(u1[3];u1[3];struct-PSInput-f1-i11; (temp void)
0:? 'VertexID' (temp 3-element array of uint)
0:? 'test' (temp 3-element array of uint)
0:? 'OutputStream' (temp structure{temp float myfloat, temp int something})
0:? Linker Objects
0:? 'VertexID' (layout(location=0 ) in 3-element array of uint)
0:? 'test' (layout(location=3 ) in 3-element array of uint)
0:? 'OutputStream' (layout(location=0 ) out structure{temp float myfloat, temp int something})
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 41
// Id's are bound by 57
Capability Geometry
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Geometry 4 "main" 16 31 38
EntryPoint Geometry 4 "main" 45 48
ExecutionMode 4 Triangles
ExecutionMode 4 Invocations 1
ExecutionMode 4 OutputLineStrip
ExecutionMode 4 OutputVertices 4
Name 4 "main"
Name 8 "PSInput"
MemberName 8(PSInput) 0 "myfloat"
MemberName 8(PSInput) 1 "something"
Name 10 "Vert"
Name 12 "PSInput"
MemberName 12(PSInput) 0 "myfloat"
MemberName 12(PSInput) 1 "something"
Name 18 "@main(u1[3];u1[3];struct-PSInput-f1-i11;"
Name 15 "VertexID"
Name 16 "test"
Name 31 "VertexID"
Name 38 "OutputStream"
Decorate 16(test) Location 3
Decorate 31(VertexID) Location 0
Decorate 38(OutputStream) Location 0
Name 17 "OutputStream"
Name 20 "Vert"
Name 43 "VertexID"
Name 45 "VertexID"
Name 47 "test"
Name 48 "test"
Name 50 "OutputStream"
Name 51 "param"
Name 53 "param"
Name 55 "param"
Decorate 45(VertexID) Location 0
Decorate 48(test) Location 3
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeInt 32 1
8(PSInput): TypeStruct 6(float) 7(int)
9: TypePointer Function 8(PSInput)
11: 7(int) Constant 0
12: TypeInt 32 0
13: 12(int) Constant 3
14: TypeArray 12(int) 13
15: TypePointer Input 14
16(test): 15(ptr) Variable Input
17: TypePointer Input 12(int)
20: 7(int) Constant 1
24: 7(int) Constant 2
29: TypePointer Function 6(float)
31(VertexID): 15(ptr) Variable Input
35: TypePointer Function 7(int)
37: TypePointer Output 8(PSInput)
38(OutputStream): 37(ptr) Variable Output
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(PSInput): TypeStruct 10(float) 11(int)
13: TypePointer Function 12(PSInput)
14: TypeFunction 2 9(ptr) 9(ptr) 13(ptr)
21: 11(int) Constant 0
22: TypePointer Function 6(int)
25: 11(int) Constant 1
29: 11(int) Constant 2
34: TypePointer Function 10(float)
39: TypePointer Function 11(int)
44: TypePointer Input 8
45(VertexID): 44(ptr) Variable Input
48(test): 44(ptr) Variable Input
4(main): 2 Function None 3
5: Label
10(Vert): 9(ptr) Variable Function
18: 17(ptr) AccessChain 16(test) 11
19: 12(int) Load 18
21: 17(ptr) AccessChain 16(test) 20
22: 12(int) Load 21
23: 12(int) IAdd 19 22
25: 17(ptr) AccessChain 16(test) 24
26: 12(int) Load 25
27: 12(int) IAdd 23 26
28: 6(float) ConvertUToF 27
30: 29(ptr) AccessChain 10(Vert) 11
Store 30 28
32: 17(ptr) AccessChain 31(VertexID) 11
33: 12(int) Load 32
34: 7(int) Bitcast 33
36: 35(ptr) AccessChain 10(Vert) 20
Store 36 34
39: 8(PSInput) Load 10(Vert)
Store 38(OutputStream) 39
43(VertexID): 9(ptr) Variable Function
47(test): 9(ptr) Variable Function
50(OutputStream): 13(ptr) Variable Function
51(param): 9(ptr) Variable Function
53(param): 9(ptr) Variable Function
55(param): 13(ptr) Variable Function
46: 8 Load 45(VertexID)
Store 43(VertexID) 46
49: 8 Load 48(test)
Store 47(test) 49
52: 8 Load 43(VertexID)
Store 51(param) 52
54: 8 Load 47(test)
Store 53(param) 54
56: 2 FunctionCall 18(@main(u1[3];u1[3];struct-PSInput-f1-i11;) 51(param) 53(param) 55(param)
Return
FunctionEnd
18(@main(u1[3];u1[3];struct-PSInput-f1-i11;): 2 Function None 14
15(VertexID): 9(ptr) FunctionParameter
16(test): 9(ptr) FunctionParameter
17(OutputStream): 13(ptr) FunctionParameter
19: Label
20(Vert): 13(ptr) Variable Function
23: 22(ptr) AccessChain 16(test) 21
24: 6(int) Load 23
26: 22(ptr) AccessChain 16(test) 25
27: 6(int) Load 26
28: 6(int) IAdd 24 27
30: 22(ptr) AccessChain 16(test) 29
31: 6(int) Load 30
32: 6(int) IAdd 28 31
33: 10(float) ConvertUToF 32
35: 34(ptr) AccessChain 20(Vert) 21
Store 35 33
36: 22(ptr) AccessChain 15(VertexID) 21
37: 6(int) Load 36
38: 11(int) Bitcast 37
40: 39(ptr) AccessChain 20(Vert) 25
Store 40 38
41: 12(PSInput) Load 20(Vert)
Store 17(OutputStream) 41
EmitVertex
40: 8(PSInput) Load 10(Vert)
Store 38(OutputStream) 40
42: 12(PSInput) Load 20(Vert)
Store 17(OutputStream) 42
EmitVertex
EndPrimitive
Return