blob: b590ee6d327537e0bdc7576d7685cdf00a6abe8f [file] [log] [blame]
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 412
; Schema: 0
OpCapability Shader
%176 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %gl_FragCoord_param_1 %x_GLF_color_1_1
OpExecutionMode %main OriginUpperLeft
OpName %gl_FragCoord_param_1 "gl_FragCoord_param_1"
OpName %x_GLF_color_1_1 "x_GLF_color_1_1"
OpName %data "data"
OpName %temp "temp"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "injectionSwitch"
OpName %x_28 "x_28"
OpName %gl_FragCoord "gl_FragCoord"
OpName %x_GLF_color "x_GLF_color"
OpName %buf1 "buf1"
OpMemberName %buf1 0 "resolution"
OpName %x_32 "x_32"
OpName %merge_i1_i1_i1_ "merge_i1_i1_i1_"
OpName %from "from"
OpName %mid "mid"
OpName %to "to"
OpName %k "k"
OpName %i "i"
OpName %j "j"
OpName %i_1 "i_1"
OpName %mergeSort_ "mergeSort_"
OpName %low "low"
OpName %high "high"
OpName %m "m"
OpName %i_2 "i_2"
OpName %from_1 "from_1"
OpName %mid_1 "mid_1"
OpName %to_1 "to_1"
OpName %param "param"
OpName %param_1 "param_1"
OpName %param_2 "param_2"
OpName %main_1 "main_1"
OpName %i_3 "i_3"
OpName %j_1 "j_1"
OpName %grey "grey"
OpName %main_out "main_out"
OpMemberName %main_out 0 "x_GLF_color_1"
OpName %main_inner "main_inner"
OpName %gl_FragCoord_param "gl_FragCoord_param"
OpName %main "main"
OpDecorate %gl_FragCoord_param_1 BuiltIn FragCoord
OpDecorate %x_GLF_color_1_1 Location 0
OpDecorate %_arr_int_uint_10 ArrayStride 4
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_28 NonWritable
OpDecorate %x_28 DescriptorSet 0
OpDecorate %x_28 Binding 0
OpDecorate %buf1 Block
OpMemberDecorate %buf1 0 Offset 0
OpDecorate %x_32 NonWritable
OpDecorate %x_32 DescriptorSet 0
OpDecorate %x_32 Binding 1
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Input_v4float = OpTypePointer Input %v4float
%gl_FragCoord_param_1 = OpVariable %_ptr_Input_v4float Input
%_ptr_Output_v4float = OpTypePointer Output %v4float
%7 = OpConstantNull %v4float
%x_GLF_color_1_1 = OpVariable %_ptr_Output_v4float Output %7
%int = OpTypeInt 32 1
%uint = OpTypeInt 32 0
%uint_10 = OpConstant %uint 10
%_arr_int_uint_10 = OpTypeArray %int %uint_10
%_ptr_Private__arr_int_uint_10 = OpTypePointer Private %_arr_int_uint_10
%14 = OpConstantNull %_arr_int_uint_10
%data = OpVariable %_ptr_Private__arr_int_uint_10 Private %14
%temp = OpVariable %_ptr_Private__arr_int_uint_10 Private %14
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_28 = OpVariable %_ptr_Uniform_buf0 Uniform
%_ptr_Private_v4float = OpTypePointer Private %v4float
%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %7
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %7
%buf1 = OpTypeStruct %v2float
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
%x_32 = OpVariable %_ptr_Uniform_buf1 Uniform
%void = OpTypeVoid
%_ptr_Function_int = OpTypePointer Function %int
%26 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int
%35 = OpConstantNull %int
%int_1 = OpConstant %int 1
%bool = OpTypeBool
%_ptr_Private_int = OpTypePointer Private %int
%int_10 = OpConstant %int 10
%131 = OpTypeFunction %void
%int_0 = OpConstant %int 0
%int_9 = OpConstant %int 9
%int_2 = OpConstant %int 2
%_ptr_Function_float = OpTypePointer Function %float
%200 = OpConstantNull %float
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%int_n5 = OpConstant %int -5
%int_n4 = OpConstant %int -4
%int_n3 = OpConstant %int -3
%int_n2 = OpConstant %int -2
%int_n1 = OpConstant %int -1
%int_3 = OpConstant %int 3
%int_4 = OpConstant %int 4
%uint_1 = OpConstant %uint 1
%_ptr_Private_float = OpTypePointer Private %float
%int_30 = OpConstant %int 30
%float_0_5 = OpConstant %float 0.5
%float_10 = OpConstant %float 10
%int_60 = OpConstant %int 60
%int_90 = OpConstant %int 90
%int_120 = OpConstant %int 120
%int_150 = OpConstant %int 150
%int_180 = OpConstant %int 180
%int_5 = OpConstant %int 5
%int_210 = OpConstant %int 210
%int_6 = OpConstant %int 6
%int_240 = OpConstant %int 240
%int_7 = OpConstant %int 7
%int_270 = OpConstant %int 270
%int_8 = OpConstant %int 8
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%main_out = OpTypeStruct %v4float
%399 = OpTypeFunction %main_out %v4float
%merge_i1_i1_i1_ = OpFunction %void None %26
%from = OpFunctionParameter %_ptr_Function_int
%mid = OpFunctionParameter %_ptr_Function_int
%to = OpFunctionParameter %_ptr_Function_int
%33 = OpLabel
%k = OpVariable %_ptr_Function_int Function %35
%i = OpVariable %_ptr_Function_int Function %35
%j = OpVariable %_ptr_Function_int Function %35
%i_1 = OpVariable %_ptr_Function_int Function %35
%40 = OpLoad %int %from
OpStore %k %40
%42 = OpLoad %int %from
OpStore %i %42
%44 = OpLoad %int %mid
%46 = OpIAdd %int %44 %int_1
OpStore %j %46
OpBranch %47
%47 = OpLabel
OpLoopMerge %48 %49 None
OpBranch %50
%50 = OpLabel
%51 = OpLoad %int %i
%53 = OpLoad %int %mid
%54 = OpLoad %int %j
%56 = OpLoad %int %to
%57 = OpSLessThanEqual %bool %51 %53
%59 = OpSLessThanEqual %bool %54 %56
%60 = OpLogicalAnd %bool %57 %59
OpSelectionMerge %61 None
OpBranchConditional %60 %62 %63
%62 = OpLabel
OpBranch %61
%63 = OpLabel
OpBranch %48
%61 = OpLabel
%64 = OpLoad %int %i
%66 = OpAccessChain %_ptr_Private_int %data %64
%67 = OpLoad %int %66
%68 = OpLoad %int %j
%69 = OpAccessChain %_ptr_Private_int %data %68
%70 = OpLoad %int %69
%71 = OpSLessThan %bool %67 %70
OpSelectionMerge %72 None
OpBranchConditional %71 %73 %74
%73 = OpLabel
%75 = OpLoad %int %k
%76 = OpIAdd %int %75 %int_1
OpStore %k %76
%77 = OpLoad %int %i
%78 = OpIAdd %int %77 %int_1
OpStore %i %78
%79 = OpAccessChain %_ptr_Private_int %data %77
%80 = OpLoad %int %79
%81 = OpAccessChain %_ptr_Private_int %temp %75
OpStore %81 %80
OpBranch %72
%74 = OpLabel
%82 = OpLoad %int %k
%83 = OpIAdd %int %82 %int_1
OpStore %k %83
%84 = OpLoad %int %j
%85 = OpIAdd %int %84 %int_1
OpStore %j %85
%86 = OpAccessChain %_ptr_Private_int %data %84
%87 = OpLoad %int %86
%88 = OpAccessChain %_ptr_Private_int %temp %82
OpStore %88 %87
OpBranch %72
%72 = OpLabel
OpBranch %49
%49 = OpLabel
OpBranch %47
%48 = OpLabel
OpBranch %89
%89 = OpLabel
OpLoopMerge %90 %91 None
OpBranch %92
%92 = OpLabel
%93 = OpLoad %int %i
%94 = OpLoad %int %i
%96 = OpLoad %int %mid
%98 = OpSLessThan %bool %93 %int_10
%99 = OpSLessThanEqual %bool %94 %96
%100 = OpLogicalAnd %bool %98 %99
OpSelectionMerge %101 None
OpBranchConditional %100 %102 %103
%102 = OpLabel
OpBranch %101
%103 = OpLabel
OpBranch %90
%101 = OpLabel
%104 = OpLoad %int %k
%105 = OpIAdd %int %104 %int_1
OpStore %k %105
%106 = OpLoad %int %i
%107 = OpIAdd %int %106 %int_1
OpStore %i %107
%108 = OpAccessChain %_ptr_Private_int %data %106
%109 = OpLoad %int %108
%110 = OpAccessChain %_ptr_Private_int %temp %104
OpStore %110 %109
OpBranch %91
%91 = OpLabel
OpBranch %89
%90 = OpLabel
%112 = OpLoad %int %from
OpStore %i_1 %112
OpBranch %113
%113 = OpLabel
OpLoopMerge %114 %115 None
OpBranch %116
%116 = OpLabel
%117 = OpLoad %int %i_1
%119 = OpLoad %int %to
%120 = OpSLessThanEqual %bool %117 %119
OpSelectionMerge %121 None
OpBranchConditional %120 %122 %123
%122 = OpLabel
OpBranch %121
%123 = OpLabel
OpBranch %114
%121 = OpLabel
%124 = OpLoad %int %i_1
%125 = OpLoad %int %i_1
%126 = OpAccessChain %_ptr_Private_int %temp %125
%127 = OpLoad %int %126
%128 = OpAccessChain %_ptr_Private_int %data %124
OpStore %128 %127
OpBranch %115
%115 = OpLabel
%129 = OpLoad %int %i_1
%130 = OpIAdd %int %129 %int_1
OpStore %i_1 %130
OpBranch %113
%114 = OpLabel
OpReturn
OpFunctionEnd
%mergeSort_ = OpFunction %void None %131
%133 = OpLabel
%low = OpVariable %_ptr_Function_int Function %35
%high = OpVariable %_ptr_Function_int Function %35
%m = OpVariable %_ptr_Function_int Function %35
%i_2 = OpVariable %_ptr_Function_int Function %35
%from_1 = OpVariable %_ptr_Function_int Function %35
%mid_1 = OpVariable %_ptr_Function_int Function %35
%to_1 = OpVariable %_ptr_Function_int Function %35
%param = OpVariable %_ptr_Function_int Function %35
%param_1 = OpVariable %_ptr_Function_int Function %35
%param_2 = OpVariable %_ptr_Function_int Function %35
OpStore %low %int_0
OpStore %high %int_9
OpStore %m %int_1
OpBranch %146
%146 = OpLabel
OpLoopMerge %147 %148 None
OpBranch %149
%149 = OpLabel
%150 = OpLoad %int %m
%151 = OpLoad %int %high
%152 = OpSLessThanEqual %bool %150 %151
OpSelectionMerge %153 None
OpBranchConditional %152 %154 %155
%154 = OpLabel
OpBranch %153
%155 = OpLabel
OpBranch %147
%153 = OpLabel
%156 = OpLoad %int %low
OpStore %i_2 %156
OpBranch %157
%157 = OpLabel
OpLoopMerge %158 %159 None
OpBranch %160
%160 = OpLabel
%161 = OpLoad %int %i_2
%162 = OpLoad %int %high
%163 = OpSLessThan %bool %161 %162
OpSelectionMerge %164 None
OpBranchConditional %163 %165 %166
%165 = OpLabel
OpBranch %164
%166 = OpLabel
OpBranch %158
%164 = OpLabel
%167 = OpLoad %int %i_2
OpStore %from_1 %167
%168 = OpLoad %int %i_2
%169 = OpLoad %int %m
%170 = OpIAdd %int %168 %169
%171 = OpISub %int %170 %int_1
OpStore %mid_1 %171
%172 = OpLoad %int %i_2
%173 = OpLoad %int %m
%174 = OpLoad %int %high
%178 = OpIMul %int %int_2 %173
%179 = OpIAdd %int %172 %178
%180 = OpISub %int %179 %int_1
%175 = OpExtInst %int %176 SMin %180 %174
OpStore %to_1 %175
%181 = OpLoad %int %from_1
OpStore %param %181
%182 = OpLoad %int %mid_1
OpStore %param_1 %182
%183 = OpLoad %int %to_1
OpStore %param_2 %183
%184 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2
OpBranch %159
%159 = OpLabel
%188 = OpLoad %int %m
%189 = OpLoad %int %i_2
%190 = OpIMul %int %int_2 %188
%191 = OpIAdd %int %189 %190
OpStore %i_2 %191
OpBranch %157
%158 = OpLabel
OpBranch %148
%148 = OpLabel
%192 = OpLoad %int %m
%193 = OpIMul %int %int_2 %192
OpStore %m %193
OpBranch %146
%147 = OpLabel
OpReturn
OpFunctionEnd
%main_1 = OpFunction %void None %131
%195 = OpLabel
%i_3 = OpVariable %_ptr_Function_int Function %35
%j_1 = OpVariable %_ptr_Function_int Function %35
%grey = OpVariable %_ptr_Function_float Function %200
%203 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0
%204 = OpLoad %float %203
%205 = OpConvertFToS %int %204
OpStore %i_3 %205
OpBranch %206
%206 = OpLabel
OpLoopMerge %207 %208 None
OpBranch %209
%209 = OpLabel
%210 = OpLoad %int %i_3
OpSelectionMerge %211 None
OpSwitch %210 %212 9 %213 8 %214 7 %215 6 %216 5 %217 4 %218 3 %219 2 %220 1 %221 0 %222
%213 = OpLabel
%223 = OpLoad %int %i_3
%224 = OpAccessChain %_ptr_Private_int %data %223
OpStore %224 %int_n5
OpBranch %211
%214 = OpLabel
%226 = OpLoad %int %i_3
%227 = OpAccessChain %_ptr_Private_int %data %226
OpStore %227 %int_n4
OpBranch %211
%215 = OpLabel
%229 = OpLoad %int %i_3
%230 = OpAccessChain %_ptr_Private_int %data %229
OpStore %230 %int_n3
OpBranch %211
%216 = OpLabel
%232 = OpLoad %int %i_3
%233 = OpAccessChain %_ptr_Private_int %data %232
OpStore %233 %int_n2
OpBranch %211
%217 = OpLabel
%235 = OpLoad %int %i_3
%236 = OpAccessChain %_ptr_Private_int %data %235
OpStore %236 %int_n1
OpBranch %211
%218 = OpLabel
%238 = OpLoad %int %i_3
%239 = OpAccessChain %_ptr_Private_int %data %238
OpStore %239 %int_0
OpBranch %211
%219 = OpLabel
%240 = OpLoad %int %i_3
%241 = OpAccessChain %_ptr_Private_int %data %240
OpStore %241 %int_1
OpBranch %211
%220 = OpLabel
%242 = OpLoad %int %i_3
%243 = OpAccessChain %_ptr_Private_int %data %242
OpStore %243 %int_2
OpBranch %211
%221 = OpLabel
%244 = OpLoad %int %i_3
%245 = OpAccessChain %_ptr_Private_int %data %244
OpStore %245 %int_3
OpBranch %211
%222 = OpLabel
%247 = OpLoad %int %i_3
%248 = OpAccessChain %_ptr_Private_int %data %247
OpStore %248 %int_4
OpBranch %211
%212 = OpLabel
OpBranch %211
%211 = OpLabel
%250 = OpLoad %int %i_3
%251 = OpIAdd %int %250 %int_1
OpStore %i_3 %251
OpBranch %208
%208 = OpLabel
%252 = OpLoad %int %i_3
%253 = OpSLessThan %bool %252 %int_10
OpBranchConditional %253 %206 %207
%207 = OpLabel
OpStore %j_1 %int_0
OpBranch %254
%254 = OpLabel
OpLoopMerge %255 %256 None
OpBranch %257
%257 = OpLabel
%258 = OpLoad %int %j_1
%259 = OpSLessThan %bool %258 %int_10
OpSelectionMerge %260 None
OpBranchConditional %259 %261 %262
%261 = OpLabel
OpBranch %260
%262 = OpLabel
OpBranch %255
%260 = OpLabel
%263 = OpLoad %int %j_1
%264 = OpLoad %int %j_1
%265 = OpAccessChain %_ptr_Private_int %data %264
%266 = OpLoad %int %265
%267 = OpAccessChain %_ptr_Private_int %temp %263
OpStore %267 %266
OpBranch %256
%256 = OpLabel
%268 = OpLoad %int %j_1
%269 = OpIAdd %int %268 %int_1
OpStore %j_1 %269
OpBranch %254
%255 = OpLabel
%270 = OpFunctionCall %void %mergeSort_
%273 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%274 = OpLoad %float %273
%275 = OpConvertFToS %int %274
%277 = OpSLessThan %bool %275 %int_30
OpSelectionMerge %278 None
OpBranchConditional %277 %279 %280
%279 = OpLabel
%281 = OpAccessChain %_ptr_Private_int %data %int_0
%282 = OpLoad %int %281
%284 = OpConvertSToF %float %282
%286 = OpFDiv %float %284 %float_10
%287 = OpFAdd %float %float_0_5 %286
OpStore %grey %287
OpBranch %278
%280 = OpLabel
%288 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%289 = OpLoad %float %288
%290 = OpConvertFToS %int %289
%292 = OpSLessThan %bool %290 %int_60
OpSelectionMerge %293 None
OpBranchConditional %292 %294 %295
%294 = OpLabel
%296 = OpAccessChain %_ptr_Private_int %data %int_1
%297 = OpLoad %int %296
%298 = OpConvertSToF %float %297
%299 = OpFDiv %float %298 %float_10
%300 = OpFAdd %float %float_0_5 %299
OpStore %grey %300
OpBranch %293
%295 = OpLabel
%301 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%302 = OpLoad %float %301
%303 = OpConvertFToS %int %302
%305 = OpSLessThan %bool %303 %int_90
OpSelectionMerge %306 None
OpBranchConditional %305 %307 %308
%307 = OpLabel
%309 = OpAccessChain %_ptr_Private_int %data %int_2
%310 = OpLoad %int %309
%311 = OpConvertSToF %float %310
%312 = OpFDiv %float %311 %float_10
%313 = OpFAdd %float %float_0_5 %312
OpStore %grey %313
OpBranch %306
%308 = OpLabel
%314 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%315 = OpLoad %float %314
%316 = OpConvertFToS %int %315
%318 = OpSLessThan %bool %316 %int_120
OpSelectionMerge %319 None
OpBranchConditional %318 %320 %321
%320 = OpLabel
%322 = OpAccessChain %_ptr_Private_int %data %int_3
%323 = OpLoad %int %322
%324 = OpConvertSToF %float %323
%325 = OpFDiv %float %324 %float_10
%326 = OpFAdd %float %float_0_5 %325
OpStore %grey %326
OpBranch %319
%321 = OpLabel
%327 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%328 = OpLoad %float %327
%329 = OpConvertFToS %int %328
%331 = OpSLessThan %bool %329 %int_150
OpSelectionMerge %332 None
OpBranchConditional %331 %333 %334
%333 = OpLabel
OpKill
%334 = OpLabel
%335 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%336 = OpLoad %float %335
%337 = OpConvertFToS %int %336
%339 = OpSLessThan %bool %337 %int_180
OpSelectionMerge %340 None
OpBranchConditional %339 %341 %342
%341 = OpLabel
%344 = OpAccessChain %_ptr_Private_int %data %int_5
%345 = OpLoad %int %344
%346 = OpConvertSToF %float %345
%347 = OpFDiv %float %346 %float_10
%348 = OpFAdd %float %float_0_5 %347
OpStore %grey %348
OpBranch %340
%342 = OpLabel
%349 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%350 = OpLoad %float %349
%351 = OpConvertFToS %int %350
%353 = OpSLessThan %bool %351 %int_210
OpSelectionMerge %354 None
OpBranchConditional %353 %355 %356
%355 = OpLabel
%358 = OpAccessChain %_ptr_Private_int %data %int_6
%359 = OpLoad %int %358
%360 = OpConvertSToF %float %359
%361 = OpFDiv %float %360 %float_10
%362 = OpFAdd %float %float_0_5 %361
OpStore %grey %362
OpBranch %354
%356 = OpLabel
%363 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%364 = OpLoad %float %363
%365 = OpConvertFToS %int %364
%367 = OpSLessThan %bool %365 %int_240
OpSelectionMerge %368 None
OpBranchConditional %367 %369 %370
%369 = OpLabel
%372 = OpAccessChain %_ptr_Private_int %data %int_7
%373 = OpLoad %int %372
%374 = OpConvertSToF %float %373
%375 = OpFDiv %float %374 %float_10
%376 = OpFAdd %float %float_0_5 %375
OpStore %grey %376
OpBranch %368
%370 = OpLabel
%377 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%378 = OpLoad %float %377
%379 = OpConvertFToS %int %378
%381 = OpSLessThan %bool %379 %int_270
OpSelectionMerge %382 None
OpBranchConditional %381 %383 %384
%383 = OpLabel
%386 = OpAccessChain %_ptr_Private_int %data %int_8
%387 = OpLoad %int %386
%388 = OpConvertSToF %float %387
%389 = OpFDiv %float %388 %float_10
%390 = OpFAdd %float %float_0_5 %389
OpStore %grey %390
OpBranch %382
%384 = OpLabel
OpKill
%382 = OpLabel
OpBranch %368
%368 = OpLabel
OpBranch %354
%354 = OpLabel
OpBranch %340
%340 = OpLabel
OpBranch %332
%332 = OpLabel
OpBranch %319
%319 = OpLabel
OpBranch %306
%306 = OpLabel
OpBranch %293
%293 = OpLabel
OpBranch %278
%278 = OpLabel
%391 = OpLoad %float %grey
%393 = OpCompositeConstruct %v3float %391 %391 %391
%394 = OpCompositeExtract %float %393 0
%395 = OpCompositeExtract %float %393 1
%396 = OpCompositeExtract %float %393 2
%398 = OpCompositeConstruct %v4float %394 %395 %396 %float_1
OpStore %x_GLF_color %398
OpReturn
OpFunctionEnd
%main_inner = OpFunction %main_out None %399
%gl_FragCoord_param = OpFunctionParameter %v4float
%403 = OpLabel
OpStore %gl_FragCoord %gl_FragCoord_param
%404 = OpFunctionCall %void %main_1
%405 = OpLoad %v4float %x_GLF_color
%406 = OpCompositeConstruct %main_out %405
OpReturnValue %406
OpFunctionEnd
%main = OpFunction %void None %131
%408 = OpLabel
%410 = OpLoad %v4float %gl_FragCoord_param_1
%409 = OpFunctionCall %main_out %main_inner %410
%411 = OpCompositeExtract %v4float %409 0
OpStore %x_GLF_color_1_1 %411
OpReturn
OpFunctionEnd