SPV: Implement OpImage functionality (emit before query).

This commit is contained in:
John Kessenich
2015-12-08 19:32:47 -07:00
parent 45457bcddb
commit 33661450c7
7 changed files with 594 additions and 559 deletions

View File

@@ -7,12 +7,12 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 212
// Id's are bound by 214
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 78 17 68 98 182 183 184 185 185 171
EntryPoint Fragment 4 "main" 79 17 68 99 184 185 186 187 187 173
ExecutionMode 4 OriginLowerLeft
Source GLSL 130
SourceExtension "GL_ARB_gpu_shader5"
@@ -33,38 +33,38 @@ Linked fragment stage:
Name 55 "samp2DS"
Name 68 "io"
Name 72 "Sca"
Name 78 "i"
Name 86 "Isca"
Name 98 "uo"
Name 102 "Usca"
Name 113 "a"
Name 117 "Scas"
Name 122 "f"
Name 131 "c"
Name 152 "a1"
Name 155 "m43"
Name 158 "b"
Name 165 "sampC"
Name 171 "gl_ClipDistance"
Name 181 "b"
Name 182 "fflat"
Name 183 "fsmooth"
Name 184 "fnop"
Name 185 "gl_Color"
Name 192 "bounds"
Name 193 "s2D"
Name 194 "s2DR"
Name 198 "s2DRS"
Name 202 "s1D"
Name 203 "s2DS"
Name 205 "f"
Name 207 "v2"
Name 209 "v3"
Name 211 "v4"
Decorate 171(gl_ClipDistance) BuiltIn ClipDistance
Decorate 182(fflat) Flat
Decorate 184(fnop) NoPerspective
Decorate 192(bounds) Binding 0
Name 79 "i"
Name 87 "Isca"
Name 99 "uo"
Name 103 "Usca"
Name 114 "a"
Name 118 "Scas"
Name 124 "f"
Name 133 "c"
Name 154 "a1"
Name 157 "m43"
Name 160 "b"
Name 167 "sampC"
Name 173 "gl_ClipDistance"
Name 183 "b"
Name 184 "fflat"
Name 185 "fsmooth"
Name 186 "fnop"
Name 187 "gl_Color"
Name 194 "bounds"
Name 195 "s2D"
Name 196 "s2DR"
Name 200 "s2DRS"
Name 204 "s1D"
Name 205 "s2DS"
Name 207 "f"
Name 209 "v2"
Name 211 "v3"
Name 213 "v4"
Decorate 173(gl_ClipDistance) BuiltIn ClipDistance
Decorate 184(fflat) Flat
Decorate 186(fnop) NoPerspective
Decorate 194(bounds) Binding 0
2: TypeVoid
3: TypeFunction 2
14: TypeFloat 32
@@ -107,94 +107,94 @@ Linked fragment stage:
71: TypePointer UniformConstant 70
72(Sca): 71(ptr) Variable UniformConstant
74: 26(int) Constant 3
77: TypePointer Input 15(fvec4)
78(i): 77(ptr) Variable Input
83: TypeImage 26(int) Cube array sampled format:Unknown
84: TypeSampledImage 83
85: TypePointer UniformConstant 84
86(Isca): 85(ptr) Variable UniformConstant
89: 14(float) Constant 1060320051
90: TypeVector 26(int) 4
95: TypeInt 32 0
96: TypeVector 95(int) 4
97: TypePointer Output 96(ivec4)
98(uo): 97(ptr) Variable Output
99: TypeImage 95(int) Cube array sampled format:Unknown
100: TypeSampledImage 99
101: TypePointer UniformConstant 100
102(Usca): 101(ptr) Variable UniformConstant
108: 14(float) Constant 1071225242
112: TypePointer Private 39(fvec3)
113(a): 112(ptr) Variable Private
114: TypeImage 14(float) Cube depth array sampled format:Unknown
115: TypeSampledImage 114
116: TypePointer UniformConstant 115
117(Scas): 116(ptr) Variable UniformConstant
121: TypePointer Function 14(float)
125: 95(int) Constant 1
126: TypePointer Input 14(float)
130: TypePointer Function 90(ivec4)
134: 14(float) Constant 1036831949
135: 39(fvec3) ConstantComposite 134 134 134
136: 14(float) Constant 1045220557
78: TypePointer Input 15(fvec4)
79(i): 78(ptr) Variable Input
84: TypeImage 26(int) Cube array sampled format:Unknown
85: TypeSampledImage 84
86: TypePointer UniformConstant 85
87(Isca): 86(ptr) Variable UniformConstant
90: 14(float) Constant 1060320051
91: TypeVector 26(int) 4
96: TypeInt 32 0
97: TypeVector 96(int) 4
98: TypePointer Output 97(ivec4)
99(uo): 98(ptr) Variable Output
100: TypeImage 96(int) Cube array sampled format:Unknown
101: TypeSampledImage 100
102: TypePointer UniformConstant 101
103(Usca): 102(ptr) Variable UniformConstant
109: 14(float) Constant 1071225242
113: TypePointer Private 39(fvec3)
114(a): 113(ptr) Variable Private
115: TypeImage 14(float) Cube depth array sampled format:Unknown
116: TypeSampledImage 115
117: TypePointer UniformConstant 116
118(Scas): 117(ptr) Variable UniformConstant
123: TypePointer Function 14(float)
127: 96(int) Constant 1
128: TypePointer Input 14(float)
132: TypePointer Function 91(ivec4)
136: 14(float) Constant 1036831949
137: 39(fvec3) ConstantComposite 136 136 136
153: TypeMatrix 39(fvec3) 4
154: TypePointer Function 153
159: 14(float) Constant 1073741824
162: TypeImage 14(float) Cube sampled format:Unknown
163: TypeSampledImage 162
164: TypePointer UniformConstant 163
165(sampC): 164(ptr) Variable UniformConstant
168: 95(int) Constant 4
169: TypeArray 14(float) 168
170: TypePointer Input 169
171(gl_ClipDistance): 170(ptr) Variable Input
174: TypePointer Output 14(float)
180: TypePointer Private 14(float)
181(b): 180(ptr) Variable Private
182(fflat): 126(ptr) Variable Input
183(fsmooth): 126(ptr) Variable Input
184(fnop): 126(ptr) Variable Input
185(gl_Color): 77(ptr) Variable Input
186: 95(int) Constant 3
187: TypeArray 26(int) 186
188: 26(int) Constant 10
189: 26(int) Constant 23
190: 26(int) Constant 32
191: 187 ConstantComposite 188 189 190
192(bounds): 20(ptr) Variable UniformConstant
193(s2D): 20(ptr) Variable UniformConstant
194(s2DR): 46(ptr) Variable UniformConstant
195: TypeImage 14(float) Rect depth sampled format:Unknown
196: TypeSampledImage 195
197: TypePointer UniformConstant 196
198(s2DRS): 197(ptr) Variable UniformConstant
199: TypeImage 14(float) 1D sampled format:Unknown
200: TypeSampledImage 199
201: TypePointer UniformConstant 200
202(s1D): 201(ptr) Variable UniformConstant
203(s2DS): 54(ptr) Variable UniformConstant
204: TypePointer UniformConstant 14(float)
205(f): 204(ptr) Variable UniformConstant
206: TypePointer UniformConstant 23(fvec2)
207(v2): 206(ptr) Variable UniformConstant
208: TypePointer UniformConstant 39(fvec3)
209(v3): 208(ptr) Variable UniformConstant
210: TypePointer UniformConstant 15(fvec4)
211(v4): 210(ptr) Variable UniformConstant
138: 14(float) Constant 1045220557
139: 39(fvec3) ConstantComposite 138 138 138
155: TypeMatrix 39(fvec3) 4
156: TypePointer Function 155
161: 14(float) Constant 1073741824
164: TypeImage 14(float) Cube sampled format:Unknown
165: TypeSampledImage 164
166: TypePointer UniformConstant 165
167(sampC): 166(ptr) Variable UniformConstant
170: 96(int) Constant 4
171: TypeArray 14(float) 170
172: TypePointer Input 171
173(gl_ClipDistance): 172(ptr) Variable Input
176: TypePointer Output 14(float)
182: TypePointer Private 14(float)
183(b): 182(ptr) Variable Private
184(fflat): 128(ptr) Variable Input
185(fsmooth): 128(ptr) Variable Input
186(fnop): 128(ptr) Variable Input
187(gl_Color): 78(ptr) Variable Input
188: 96(int) Constant 3
189: TypeArray 26(int) 188
190: 26(int) Constant 10
191: 26(int) Constant 23
192: 26(int) Constant 32
193: 189 ConstantComposite 190 191 192
194(bounds): 20(ptr) Variable UniformConstant
195(s2D): 20(ptr) Variable UniformConstant
196(s2DR): 46(ptr) Variable UniformConstant
197: TypeImage 14(float) Rect depth sampled format:Unknown
198: TypeSampledImage 197
199: TypePointer UniformConstant 198
200(s2DRS): 199(ptr) Variable UniformConstant
201: TypeImage 14(float) 1D sampled format:Unknown
202: TypeSampledImage 201
203: TypePointer UniformConstant 202
204(s1D): 203(ptr) Variable UniformConstant
205(s2DS): 54(ptr) Variable UniformConstant
206: TypePointer UniformConstant 14(float)
207(f): 206(ptr) Variable UniformConstant
208: TypePointer UniformConstant 23(fvec2)
209(v2): 208(ptr) Variable UniformConstant
210: TypePointer UniformConstant 39(fvec3)
211(v3): 210(ptr) Variable UniformConstant
212: TypePointer UniformConstant 15(fvec4)
213(v4): 212(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
166: 163 Load 165(sampC)
167: 15(fvec4) ImageGather 166 137 30
Store 17(o) 167
172: 126(ptr) AccessChain 171(gl_ClipDistance) 74
173: 14(float) Load 172
175: 174(ptr) AccessChain 17(o) 125
Store 175 173
176: 2 FunctionCall 6(bar3()
177: 2 FunctionCall 8(bar4()
178: 2 FunctionCall 10(bar5()
179: 2 FunctionCall 12(bar6()
168: 165 Load 167(sampC)
169: 15(fvec4) ImageGather 168 139 30
Store 17(o) 169
174: 128(ptr) AccessChain 173(gl_ClipDistance) 74
175: 14(float) Load 174
177: 176(ptr) AccessChain 17(o) 127
Store 177 175
178: 2 FunctionCall 6(bar3()
179: 2 FunctionCall 8(bar4()
180: 2 FunctionCall 10(bar5()
181: 2 FunctionCall 12(bar6()
Return
FunctionEnd
6(bar3(): 2 Function None 3
@@ -232,74 +232,76 @@ Linked fragment stage:
FunctionEnd
10(bar5(): 2 Function None 3
11: Label
122(f): 121(ptr) Variable Function
131(c): 130(ptr) Variable Function
124(f): 123(ptr) Variable Function
133(c): 132(ptr) Variable Function
73: 70 Load 72(Sca)
75: 66(ivec3) ImageQuerySizeLod 73 74
Store 68(io) 75
76: 70 Load 72(Sca)
79: 15(fvec4) Load 78(i)
80: 15(fvec4) ImageSampleImplicitLod 76 79
81: 15(fvec4) Load 17(o)
82: 15(fvec4) FAdd 81 80
Store 17(o) 82
87: 84 Load 86(Isca)
88: 15(fvec4) Load 78(i)
91: 90(ivec4) ImageSampleImplicitLod 87 88 Bias 89
92: 66(ivec3) VectorShuffle 91 91 0 1 2
93: 66(ivec3) Load 68(io)
94: 66(ivec3) IAdd 93 92
Store 68(io) 94
103: 100 Load 102(Usca)
104: 15(fvec4) Load 78(i)
105: 96(ivec4) ImageSampleImplicitLod 103 104
Store 98(uo) 105
106: 70 Load 72(Sca)
107: 15(fvec4) Load 78(i)
109: 15(fvec4) ImageSampleExplicitLod 106 107 Lod 108
110: 15(fvec4) Load 17(o)
111: 15(fvec4) FAdd 110 109
Store 17(o) 111
118: 115 Load 117(Scas)
119: 66(ivec3) ImageQuerySizeLod 118 74
120: 39(fvec3) ConvertSToF 119
Store 113(a) 120
123: 115 Load 117(Scas)
124: 15(fvec4) Load 78(i)
127: 126(ptr) AccessChain 78(i) 125
128: 14(float) Load 127
129: 14(float) ImageSampleDrefImplicitLod 123 124 128
Store 122(f) 129
132: 84 Load 86(Isca)
133: 15(fvec4) Load 78(i)
138: 90(ivec4) ImageSampleExplicitLod 132 133 Grad 135 137
Store 131(c) 138
139: 39(fvec3) Load 113(a)
140: 14(float) Load 122(f)
141: 90(ivec4) Load 131(c)
142: 15(fvec4) ConvertSToF 141
143: 15(fvec4) CompositeConstruct 140 140 140 140
144: 15(fvec4) FAdd 143 142
145: 14(float) CompositeExtract 139 0
146: 14(float) CompositeExtract 139 1
147: 14(float) CompositeExtract 139 2
148: 14(float) CompositeExtract 144 0
149: 15(fvec4) CompositeConstruct 145 146 147 148
150: 15(fvec4) Load 17(o)
151: 15(fvec4) FAdd 150 149
Store 17(o) 151
75: 69 Image 73
76: 66(ivec3) ImageQuerySizeLod 75 74
Store 68(io) 76
77: 70 Load 72(Sca)
80: 15(fvec4) Load 79(i)
81: 15(fvec4) ImageSampleImplicitLod 77 80
82: 15(fvec4) Load 17(o)
83: 15(fvec4) FAdd 82 81
Store 17(o) 83
88: 85 Load 87(Isca)
89: 15(fvec4) Load 79(i)
92: 91(ivec4) ImageSampleImplicitLod 88 89 Bias 90
93: 66(ivec3) VectorShuffle 92 92 0 1 2
94: 66(ivec3) Load 68(io)
95: 66(ivec3) IAdd 94 93
Store 68(io) 95
104: 101 Load 103(Usca)
105: 15(fvec4) Load 79(i)
106: 97(ivec4) ImageSampleImplicitLod 104 105
Store 99(uo) 106
107: 70 Load 72(Sca)
108: 15(fvec4) Load 79(i)
110: 15(fvec4) ImageSampleExplicitLod 107 108 Lod 109
111: 15(fvec4) Load 17(o)
112: 15(fvec4) FAdd 111 110
Store 17(o) 112
119: 116 Load 118(Scas)
120: 115 Image 119
121: 66(ivec3) ImageQuerySizeLod 120 74
122: 39(fvec3) ConvertSToF 121
Store 114(a) 122
125: 116 Load 118(Scas)
126: 15(fvec4) Load 79(i)
129: 128(ptr) AccessChain 79(i) 127
130: 14(float) Load 129
131: 14(float) ImageSampleDrefImplicitLod 125 126 130
Store 124(f) 131
134: 85 Load 87(Isca)
135: 15(fvec4) Load 79(i)
140: 91(ivec4) ImageSampleExplicitLod 134 135 Grad 137 139
Store 133(c) 140
141: 39(fvec3) Load 114(a)
142: 14(float) Load 124(f)
143: 91(ivec4) Load 133(c)
144: 15(fvec4) ConvertSToF 143
145: 15(fvec4) CompositeConstruct 142 142 142 142
146: 15(fvec4) FAdd 145 144
147: 14(float) CompositeExtract 141 0
148: 14(float) CompositeExtract 141 1
149: 14(float) CompositeExtract 141 2
150: 14(float) CompositeExtract 146 0
151: 15(fvec4) CompositeConstruct 147 148 149 150
152: 15(fvec4) Load 17(o)
153: 15(fvec4) FAdd 152 151
Store 17(o) 153
Return
FunctionEnd
12(bar6(): 2 Function None 3
13: Label
152(a1): 121(ptr) Variable Function
155(m43): 154(ptr) Variable Function
158(b): 121(ptr) Variable Function
156: 121(ptr) AccessChain 155(m43) 74 125
157: 14(float) Load 156
Store 152(a1) 157
160: 14(float) Load 152(a1)
161: 14(float) FMul 159 160
Store 158(b) 161
154(a1): 123(ptr) Variable Function
157(m43): 156(ptr) Variable Function
160(b): 123(ptr) Variable Function
158: 123(ptr) AccessChain 157(m43) 74 127
159: 14(float) Load 158
Store 154(a1) 159
162: 14(float) Load 154(a1)
163: 14(float) FMul 161 162
Store 160(b) 163
Return
FunctionEnd