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

@ -147,7 +147,7 @@ gl_FragCoord origin is upper left
0:39 'n' (temp float)
0:39 Constant:
0:39 1.000000
0:45 Function Definition: main( (temp structure{temp 4-component vector of float color})
0:45 Function Definition: @main( (temp structure{temp 4-component vector of float color})
0:45 Function Parameters:
0:? Sequence
0:46 Function Call: Test1( (temp void)
@ -161,15 +161,18 @@ gl_FragCoord origin is upper left
0:49 1.000000
0:49 1.000000
0:49 1.000000
0:50 Sequence
0:50 Sequence
0:50 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:50 color: direct index for structure (temp 4-component vector of float)
0:50 'ps_output' (temp structure{temp 4-component vector of float color})
0:50 Constant:
0:50 0 (const int)
0:50 Branch: Return
0:50 Branch: Return with expression
0:50 'ps_output' (temp structure{temp 4-component vector of float color})
0:45 Function Definition: main( (temp void)
0:45 Function Parameters:
0:? Sequence
0:45 Sequence
0:45 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:45 color: direct index for structure (temp 4-component vector of float)
0:45 Function Call: @main( (temp structure{temp 4-component vector of float color})
0:45 Constant:
0:45 0 (const int)
0:? Linker Objects
0:? 'color' (layout(location=0 ) out 4-component vector of float)
@ -325,7 +328,7 @@ gl_FragCoord origin is upper left
0:39 'n' (temp float)
0:39 Constant:
0:39 1.000000
0:45 Function Definition: main( (temp structure{temp 4-component vector of float color})
0:45 Function Definition: @main( (temp structure{temp 4-component vector of float color})
0:45 Function Parameters:
0:? Sequence
0:46 Function Call: Test1( (temp void)
@ -339,179 +342,189 @@ gl_FragCoord origin is upper left
0:49 1.000000
0:49 1.000000
0:49 1.000000
0:50 Sequence
0:50 Sequence
0:50 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:50 color: direct index for structure (temp 4-component vector of float)
0:50 'ps_output' (temp structure{temp 4-component vector of float color})
0:50 Constant:
0:50 0 (const int)
0:50 Branch: Return
0:50 Branch: Return with expression
0:50 'ps_output' (temp structure{temp 4-component vector of float color})
0:45 Function Definition: main( (temp void)
0:45 Function Parameters:
0:? Sequence
0:45 Sequence
0:45 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:45 color: direct index for structure (temp 4-component vector of float)
0:45 Function Call: @main( (temp structure{temp 4-component vector of float color})
0:45 Constant:
0:45 0 (const int)
0:? Linker Objects
0:? 'color' (layout(location=0 ) out 4-component vector of float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 107
// Id's are bound by 112
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 103
EntryPoint Fragment 4 "main" 109
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 6 "Test1("
Name 10 "mystruct"
MemberName 10(mystruct) 0 "a"
Name 12 "test1"
Name 17 "test2"
Name 23 "test4"
Name 25 "mystruct2"
MemberName 25(mystruct2) 0 "a"
MemberName 25(mystruct2) 1 "b"
MemberName 25(mystruct2) 2 "c"
Name 27 "test5"
Name 32 "n"
Name 39 "a"
Name 75 "one"
MemberName 75(one) 0 "a"
Name 77 "oneNonConst"
Name 82 "two"
MemberName 82(two) 0 "a"
MemberName 82(two) 1 "b"
Name 84 "twoNonConst"
Name 94 "PS_OUTPUT"
MemberName 94(PS_OUTPUT) 0 "color"
Name 96 "ps_output"
Name 103 "color"
Decorate 103(color) Location 0
Name 10 "PS_OUTPUT"
MemberName 10(PS_OUTPUT) 0 "color"
Name 12 "@main("
Name 15 "mystruct"
MemberName 15(mystruct) 0 "a"
Name 17 "test1"
Name 22 "test2"
Name 28 "test4"
Name 30 "mystruct2"
MemberName 30(mystruct2) 0 "a"
MemberName 30(mystruct2) 1 "b"
MemberName 30(mystruct2) 2 "c"
Name 32 "test5"
Name 37 "n"
Name 44 "a"
Name 80 "one"
MemberName 80(one) 0 "a"
Name 82 "oneNonConst"
Name 87 "two"
MemberName 87(two) 0 "a"
MemberName 87(two) 1 "b"
Name 89 "twoNonConst"
Name 99 "ps_output"
Name 109 "color"
Decorate 109(color) Location 0
2: TypeVoid
3: TypeFunction 2
8: TypeFloat 32
9: TypeVector 8(float) 2
10(mystruct): TypeStruct 9(fvec2)
11: TypePointer Function 10(mystruct)
13: 8(float) Constant 1065353216
14: 8(float) Constant 1073741824
15: 9(fvec2) ConstantComposite 13 14
16:10(mystruct) ConstantComposite 15
18: 8(float) Constant 1077936128
19: 8(float) Constant 1082130432
20: 9(fvec2) ConstantComposite 18 19
21:10(mystruct) ConstantComposite 20
22: TypePointer Function 8(float)
24: 8(float) Constant 1088421888
25(mystruct2): TypeStruct 8(float) 8(float) 8(float)
26: TypePointer Function 25(mystruct2)
28: 8(float) Constant 1090519040
29: 8(float) Constant 1091567616
30: 8(float) Constant 1092616192
31:25(mystruct2) ConstantComposite 28 29 30
33: 8(float) Constant 0
34: TypeVector 8(float) 3
35: TypeInt 32 0
36: 35(int) Constant 8
37: TypeArray 34(fvec3) 36
38: TypePointer Function 37
40: 8(float) Constant 1058262330
41: 34(fvec3) ConstantComposite 40 40 40
45: 8(float) Constant 3205745978
46: 34(fvec3) ConstantComposite 45 45 45
50: 34(fvec3) ConstantComposite 45 45 40
54: 34(fvec3) ConstantComposite 45 40 45
58: 34(fvec3) ConstantComposite 45 40 40
62: 34(fvec3) ConstantComposite 40 45 45
66: 34(fvec3) ConstantComposite 40 45 40
70: 34(fvec3) ConstantComposite 40 40 45
75(one): TypeStruct 34(fvec3)
76: TypePointer Function 75(one)
82(two): TypeStruct 34(fvec3) 34(fvec3)
83: TypePointer Function 82(two)
93: TypeVector 8(float) 4
94(PS_OUTPUT): TypeStruct 93(fvec4)
95: TypePointer Function 94(PS_OUTPUT)
97: TypeInt 32 1
98: 97(int) Constant 0
99: 93(fvec4) ConstantComposite 13 13 13 13
100: TypePointer Function 93(fvec4)
102: TypePointer Output 93(fvec4)
103(color): 102(ptr) Variable Output
9: TypeVector 8(float) 4
10(PS_OUTPUT): TypeStruct 9(fvec4)
11: TypeFunction 10(PS_OUTPUT)
14: TypeVector 8(float) 2
15(mystruct): TypeStruct 14(fvec2)
16: TypePointer Function 15(mystruct)
18: 8(float) Constant 1065353216
19: 8(float) Constant 1073741824
20: 14(fvec2) ConstantComposite 18 19
21:15(mystruct) ConstantComposite 20
23: 8(float) Constant 1077936128
24: 8(float) Constant 1082130432
25: 14(fvec2) ConstantComposite 23 24
26:15(mystruct) ConstantComposite 25
27: TypePointer Function 8(float)
29: 8(float) Constant 1088421888
30(mystruct2): TypeStruct 8(float) 8(float) 8(float)
31: TypePointer Function 30(mystruct2)
33: 8(float) Constant 1090519040
34: 8(float) Constant 1091567616
35: 8(float) Constant 1092616192
36:30(mystruct2) ConstantComposite 33 34 35
38: 8(float) Constant 0
39: TypeVector 8(float) 3
40: TypeInt 32 0
41: 40(int) Constant 8
42: TypeArray 39(fvec3) 41
43: TypePointer Function 42
45: 8(float) Constant 1058262330
46: 39(fvec3) ConstantComposite 45 45 45
50: 8(float) Constant 3205745978
51: 39(fvec3) ConstantComposite 50 50 50
55: 39(fvec3) ConstantComposite 50 50 45
59: 39(fvec3) ConstantComposite 50 45 50
63: 39(fvec3) ConstantComposite 50 45 45
67: 39(fvec3) ConstantComposite 45 50 50
71: 39(fvec3) ConstantComposite 45 50 45
75: 39(fvec3) ConstantComposite 45 45 50
80(one): TypeStruct 39(fvec3)
81: TypePointer Function 80(one)
87(two): TypeStruct 39(fvec3) 39(fvec3)
88: TypePointer Function 87(two)
98: TypePointer Function 10(PS_OUTPUT)
100: TypeInt 32 1
101: 100(int) Constant 0
102: 9(fvec4) ConstantComposite 18 18 18 18
103: TypePointer Function 9(fvec4)
108: TypePointer Output 9(fvec4)
109(color): 108(ptr) Variable Output
4(main): 2 Function None 3
5: Label
96(ps_output): 95(ptr) Variable Function
92: 2 FunctionCall 6(Test1()
101: 100(ptr) AccessChain 96(ps_output) 98
Store 101 99
104: 100(ptr) AccessChain 96(ps_output) 98
105: 93(fvec4) Load 104
Store 103(color) 105
110:10(PS_OUTPUT) FunctionCall 12(@main()
111: 9(fvec4) CompositeExtract 110 0
Store 109(color) 111
Return
FunctionEnd
6(Test1(): 2 Function None 3
7: Label
12(test1): 11(ptr) Variable Function
17(test2): 11(ptr) Variable Function
23(test4): 22(ptr) Variable Function
27(test5): 26(ptr) Variable Function
32(n): 22(ptr) Variable Function
39(a): 38(ptr) Variable Function
77(oneNonConst): 76(ptr) Variable Function
84(twoNonConst): 83(ptr) Variable Function
Store 12(test1) 16
Store 17(test2) 21
Store 23(test4) 24
Store 27(test5) 31
Store 32(n) 33
42: 8(float) Load 32(n)
43: 8(float) FAdd 42 13
Store 32(n) 43
44: 34(fvec3) VectorTimesScalar 41 43
47: 8(float) Load 32(n)
48: 8(float) FAdd 47 13
Store 32(n) 48
49: 34(fvec3) VectorTimesScalar 46 48
51: 8(float) Load 32(n)
52: 8(float) FAdd 51 13
Store 32(n) 52
53: 34(fvec3) VectorTimesScalar 50 52
55: 8(float) Load 32(n)
56: 8(float) FAdd 55 13
Store 32(n) 56
57: 34(fvec3) VectorTimesScalar 54 56
59: 8(float) Load 32(n)
60: 8(float) FAdd 59 13
Store 32(n) 60
61: 34(fvec3) VectorTimesScalar 58 60
63: 8(float) Load 32(n)
64: 8(float) FAdd 63 13
Store 32(n) 64
65: 34(fvec3) VectorTimesScalar 62 64
67: 8(float) Load 32(n)
68: 8(float) FAdd 67 13
Store 32(n) 68
69: 34(fvec3) VectorTimesScalar 66 68
71: 8(float) Load 32(n)
72: 8(float) FAdd 71 13
Store 32(n) 72
73: 34(fvec3) VectorTimesScalar 70 72
74: 37 CompositeConstruct 44 49 53 57 61 65 69 73
Store 39(a) 74
78: 8(float) Load 32(n)
79: 8(float) FAdd 78 13
Store 32(n) 79
80: 34(fvec3) VectorTimesScalar 58 79
81: 75(one) CompositeConstruct 80
Store 77(oneNonConst) 81
85: 8(float) Load 32(n)
86: 8(float) FAdd 85 13
Store 32(n) 86
87: 34(fvec3) VectorTimesScalar 58 86
88: 8(float) Load 32(n)
89: 8(float) FAdd 88 13
Store 32(n) 89
90: 34(fvec3) VectorTimesScalar 58 89
91: 82(two) CompositeConstruct 87 90
Store 84(twoNonConst) 91
17(test1): 16(ptr) Variable Function
22(test2): 16(ptr) Variable Function
28(test4): 27(ptr) Variable Function
32(test5): 31(ptr) Variable Function
37(n): 27(ptr) Variable Function
44(a): 43(ptr) Variable Function
82(oneNonConst): 81(ptr) Variable Function
89(twoNonConst): 88(ptr) Variable Function
Store 17(test1) 21
Store 22(test2) 26
Store 28(test4) 29
Store 32(test5) 36
Store 37(n) 38
47: 8(float) Load 37(n)
48: 8(float) FAdd 47 18
Store 37(n) 48
49: 39(fvec3) VectorTimesScalar 46 48
52: 8(float) Load 37(n)
53: 8(float) FAdd 52 18
Store 37(n) 53
54: 39(fvec3) VectorTimesScalar 51 53
56: 8(float) Load 37(n)
57: 8(float) FAdd 56 18
Store 37(n) 57
58: 39(fvec3) VectorTimesScalar 55 57
60: 8(float) Load 37(n)
61: 8(float) FAdd 60 18
Store 37(n) 61
62: 39(fvec3) VectorTimesScalar 59 61
64: 8(float) Load 37(n)
65: 8(float) FAdd 64 18
Store 37(n) 65
66: 39(fvec3) VectorTimesScalar 63 65
68: 8(float) Load 37(n)
69: 8(float) FAdd 68 18
Store 37(n) 69
70: 39(fvec3) VectorTimesScalar 67 69
72: 8(float) Load 37(n)
73: 8(float) FAdd 72 18
Store 37(n) 73
74: 39(fvec3) VectorTimesScalar 71 73
76: 8(float) Load 37(n)
77: 8(float) FAdd 76 18
Store 37(n) 77
78: 39(fvec3) VectorTimesScalar 75 77
79: 42 CompositeConstruct 49 54 58 62 66 70 74 78
Store 44(a) 79
83: 8(float) Load 37(n)
84: 8(float) FAdd 83 18
Store 37(n) 84
85: 39(fvec3) VectorTimesScalar 63 84
86: 80(one) CompositeConstruct 85
Store 82(oneNonConst) 86
90: 8(float) Load 37(n)
91: 8(float) FAdd 90 18
Store 37(n) 91
92: 39(fvec3) VectorTimesScalar 63 91
93: 8(float) Load 37(n)
94: 8(float) FAdd 93 18
Store 37(n) 94
95: 39(fvec3) VectorTimesScalar 63 94
96: 87(two) CompositeConstruct 92 95
Store 89(twoNonConst) 96
Return
FunctionEnd
12(@main():10(PS_OUTPUT) Function None 11
13: Label
99(ps_output): 98(ptr) Variable Function
97: 2 FunctionCall 6(Test1()
104: 103(ptr) AccessChain 99(ps_output) 101
Store 104 102
105:10(PS_OUTPUT) Load 99(ps_output)
ReturnValue 105
FunctionEnd