SPV: Create more access chains addressing a few swizzling issues.

- Fixes #1233
- Treats local bools like anything else
- more consistently deals with a dynamic component selection
This commit is contained in:
John Kessenich 2018-02-05 14:44:14 -07:00
parent 2651ccaec8
commit 5c3eed542d
8 changed files with 764 additions and 716 deletions

View file

@ -1,12 +1,12 @@
spv.accessChain.frag
// Module Version 10000
// Generated by (magic number): 80003
// Id's are bound by 206
// Id's are bound by 222
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 65 158
EntryPoint Fragment 4 "main" 69 170
ExecutionMode 4 OriginUpperLeft
Source GLSL 420
Name 4 "main"
@ -50,12 +50,12 @@ spv.accessChain.frag
Name 62 "GetColor13(struct-S-vf31;i1;"
Name 60 "i"
Name 61 "comp"
Name 65 "OutColor"
Name 153 "s"
Name 158 "u"
Name 159 "param"
Name 163 "param"
Name 167 "param"
Name 66 "GetColor14(struct-S-vf31;i1;"
Name 64 "i"
Name 65 "comp"
Name 69 "OutColor"
Name 165 "s"
Name 170 "u"
Name 171 "param"
Name 175 "param"
Name 179 "param"
@ -65,8 +65,12 @@ spv.accessChain.frag
Name 195 "param"
Name 199 "param"
Name 203 "param"
Decorate 65(OutColor) Location 0
Decorate 158(u) Flat
Name 207 "param"
Name 211 "param"
Name 215 "param"
Name 219 "param"
Decorate 69(OutColor) Location 0
Decorate 170(u) Flat
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -76,25 +80,27 @@ spv.accessChain.frag
13: TypeInt 32 1
14: TypePointer Function 13(int)
15: TypeFunction 2 8(S) 14(ptr)
64: TypePointer Output 7(fvec3)
65(OutColor): 64(ptr) Variable Output
66: 13(int) Constant 0
67: TypeInt 32 0
68: 67(int) Constant 0
95: TypeVector 6(float) 2
109: 67(int) Constant 2
136: TypePointer Output 6(float)
150: 6(float) Constant 0
151: 7(fvec3) ConstantComposite 150 150 150
152: TypePointer Function 8(S)
157: TypePointer Input 13(int)
158(u): 157(ptr) Variable Input
68: TypePointer Output 7(fvec3)
69(OutColor): 68(ptr) Variable Output
70: 13(int) Constant 0
71: TypeInt 32 0
72: 71(int) Constant 0
99: TypeVector 6(float) 2
113: 71(int) Constant 2
140: TypePointer Output 6(float)
147: 71(int) Constant 1
148: TypeVector 71(int) 2
149: 148(ivec2) ConstantComposite 113 147
158: TypeVector 71(int) 3
159: 158(ivec3) ConstantComposite 113 147 72
162: 6(float) Constant 0
163: 7(fvec3) ConstantComposite 162 162 162
164: TypePointer Function 8(S)
169: TypePointer Input 13(int)
170(u): 169(ptr) Variable Input
4(main): 2 Function None 3
5: Label
153(s): 152(ptr) Variable Function
159(param): 14(ptr) Variable Function
163(param): 14(ptr) Variable Function
167(param): 14(ptr) Variable Function
165(s): 164(ptr) Variable Function
171(param): 14(ptr) Variable Function
175(param): 14(ptr) Variable Function
179(param): 14(ptr) Variable Function
@ -104,224 +110,242 @@ spv.accessChain.frag
195(param): 14(ptr) Variable Function
199(param): 14(ptr) Variable Function
203(param): 14(ptr) Variable Function
Store 65(OutColor) 151
154: 8(S) Load 153(s)
155: 2 FunctionCall 11(GetColor1(struct-S-vf31;) 154
156: 8(S) Load 153(s)
160: 13(int) Load 158(u)
Store 159(param) 160
161: 2 FunctionCall 18(GetColor2(struct-S-vf31;i1;) 156 159(param)
162: 8(S) Load 153(s)
164: 13(int) Load 158(u)
Store 163(param) 164
165: 2 FunctionCall 22(GetColor3(struct-S-vf31;i1;) 162 163(param)
166: 8(S) Load 153(s)
168: 13(int) Load 158(u)
Store 167(param) 168
169: 2 FunctionCall 26(GetColor4(struct-S-vf31;i1;) 166 167(param)
170: 8(S) Load 153(s)
172: 13(int) Load 158(u)
207(param): 14(ptr) Variable Function
211(param): 14(ptr) Variable Function
215(param): 14(ptr) Variable Function
219(param): 14(ptr) Variable Function
Store 69(OutColor) 163
166: 8(S) Load 165(s)
167: 2 FunctionCall 11(GetColor1(struct-S-vf31;) 166
168: 8(S) Load 165(s)
172: 13(int) Load 170(u)
Store 171(param) 172
173: 2 FunctionCall 30(GetColor5(struct-S-vf31;i1;) 170 171(param)
174: 8(S) Load 153(s)
176: 13(int) Load 158(u)
173: 2 FunctionCall 18(GetColor2(struct-S-vf31;i1;) 168 171(param)
174: 8(S) Load 165(s)
176: 13(int) Load 170(u)
Store 175(param) 176
177: 2 FunctionCall 34(GetColor6(struct-S-vf31;i1;) 174 175(param)
178: 8(S) Load 153(s)
180: 13(int) Load 158(u)
177: 2 FunctionCall 22(GetColor3(struct-S-vf31;i1;) 174 175(param)
178: 8(S) Load 165(s)
180: 13(int) Load 170(u)
Store 179(param) 180
181: 2 FunctionCall 38(GetColor7(struct-S-vf31;i1;) 178 179(param)
182: 8(S) Load 153(s)
184: 13(int) Load 158(u)
181: 2 FunctionCall 26(GetColor4(struct-S-vf31;i1;) 178 179(param)
182: 8(S) Load 165(s)
184: 13(int) Load 170(u)
Store 183(param) 184
185: 2 FunctionCall 42(GetColor8(struct-S-vf31;i1;) 182 183(param)
186: 8(S) Load 153(s)
188: 13(int) Load 158(u)
185: 2 FunctionCall 30(GetColor5(struct-S-vf31;i1;) 182 183(param)
186: 8(S) Load 165(s)
188: 13(int) Load 170(u)
Store 187(param) 188
189: 2 FunctionCall 46(GetColor9(struct-S-vf31;i1;) 186 187(param)
190: 8(S) Load 153(s)
192: 13(int) Load 158(u)
189: 2 FunctionCall 34(GetColor6(struct-S-vf31;i1;) 186 187(param)
190: 8(S) Load 165(s)
192: 13(int) Load 170(u)
Store 191(param) 192
193: 2 FunctionCall 50(GetColor10(struct-S-vf31;i1;) 190 191(param)
194: 8(S) Load 153(s)
196: 13(int) Load 158(u)
193: 2 FunctionCall 38(GetColor7(struct-S-vf31;i1;) 190 191(param)
194: 8(S) Load 165(s)
196: 13(int) Load 170(u)
Store 195(param) 196
197: 2 FunctionCall 54(GetColor11(struct-S-vf31;i1;) 194 195(param)
198: 8(S) Load 153(s)
200: 13(int) Load 158(u)
197: 2 FunctionCall 42(GetColor8(struct-S-vf31;i1;) 194 195(param)
198: 8(S) Load 165(s)
200: 13(int) Load 170(u)
Store 199(param) 200
201: 2 FunctionCall 58(GetColor12(struct-S-vf31;i1;) 198 199(param)
202: 8(S) Load 153(s)
204: 13(int) Load 158(u)
201: 2 FunctionCall 46(GetColor9(struct-S-vf31;i1;) 198 199(param)
202: 8(S) Load 165(s)
204: 13(int) Load 170(u)
Store 203(param) 204
205: 2 FunctionCall 62(GetColor13(struct-S-vf31;i1;) 202 203(param)
205: 2 FunctionCall 50(GetColor10(struct-S-vf31;i1;) 202 203(param)
206: 8(S) Load 165(s)
208: 13(int) Load 170(u)
Store 207(param) 208
209: 2 FunctionCall 54(GetColor11(struct-S-vf31;i1;) 206 207(param)
210: 8(S) Load 165(s)
212: 13(int) Load 170(u)
Store 211(param) 212
213: 2 FunctionCall 58(GetColor12(struct-S-vf31;i1;) 210 211(param)
214: 8(S) Load 165(s)
216: 13(int) Load 170(u)
Store 215(param) 216
217: 2 FunctionCall 62(GetColor13(struct-S-vf31;i1;) 214 215(param)
218: 8(S) Load 165(s)
220: 13(int) Load 170(u)
Store 219(param) 220
221: 2 FunctionCall 66(GetColor14(struct-S-vf31;i1;) 218 219(param)
Return
FunctionEnd
11(GetColor1(struct-S-vf31;): 2 Function None 9
10(i): 8(S) FunctionParameter
12: Label
69: 6(float) CompositeExtract 10(i) 0 0
70: 7(fvec3) Load 65(OutColor)
71: 7(fvec3) CompositeConstruct 69 69 69
72: 7(fvec3) FAdd 70 71
Store 65(OutColor) 72
73: 6(float) CompositeExtract 10(i) 0 0
74: 7(fvec3) Load 69(OutColor)
75: 7(fvec3) CompositeConstruct 73 73 73
76: 7(fvec3) FAdd 74 75
Store 69(OutColor) 76
Return
FunctionEnd
18(GetColor2(struct-S-vf31;i1;): 2 Function None 15
16(i): 8(S) FunctionParameter
17(comp): 14(ptr) FunctionParameter
19: Label
73: 13(int) Load 17(comp)
74: 7(fvec3) CompositeExtract 16(i) 0
75: 6(float) VectorExtractDynamic 74 73
76: 7(fvec3) Load 65(OutColor)
77: 7(fvec3) CompositeConstruct 75 75 75
78: 7(fvec3) FAdd 76 77
Store 65(OutColor) 78
77: 13(int) Load 17(comp)
78: 7(fvec3) CompositeExtract 16(i) 0
79: 6(float) VectorExtractDynamic 78 77
80: 7(fvec3) Load 69(OutColor)
81: 7(fvec3) CompositeConstruct 79 79 79
82: 7(fvec3) FAdd 80 81
Store 69(OutColor) 82
Return
FunctionEnd
22(GetColor3(struct-S-vf31;i1;): 2 Function None 15
20(i): 8(S) FunctionParameter
21(comp): 14(ptr) FunctionParameter
23: Label
79: 13(int) Load 21(comp)
80: 7(fvec3) CompositeExtract 20(i) 0
81: 6(float) VectorExtractDynamic 80 79
82: 7(fvec3) Load 65(OutColor)
83: 7(fvec3) CompositeConstruct 81 81 81
84: 7(fvec3) FAdd 82 83
Store 65(OutColor) 84
83: 13(int) Load 21(comp)
84: 7(fvec3) CompositeExtract 20(i) 0
85: 6(float) VectorExtractDynamic 84 83
86: 7(fvec3) Load 69(OutColor)
87: 7(fvec3) CompositeConstruct 85 85 85
88: 7(fvec3) FAdd 86 87
Store 69(OutColor) 88
Return
FunctionEnd
26(GetColor4(struct-S-vf31;i1;): 2 Function None 15
24(i): 8(S) FunctionParameter
25(comp): 14(ptr) FunctionParameter
27: Label
85: 13(int) Load 25(comp)
86: 7(fvec3) CompositeExtract 24(i) 0
87: 6(float) VectorExtractDynamic 86 85
88: 7(fvec3) Load 65(OutColor)
89: 7(fvec3) CompositeConstruct 87 87 87
90: 7(fvec3) FAdd 88 89
Store 65(OutColor) 90
89: 13(int) Load 25(comp)
90: 7(fvec3) CompositeExtract 24(i) 0
91: 6(float) VectorExtractDynamic 90 89
92: 7(fvec3) Load 69(OutColor)
93: 7(fvec3) CompositeConstruct 91 91 91
94: 7(fvec3) FAdd 92 93
Store 69(OutColor) 94
Return
FunctionEnd
30(GetColor5(struct-S-vf31;i1;): 2 Function None 15
28(i): 8(S) FunctionParameter
29(comp): 14(ptr) FunctionParameter
31: Label
91: 7(fvec3) CompositeExtract 28(i) 0
92: 7(fvec3) Load 65(OutColor)
93: 7(fvec3) FAdd 92 91
Store 65(OutColor) 93
95: 7(fvec3) CompositeExtract 28(i) 0
96: 7(fvec3) Load 69(OutColor)
97: 7(fvec3) FAdd 96 95
Store 69(OutColor) 97
Return
FunctionEnd
34(GetColor6(struct-S-vf31;i1;): 2 Function None 15
32(i): 8(S) FunctionParameter
33(comp): 14(ptr) FunctionParameter
35: Label
94: 13(int) Load 33(comp)
96: 7(fvec3) CompositeExtract 32(i) 0
97: 95(fvec2) VectorShuffle 96 96 1 0
98: 6(float) VectorExtractDynamic 97 94
99: 7(fvec3) Load 65(OutColor)
100: 7(fvec3) CompositeConstruct 98 98 98
101: 7(fvec3) FAdd 99 100
Store 65(OutColor) 101
98: 13(int) Load 33(comp)
100: 7(fvec3) CompositeExtract 32(i) 0
101: 99(fvec2) VectorShuffle 100 100 1 0
102: 6(float) VectorExtractDynamic 101 98
103: 7(fvec3) Load 69(OutColor)
104: 7(fvec3) CompositeConstruct 102 102 102
105: 7(fvec3) FAdd 103 104
Store 69(OutColor) 105
Return
FunctionEnd
38(GetColor7(struct-S-vf31;i1;): 2 Function None 15
36(i): 8(S) FunctionParameter
37(comp): 14(ptr) FunctionParameter
39: Label
102: 7(fvec3) CompositeExtract 36(i) 0
103: 95(fvec2) VectorShuffle 102 102 0 1
104: 7(fvec3) Load 65(OutColor)
105: 95(fvec2) VectorShuffle 104 104 0 1
106: 95(fvec2) FAdd 105 103
107: 7(fvec3) Load 65(OutColor)
108: 7(fvec3) VectorShuffle 107 106 3 4 2
Store 65(OutColor) 108
106: 7(fvec3) CompositeExtract 36(i) 0
107: 99(fvec2) VectorShuffle 106 106 0 1
108: 7(fvec3) Load 69(OutColor)
109: 99(fvec2) VectorShuffle 108 108 0 1
110: 99(fvec2) FAdd 109 107
111: 7(fvec3) Load 69(OutColor)
112: 7(fvec3) VectorShuffle 111 110 3 4 2
Store 69(OutColor) 112
Return
FunctionEnd
42(GetColor8(struct-S-vf31;i1;): 2 Function None 15
40(i): 8(S) FunctionParameter
41(comp): 14(ptr) FunctionParameter
43: Label
110: 6(float) CompositeExtract 40(i) 0 2
111: 7(fvec3) Load 65(OutColor)
112: 7(fvec3) CompositeConstruct 110 110 110
113: 7(fvec3) FAdd 111 112
Store 65(OutColor) 113
114: 6(float) CompositeExtract 40(i) 0 2
115: 7(fvec3) Load 69(OutColor)
116: 7(fvec3) CompositeConstruct 114 114 114
117: 7(fvec3) FAdd 115 116
Store 69(OutColor) 117
Return
FunctionEnd
46(GetColor9(struct-S-vf31;i1;): 2 Function None 15
44(i): 8(S) FunctionParameter
45(comp): 14(ptr) FunctionParameter
47: Label
114: 7(fvec3) CompositeExtract 44(i) 0
115: 7(fvec3) Load 65(OutColor)
116: 7(fvec3) VectorShuffle 115 115 2 0 1
117: 7(fvec3) FAdd 116 114
118: 7(fvec3) Load 65(OutColor)
119: 7(fvec3) VectorShuffle 118 117 4 5 3
Store 65(OutColor) 119
118: 7(fvec3) CompositeExtract 44(i) 0
119: 7(fvec3) Load 69(OutColor)
120: 7(fvec3) VectorShuffle 119 119 2 0 1
121: 7(fvec3) FAdd 120 118
122: 7(fvec3) Load 69(OutColor)
123: 7(fvec3) VectorShuffle 122 121 4 5 3
Store 69(OutColor) 123
Return
FunctionEnd
50(GetColor10(struct-S-vf31;i1;): 2 Function None 15
48(i): 8(S) FunctionParameter
49(comp): 14(ptr) FunctionParameter
51: Label
120: 7(fvec3) CompositeExtract 48(i) 0
121: 95(fvec2) VectorShuffle 120 120 0 1
122: 7(fvec3) Load 65(OutColor)
123: 95(fvec2) VectorShuffle 122 122 2 1
124: 95(fvec2) FAdd 123 121
125: 7(fvec3) Load 65(OutColor)
126: 7(fvec3) VectorShuffle 125 124 0 4 3
Store 65(OutColor) 126
124: 7(fvec3) CompositeExtract 48(i) 0
125: 99(fvec2) VectorShuffle 124 124 0 1
126: 7(fvec3) Load 69(OutColor)
127: 99(fvec2) VectorShuffle 126 126 2 1
128: 99(fvec2) FAdd 127 125
129: 7(fvec3) Load 69(OutColor)
130: 7(fvec3) VectorShuffle 129 128 0 4 3
Store 69(OutColor) 130
Return
FunctionEnd
54(GetColor11(struct-S-vf31;i1;): 2 Function None 15
52(i): 8(S) FunctionParameter
53(comp): 14(ptr) FunctionParameter
55: Label
127: 7(fvec3) CompositeExtract 52(i) 0
128: 95(fvec2) VectorShuffle 127 127 0 1
129: 7(fvec3) Load 65(OutColor)
130: 95(fvec2) VectorShuffle 129 129 0 2
131: 95(fvec2) FAdd 130 128
132: 7(fvec3) Load 65(OutColor)
133: 7(fvec3) VectorShuffle 132 131 3 1 4
Store 65(OutColor) 133
131: 7(fvec3) CompositeExtract 52(i) 0
132: 99(fvec2) VectorShuffle 131 131 0 1
133: 7(fvec3) Load 69(OutColor)
134: 99(fvec2) VectorShuffle 133 133 0 2
135: 99(fvec2) FAdd 134 132
136: 7(fvec3) Load 69(OutColor)
137: 7(fvec3) VectorShuffle 136 135 3 1 4
Store 69(OutColor) 137
Return
FunctionEnd
58(GetColor12(struct-S-vf31;i1;): 2 Function None 15
56(i): 8(S) FunctionParameter
57(comp): 14(ptr) FunctionParameter
59: Label
134: 13(int) Load 57(comp)
135: 6(float) CompositeExtract 56(i) 0 0
137: 136(ptr) AccessChain 65(OutColor) 134
138: 6(float) Load 137
139: 6(float) FAdd 138 135
140: 136(ptr) AccessChain 65(OutColor) 134
Store 140 139
138: 13(int) Load 57(comp)
139: 6(float) CompositeExtract 56(i) 0 0
141: 140(ptr) AccessChain 69(OutColor) 138
142: 6(float) Load 141
143: 6(float) FAdd 142 139
144: 140(ptr) AccessChain 69(OutColor) 138
Store 144 143
Return
FunctionEnd
62(GetColor13(struct-S-vf31;i1;): 2 Function None 15
60(i): 8(S) FunctionParameter
61(comp): 14(ptr) FunctionParameter
63: Label
141: 13(int) Load 61(comp)
142: 6(float) CompositeExtract 60(i) 0 0
143: 7(fvec3) Load 65(OutColor)
144: 95(fvec2) VectorShuffle 143 143 2 1
145: 6(float) VectorExtractDynamic 144 141
146: 6(float) FAdd 145 142
147: 7(fvec3) Load 65(OutColor)
148: 7(fvec3) VectorShuffle 147 147 2 1 2
149: 7(fvec3) VectorInsertDynamic 148 146 141
Store 65(OutColor) 149
145: 13(int) Load 61(comp)
146: 6(float) CompositeExtract 60(i) 0 0
150: 71(int) VectorExtractDynamic 149 145
151: 140(ptr) AccessChain 69(OutColor) 150
152: 6(float) Load 151
153: 6(float) FAdd 152 146
154: 71(int) VectorExtractDynamic 149 145
155: 140(ptr) AccessChain 69(OutColor) 154
Store 155 153
Return
FunctionEnd
66(GetColor14(struct-S-vf31;i1;): 2 Function None 15
64(i): 8(S) FunctionParameter
65(comp): 14(ptr) FunctionParameter
67: Label
156: 13(int) Load 65(comp)
157: 6(float) CompositeExtract 64(i) 0 0
160: 71(int) VectorExtractDynamic 159 156
161: 140(ptr) AccessChain 69(OutColor) 160
Store 161 157
Return
FunctionEnd