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

@ -85,7 +85,7 @@ gl_FragCoord origin is upper left
0:43 'r33' (temp 4X4 matrix of bool)
0:43 transpose (temp 4X4 matrix of bool)
0:43 'b4x4' (temp 4X4 matrix of bool)
0:49 Function Definition: main( (temp structure{temp 4-component vector of float color})
0:49 Function Definition: @main( (temp structure{temp 4-component vector of float color})
0:49 Function Parameters:
0:? Sequence
0:51 move second child to first child (temp 4-component vector of float)
@ -98,15 +98,18 @@ gl_FragCoord origin is upper left
0:? 0.000000
0:? 0.000000
0:? 0.000000
0:52 Sequence
0:52 Sequence
0:52 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:52 color: direct index for structure (temp 4-component vector of float)
0:52 'ps_output' (temp structure{temp 4-component vector of float color})
0:52 Constant:
0:52 0 (const int)
0:52 Branch: Return
0:52 Branch: Return with expression
0:52 'ps_output' (temp structure{temp 4-component vector of float color})
0:49 Function Definition: main( (temp void)
0:49 Function Parameters:
0:? Sequence
0:49 Sequence
0:49 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:49 color: direct index for structure (temp 4-component vector of float)
0:49 Function Call: @main( (temp structure{temp 4-component vector of float color})
0:49 Constant:
0:49 0 (const int)
0:? Linker Objects
0:? 'color' (layout(location=0 ) out 4-component vector of float)
@ -200,7 +203,7 @@ gl_FragCoord origin is upper left
0:43 'r33' (temp 4X4 matrix of bool)
0:43 transpose (temp 4X4 matrix of bool)
0:43 'b4x4' (temp 4X4 matrix of bool)
0:49 Function Definition: main( (temp structure{temp 4-component vector of float color})
0:49 Function Definition: @main( (temp structure{temp 4-component vector of float color})
0:49 Function Parameters:
0:? Sequence
0:51 move second child to first child (temp 4-component vector of float)
@ -213,207 +216,217 @@ gl_FragCoord origin is upper left
0:? 0.000000
0:? 0.000000
0:? 0.000000
0:52 Sequence
0:52 Sequence
0:52 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:52 color: direct index for structure (temp 4-component vector of float)
0:52 'ps_output' (temp structure{temp 4-component vector of float color})
0:52 Constant:
0:52 0 (const int)
0:52 Branch: Return
0:52 Branch: Return with expression
0:52 'ps_output' (temp structure{temp 4-component vector of float color})
0:49 Function Definition: main( (temp void)
0:49 Function Parameters:
0:? Sequence
0:49 Sequence
0:49 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:49 color: direct index for structure (temp 4-component vector of float)
0:49 Function Call: @main( (temp structure{temp 4-component vector of float color})
0:49 Constant:
0:49 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 125
// Id's are bound by 130
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 121
EntryPoint Fragment 4 "main" 127
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 6 "TestBoolMatTypes("
Name 12 "r00"
Name 13 "b1x1"
Name 19 "r01"
Name 22 "b2x1"
Name 28 "r02"
Name 31 "b3x1"
Name 37 "r03"
Name 40 "b4x1"
Name 43 "r10"
Name 44 "b1x2"
Name 49 "r11"
Name 50 "b2x2"
Name 55 "r12"
Name 58 "b3x2"
Name 63 "r13"
Name 66 "b4x2"
Name 69 "r20"
Name 70 "b1x3"
Name 73 "r21"
Name 74 "b2x3"
Name 79 "r22"
Name 80 "b3x3"
Name 85 "r23"
Name 88 "b4x3"
Name 91 "r30"
Name 92 "b1x4"
Name 95 "r31"
Name 96 "b2x4"
Name 99 "r32"
Name 100 "b3x4"
Name 105 "r33"
Name 106 "b4x4"
Name 111 "PS_OUTPUT"
MemberName 111(PS_OUTPUT) 0 "color"
Name 113 "ps_output"
Name 121 "color"
Decorate 121(color) Location 0
Name 10 "PS_OUTPUT"
MemberName 10(PS_OUTPUT) 0 "color"
Name 12 "@main("
Name 18 "r00"
Name 19 "b1x1"
Name 25 "r01"
Name 28 "b2x1"
Name 34 "r02"
Name 37 "b3x1"
Name 43 "r03"
Name 46 "b4x1"
Name 49 "r10"
Name 50 "b1x2"
Name 55 "r11"
Name 56 "b2x2"
Name 61 "r12"
Name 64 "b3x2"
Name 69 "r13"
Name 72 "b4x2"
Name 75 "r20"
Name 76 "b1x3"
Name 79 "r21"
Name 80 "b2x3"
Name 85 "r22"
Name 86 "b3x3"
Name 91 "r23"
Name 94 "b4x3"
Name 97 "r30"
Name 98 "b1x4"
Name 101 "r31"
Name 102 "b2x4"
Name 105 "r32"
Name 106 "b3x4"
Name 111 "r33"
Name 112 "b4x4"
Name 116 "ps_output"
Name 127 "color"
Decorate 127(color) Location 0
2: TypeVoid
3: TypeFunction 2
8: TypeBool
9: TypeVector 8(bool) 1
10: TypeMatrix 9(bvec) 1
11: TypePointer Function 10
16: TypeVector 8(bool) 2
17: TypeMatrix 16(bvec2) 1
18: TypePointer Function 17
20: TypeMatrix 9(bvec) 2
21: TypePointer Function 20
25: TypeVector 8(bool) 3
26: TypeMatrix 25(bvec3) 1
8: TypeFloat 32
9: TypeVector 8(float) 4
10(PS_OUTPUT): TypeStruct 9(fvec4)
11: TypeFunction 10(PS_OUTPUT)
14: TypeBool
15: TypeVector 14(bool) 1
16: TypeMatrix 15(bvec) 1
17: TypePointer Function 16
22: TypeVector 14(bool) 2
23: TypeMatrix 22(bvec2) 1
24: TypePointer Function 23
26: TypeMatrix 15(bvec) 2
27: TypePointer Function 26
29: TypeMatrix 9(bvec) 3
30: TypePointer Function 29
34: TypeVector 8(bool) 4
35: TypeMatrix 34(bvec4) 1
31: TypeVector 14(bool) 3
32: TypeMatrix 31(bvec3) 1
33: TypePointer Function 32
35: TypeMatrix 15(bvec) 3
36: TypePointer Function 35
38: TypeMatrix 9(bvec) 4
39: TypePointer Function 38
47: TypeMatrix 16(bvec2) 2
48: TypePointer Function 47
53: TypeMatrix 25(bvec3) 2
40: TypeVector 14(bool) 4
41: TypeMatrix 40(bvec4) 1
42: TypePointer Function 41
44: TypeMatrix 15(bvec) 4
45: TypePointer Function 44
53: TypeMatrix 22(bvec2) 2
54: TypePointer Function 53
56: TypeMatrix 16(bvec2) 3
57: TypePointer Function 56
61: TypeMatrix 34(bvec4) 2
62: TypePointer Function 61
64: TypeMatrix 16(bvec2) 4
65: TypePointer Function 64
77: TypeMatrix 25(bvec3) 3
78: TypePointer Function 77
83: TypeMatrix 34(bvec4) 3
59: TypeMatrix 31(bvec3) 2
60: TypePointer Function 59
62: TypeMatrix 22(bvec2) 3
63: TypePointer Function 62
67: TypeMatrix 40(bvec4) 2
68: TypePointer Function 67
70: TypeMatrix 22(bvec2) 4
71: TypePointer Function 70
83: TypeMatrix 31(bvec3) 3
84: TypePointer Function 83
86: TypeMatrix 25(bvec3) 4
87: TypePointer Function 86
103: TypeMatrix 34(bvec4) 4
104: TypePointer Function 103
109: TypeFloat 32
110: TypeVector 109(float) 4
111(PS_OUTPUT): TypeStruct 110(fvec4)
112: TypePointer Function 111(PS_OUTPUT)
114: TypeInt 32 1
115: 114(int) Constant 0
116: 109(float) Constant 0
117: 110(fvec4) ConstantComposite 116 116 116 116
118: TypePointer Function 110(fvec4)
120: TypePointer Output 110(fvec4)
121(color): 120(ptr) Variable Output
89: TypeMatrix 40(bvec4) 3
90: TypePointer Function 89
92: TypeMatrix 31(bvec3) 4
93: TypePointer Function 92
109: TypeMatrix 40(bvec4) 4
110: TypePointer Function 109
115: TypePointer Function 10(PS_OUTPUT)
117: TypeInt 32 1
118: 117(int) Constant 0
119: 8(float) Constant 0
120: 9(fvec4) ConstantComposite 119 119 119 119
121: TypePointer Function 9(fvec4)
126: TypePointer Output 9(fvec4)
127(color): 126(ptr) Variable Output
4(main): 2 Function None 3
5: Label
113(ps_output): 112(ptr) Variable Function
119: 118(ptr) AccessChain 113(ps_output) 115
Store 119 117
122: 118(ptr) AccessChain 113(ps_output) 115
123: 110(fvec4) Load 122
Store 121(color) 123
128:10(PS_OUTPUT) FunctionCall 12(@main()
129: 9(fvec4) CompositeExtract 128 0
Store 127(color) 129
Return
FunctionEnd
6(TestBoolMatTypes(): 2 Function None 3
7: Label
12(r00): 11(ptr) Variable Function
13(b1x1): 11(ptr) Variable Function
19(r01): 18(ptr) Variable Function
22(b2x1): 21(ptr) Variable Function
28(r02): 27(ptr) Variable Function
31(b3x1): 30(ptr) Variable Function
37(r03): 36(ptr) Variable Function
40(b4x1): 39(ptr) Variable Function
43(r10): 21(ptr) Variable Function
44(b1x2): 18(ptr) Variable Function
49(r11): 48(ptr) Variable Function
50(b2x2): 48(ptr) Variable Function
55(r12): 54(ptr) Variable Function
58(b3x2): 57(ptr) Variable Function
63(r13): 62(ptr) Variable Function
66(b4x2): 65(ptr) Variable Function
69(r20): 30(ptr) Variable Function
70(b1x3): 27(ptr) Variable Function
73(r21): 57(ptr) Variable Function
74(b2x3): 54(ptr) Variable Function
79(r22): 78(ptr) Variable Function
80(b3x3): 78(ptr) Variable Function
85(r23): 84(ptr) Variable Function
88(b4x3): 87(ptr) Variable Function
91(r30): 39(ptr) Variable Function
92(b1x4): 36(ptr) Variable Function
95(r31): 65(ptr) Variable Function
96(b2x4): 62(ptr) Variable Function
99(r32): 87(ptr) Variable Function
100(b3x4): 84(ptr) Variable Function
105(r33): 104(ptr) Variable Function
106(b4x4): 104(ptr) Variable Function
14: 10 Load 13(b1x1)
15: 10 Transpose 14
Store 12(r00) 15
23: 20 Load 22(b2x1)
24: 17 Transpose 23
Store 19(r01) 24
32: 29 Load 31(b3x1)
33: 26 Transpose 32
Store 28(r02) 33
41: 38 Load 40(b4x1)
42: 35 Transpose 41
Store 37(r03) 42
45: 17 Load 44(b1x2)
46: 20 Transpose 45
Store 43(r10) 46
51: 47 Load 50(b2x2)
52: 47 Transpose 51
Store 49(r11) 52
59: 56 Load 58(b3x2)
60: 53 Transpose 59
Store 55(r12) 60
67: 64 Load 66(b4x2)
68: 61 Transpose 67
Store 63(r13) 68
71: 26 Load 70(b1x3)
72: 29 Transpose 71
Store 69(r20) 72
75: 53 Load 74(b2x3)
76: 56 Transpose 75
Store 73(r21) 76
81: 77 Load 80(b3x3)
82: 77 Transpose 81
Store 79(r22) 82
89: 86 Load 88(b4x3)
90: 83 Transpose 89
Store 85(r23) 90
93: 35 Load 92(b1x4)
94: 38 Transpose 93
Store 91(r30) 94
97: 61 Load 96(b2x4)
98: 64 Transpose 97
Store 95(r31) 98
101: 83 Load 100(b3x4)
102: 86 Transpose 101
Store 99(r32) 102
107: 103 Load 106(b4x4)
108: 103 Transpose 107
Store 105(r33) 108
18(r00): 17(ptr) Variable Function
19(b1x1): 17(ptr) Variable Function
25(r01): 24(ptr) Variable Function
28(b2x1): 27(ptr) Variable Function
34(r02): 33(ptr) Variable Function
37(b3x1): 36(ptr) Variable Function
43(r03): 42(ptr) Variable Function
46(b4x1): 45(ptr) Variable Function
49(r10): 27(ptr) Variable Function
50(b1x2): 24(ptr) Variable Function
55(r11): 54(ptr) Variable Function
56(b2x2): 54(ptr) Variable Function
61(r12): 60(ptr) Variable Function
64(b3x2): 63(ptr) Variable Function
69(r13): 68(ptr) Variable Function
72(b4x2): 71(ptr) Variable Function
75(r20): 36(ptr) Variable Function
76(b1x3): 33(ptr) Variable Function
79(r21): 63(ptr) Variable Function
80(b2x3): 60(ptr) Variable Function
85(r22): 84(ptr) Variable Function
86(b3x3): 84(ptr) Variable Function
91(r23): 90(ptr) Variable Function
94(b4x3): 93(ptr) Variable Function
97(r30): 45(ptr) Variable Function
98(b1x4): 42(ptr) Variable Function
101(r31): 71(ptr) Variable Function
102(b2x4): 68(ptr) Variable Function
105(r32): 93(ptr) Variable Function
106(b3x4): 90(ptr) Variable Function
111(r33): 110(ptr) Variable Function
112(b4x4): 110(ptr) Variable Function
20: 16 Load 19(b1x1)
21: 16 Transpose 20
Store 18(r00) 21
29: 26 Load 28(b2x1)
30: 23 Transpose 29
Store 25(r01) 30
38: 35 Load 37(b3x1)
39: 32 Transpose 38
Store 34(r02) 39
47: 44 Load 46(b4x1)
48: 41 Transpose 47
Store 43(r03) 48
51: 23 Load 50(b1x2)
52: 26 Transpose 51
Store 49(r10) 52
57: 53 Load 56(b2x2)
58: 53 Transpose 57
Store 55(r11) 58
65: 62 Load 64(b3x2)
66: 59 Transpose 65
Store 61(r12) 66
73: 70 Load 72(b4x2)
74: 67 Transpose 73
Store 69(r13) 74
77: 32 Load 76(b1x3)
78: 35 Transpose 77
Store 75(r20) 78
81: 59 Load 80(b2x3)
82: 62 Transpose 81
Store 79(r21) 82
87: 83 Load 86(b3x3)
88: 83 Transpose 87
Store 85(r22) 88
95: 92 Load 94(b4x3)
96: 89 Transpose 95
Store 91(r23) 96
99: 41 Load 98(b1x4)
100: 44 Transpose 99
Store 97(r30) 100
103: 67 Load 102(b2x4)
104: 70 Transpose 103
Store 101(r31) 104
107: 89 Load 106(b3x4)
108: 92 Transpose 107
Store 105(r32) 108
113: 109 Load 112(b4x4)
114: 109 Transpose 113
Store 111(r33) 114
Return
FunctionEnd
12(@main():10(PS_OUTPUT) Function None 11
13: Label
116(ps_output): 115(ptr) Variable Function
122: 121(ptr) AccessChain 116(ps_output) 118
Store 122 120
123:10(PS_OUTPUT) Load 116(ps_output)
ReturnValue 123
FunctionEnd