blob: 25a6bc25c3dd34a6d54b7c7d4e05af5e8ad72a2a [file] [log] [blame]
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 413
; Schema: 0
OpCapability Shader
%177 = 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 %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
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
%void = OpTypeVoid
%_ptr_Function_int = OpTypePointer Function %int
%23 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int %_ptr_Function_int
%32 = OpConstantNull %int
%int_1 = OpConstant %int 1
%bool = OpTypeBool
%_ptr_Private_int = OpTypePointer Private %int
%int_10 = OpConstant %int 10
%132 = OpTypeFunction %void
%int_0 = OpConstant %int 0
%int_9 = OpConstant %int 9
%int_2 = OpConstant %int 2
%_ptr_Function_float = OpTypePointer Function %float
%201 = 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
%400 = OpTypeFunction %main_out %v4float
%merge_i1_i1_i1_ = OpFunction %void None %23
%from = OpFunctionParameter %_ptr_Function_int
%mid = OpFunctionParameter %_ptr_Function_int
%to = OpFunctionParameter %_ptr_Function_int
%30 = OpLabel
%k = OpVariable %_ptr_Function_int Function %32
%i = OpVariable %_ptr_Function_int Function %32
%j = OpVariable %_ptr_Function_int Function %32
%i_1 = OpVariable %_ptr_Function_int Function %32
%37 = OpLoad %int %from
OpStore %k %37
%39 = OpLoad %int %from
OpStore %i %39
%41 = OpLoad %int %mid
%43 = OpIAdd %int %41 %int_1
OpStore %j %43
OpBranch %44
%44 = OpLabel
OpLoopMerge %45 %46 None
OpBranch %47
%47 = OpLabel
%48 = OpLoad %int %i
%50 = OpLoad %int %mid
%51 = OpLoad %int %j
%53 = OpLoad %int %to
%54 = OpSLessThanEqual %bool %48 %50
OpSelectionMerge %56 None
OpBranchConditional %54 %57 %56
%57 = OpLabel
%58 = OpSLessThanEqual %bool %51 %53
OpBranch %56
%56 = OpLabel
%59 = OpPhi %bool %54 %47 %58 %57
OpSelectionMerge %60 None
OpBranchConditional %59 %61 %62
%61 = OpLabel
OpBranch %60
%62 = OpLabel
OpBranch %45
%60 = OpLabel
%63 = OpLoad %int %i
%65 = OpAccessChain %_ptr_Private_int %data %63
%66 = OpLoad %int %65
%67 = OpLoad %int %j
%68 = OpAccessChain %_ptr_Private_int %data %67
%69 = OpLoad %int %68
%70 = OpSLessThan %bool %66 %69
OpSelectionMerge %71 None
OpBranchConditional %70 %72 %73
%72 = OpLabel
%74 = OpLoad %int %k
%75 = OpIAdd %int %74 %int_1
OpStore %k %75
%76 = OpLoad %int %i
%77 = OpIAdd %int %76 %int_1
OpStore %i %77
%78 = OpAccessChain %_ptr_Private_int %data %76
%79 = OpLoad %int %78
%80 = OpAccessChain %_ptr_Private_int %temp %74
OpStore %80 %79
OpBranch %71
%73 = OpLabel
%81 = OpLoad %int %k
%82 = OpIAdd %int %81 %int_1
OpStore %k %82
%83 = OpLoad %int %j
%84 = OpIAdd %int %83 %int_1
OpStore %j %84
%85 = OpAccessChain %_ptr_Private_int %data %83
%86 = OpLoad %int %85
%87 = OpAccessChain %_ptr_Private_int %temp %81
OpStore %87 %86
OpBranch %71
%71 = OpLabel
OpBranch %46
%46 = OpLabel
OpBranch %44
%45 = OpLabel
OpBranch %88
%88 = OpLabel
OpLoopMerge %89 %90 None
OpBranch %91
%91 = OpLabel
%92 = OpLoad %int %i
%93 = OpLoad %int %i
%95 = OpLoad %int %mid
%97 = OpSLessThan %bool %92 %int_10
OpSelectionMerge %98 None
OpBranchConditional %97 %99 %98
%99 = OpLabel
%100 = OpSLessThanEqual %bool %93 %95
OpBranch %98
%98 = OpLabel
%101 = OpPhi %bool %97 %91 %100 %99
OpSelectionMerge %102 None
OpBranchConditional %101 %103 %104
%103 = OpLabel
OpBranch %102
%104 = OpLabel
OpBranch %89
%102 = OpLabel
%105 = OpLoad %int %k
%106 = OpIAdd %int %105 %int_1
OpStore %k %106
%107 = OpLoad %int %i
%108 = OpIAdd %int %107 %int_1
OpStore %i %108
%109 = OpAccessChain %_ptr_Private_int %data %107
%110 = OpLoad %int %109
%111 = OpAccessChain %_ptr_Private_int %temp %105
OpStore %111 %110
OpBranch %90
%90 = OpLabel
OpBranch %88
%89 = OpLabel
%113 = OpLoad %int %from
OpStore %i_1 %113
OpBranch %114
%114 = OpLabel
OpLoopMerge %115 %116 None
OpBranch %117
%117 = OpLabel
%118 = OpLoad %int %i_1
%120 = OpLoad %int %to
%121 = OpSLessThanEqual %bool %118 %120
OpSelectionMerge %122 None
OpBranchConditional %121 %123 %124
%123 = OpLabel
OpBranch %122
%124 = OpLabel
OpBranch %115
%122 = OpLabel
%125 = OpLoad %int %i_1
%126 = OpLoad %int %i_1
%127 = OpAccessChain %_ptr_Private_int %temp %126
%128 = OpLoad %int %127
%129 = OpAccessChain %_ptr_Private_int %data %125
OpStore %129 %128
OpBranch %116
%116 = OpLabel
%130 = OpLoad %int %i_1
%131 = OpIAdd %int %130 %int_1
OpStore %i_1 %131
OpBranch %114
%115 = OpLabel
OpReturn
OpFunctionEnd
%mergeSort_ = OpFunction %void None %132
%134 = OpLabel
%low = OpVariable %_ptr_Function_int Function %32
%high = OpVariable %_ptr_Function_int Function %32
%m = OpVariable %_ptr_Function_int Function %32
%i_2 = OpVariable %_ptr_Function_int Function %32
%from_1 = OpVariable %_ptr_Function_int Function %32
%mid_1 = OpVariable %_ptr_Function_int Function %32
%to_1 = OpVariable %_ptr_Function_int Function %32
%param = OpVariable %_ptr_Function_int Function %32
%param_1 = OpVariable %_ptr_Function_int Function %32
%param_2 = OpVariable %_ptr_Function_int Function %32
OpStore %low %int_0
OpStore %high %int_9
OpStore %m %int_1
OpBranch %147
%147 = OpLabel
OpLoopMerge %148 %149 None
OpBranch %150
%150 = OpLabel
%151 = OpLoad %int %m
%152 = OpLoad %int %high
%153 = OpSLessThanEqual %bool %151 %152
OpSelectionMerge %154 None
OpBranchConditional %153 %155 %156
%155 = OpLabel
OpBranch %154
%156 = OpLabel
OpBranch %148
%154 = OpLabel
%157 = OpLoad %int %low
OpStore %i_2 %157
OpBranch %158
%158 = OpLabel
OpLoopMerge %159 %160 None
OpBranch %161
%161 = OpLabel
%162 = OpLoad %int %i_2
%163 = OpLoad %int %high
%164 = OpSLessThan %bool %162 %163
OpSelectionMerge %165 None
OpBranchConditional %164 %166 %167
%166 = OpLabel
OpBranch %165
%167 = OpLabel
OpBranch %159
%165 = OpLabel
%168 = OpLoad %int %i_2
OpStore %from_1 %168
%169 = OpLoad %int %i_2
%170 = OpLoad %int %m
%171 = OpIAdd %int %169 %170
%172 = OpISub %int %171 %int_1
OpStore %mid_1 %172
%173 = OpLoad %int %i_2
%174 = OpLoad %int %m
%175 = OpLoad %int %high
%179 = OpIMul %int %int_2 %174
%180 = OpIAdd %int %173 %179
%181 = OpISub %int %180 %int_1
%176 = OpExtInst %int %177 SMin %181 %175
OpStore %to_1 %176
%182 = OpLoad %int %from_1
OpStore %param %182
%183 = OpLoad %int %mid_1
OpStore %param_1 %183
%184 = OpLoad %int %to_1
OpStore %param_2 %184
%185 = OpFunctionCall %void %merge_i1_i1_i1_ %param %param_1 %param_2
OpBranch %160
%160 = OpLabel
%189 = OpLoad %int %m
%190 = OpLoad %int %i_2
%191 = OpIMul %int %int_2 %189
%192 = OpIAdd %int %190 %191
OpStore %i_2 %192
OpBranch %158
%159 = OpLabel
OpBranch %149
%149 = OpLabel
%193 = OpLoad %int %m
%194 = OpIMul %int %int_2 %193
OpStore %m %194
OpBranch %147
%148 = OpLabel
OpReturn
OpFunctionEnd
%main_1 = OpFunction %void None %132
%196 = OpLabel
%i_3 = OpVariable %_ptr_Function_int Function %32
%j_1 = OpVariable %_ptr_Function_int Function %32
%grey = OpVariable %_ptr_Function_float Function %201
%204 = OpAccessChain %_ptr_Uniform_float %x_28 %uint_0 %uint_0
%205 = OpLoad %float %204
%206 = OpConvertFToS %int %205
OpStore %i_3 %206
OpBranch %207
%207 = OpLabel
OpLoopMerge %208 %209 None
OpBranch %210
%210 = OpLabel
%211 = OpLoad %int %i_3
OpSelectionMerge %212 None
OpSwitch %211 %213 9 %214 8 %215 7 %216 6 %217 5 %218 4 %219 3 %220 2 %221 1 %222 0 %223
%214 = OpLabel
%224 = OpLoad %int %i_3
%225 = OpAccessChain %_ptr_Private_int %data %224
OpStore %225 %int_n5
OpBranch %212
%215 = OpLabel
%227 = OpLoad %int %i_3
%228 = OpAccessChain %_ptr_Private_int %data %227
OpStore %228 %int_n4
OpBranch %212
%216 = OpLabel
%230 = OpLoad %int %i_3
%231 = OpAccessChain %_ptr_Private_int %data %230
OpStore %231 %int_n3
OpBranch %212
%217 = OpLabel
%233 = OpLoad %int %i_3
%234 = OpAccessChain %_ptr_Private_int %data %233
OpStore %234 %int_n2
OpBranch %212
%218 = OpLabel
%236 = OpLoad %int %i_3
%237 = OpAccessChain %_ptr_Private_int %data %236
OpStore %237 %int_n1
OpBranch %212
%219 = OpLabel
%239 = OpLoad %int %i_3
%240 = OpAccessChain %_ptr_Private_int %data %239
OpStore %240 %int_0
OpBranch %212
%220 = OpLabel
%241 = OpLoad %int %i_3
%242 = OpAccessChain %_ptr_Private_int %data %241
OpStore %242 %int_1
OpBranch %212
%221 = OpLabel
%243 = OpLoad %int %i_3
%244 = OpAccessChain %_ptr_Private_int %data %243
OpStore %244 %int_2
OpBranch %212
%222 = OpLabel
%245 = OpLoad %int %i_3
%246 = OpAccessChain %_ptr_Private_int %data %245
OpStore %246 %int_3
OpBranch %212
%223 = OpLabel
%248 = OpLoad %int %i_3
%249 = OpAccessChain %_ptr_Private_int %data %248
OpStore %249 %int_4
OpBranch %212
%213 = OpLabel
OpBranch %212
%212 = OpLabel
%251 = OpLoad %int %i_3
%252 = OpIAdd %int %251 %int_1
OpStore %i_3 %252
OpBranch %209
%209 = OpLabel
%253 = OpLoad %int %i_3
%254 = OpSLessThan %bool %253 %int_10
OpBranchConditional %254 %207 %208
%208 = OpLabel
OpStore %j_1 %int_0
OpBranch %255
%255 = OpLabel
OpLoopMerge %256 %257 None
OpBranch %258
%258 = OpLabel
%259 = OpLoad %int %j_1
%260 = OpSLessThan %bool %259 %int_10
OpSelectionMerge %261 None
OpBranchConditional %260 %262 %263
%262 = OpLabel
OpBranch %261
%263 = OpLabel
OpBranch %256
%261 = OpLabel
%264 = OpLoad %int %j_1
%265 = OpLoad %int %j_1
%266 = OpAccessChain %_ptr_Private_int %data %265
%267 = OpLoad %int %266
%268 = OpAccessChain %_ptr_Private_int %temp %264
OpStore %268 %267
OpBranch %257
%257 = OpLabel
%269 = OpLoad %int %j_1
%270 = OpIAdd %int %269 %int_1
OpStore %j_1 %270
OpBranch %255
%256 = OpLabel
%271 = OpFunctionCall %void %mergeSort_
%274 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%275 = OpLoad %float %274
%276 = OpConvertFToS %int %275
%278 = OpSLessThan %bool %276 %int_30
OpSelectionMerge %279 None
OpBranchConditional %278 %280 %281
%280 = OpLabel
%282 = OpAccessChain %_ptr_Private_int %data %int_0
%283 = OpLoad %int %282
%285 = OpConvertSToF %float %283
%287 = OpFDiv %float %285 %float_10
%288 = OpFAdd %float %float_0_5 %287
OpStore %grey %288
OpBranch %279
%281 = OpLabel
%289 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%290 = OpLoad %float %289
%291 = OpConvertFToS %int %290
%293 = OpSLessThan %bool %291 %int_60
OpSelectionMerge %294 None
OpBranchConditional %293 %295 %296
%295 = OpLabel
%297 = OpAccessChain %_ptr_Private_int %data %int_1
%298 = OpLoad %int %297
%299 = OpConvertSToF %float %298
%300 = OpFDiv %float %299 %float_10
%301 = OpFAdd %float %float_0_5 %300
OpStore %grey %301
OpBranch %294
%296 = OpLabel
%302 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%303 = OpLoad %float %302
%304 = OpConvertFToS %int %303
%306 = OpSLessThan %bool %304 %int_90
OpSelectionMerge %307 None
OpBranchConditional %306 %308 %309
%308 = OpLabel
%310 = OpAccessChain %_ptr_Private_int %data %int_2
%311 = OpLoad %int %310
%312 = OpConvertSToF %float %311
%313 = OpFDiv %float %312 %float_10
%314 = OpFAdd %float %float_0_5 %313
OpStore %grey %314
OpBranch %307
%309 = OpLabel
%315 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%316 = OpLoad %float %315
%317 = OpConvertFToS %int %316
%319 = OpSLessThan %bool %317 %int_120
OpSelectionMerge %320 None
OpBranchConditional %319 %321 %322
%321 = OpLabel
%323 = OpAccessChain %_ptr_Private_int %data %int_3
%324 = OpLoad %int %323
%325 = OpConvertSToF %float %324
%326 = OpFDiv %float %325 %float_10
%327 = OpFAdd %float %float_0_5 %326
OpStore %grey %327
OpBranch %320
%322 = OpLabel
%328 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%329 = OpLoad %float %328
%330 = OpConvertFToS %int %329
%332 = OpSLessThan %bool %330 %int_150
OpSelectionMerge %333 None
OpBranchConditional %332 %334 %335
%334 = OpLabel
OpKill
%335 = OpLabel
%336 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%337 = OpLoad %float %336
%338 = OpConvertFToS %int %337
%340 = OpSLessThan %bool %338 %int_180
OpSelectionMerge %341 None
OpBranchConditional %340 %342 %343
%342 = OpLabel
%345 = OpAccessChain %_ptr_Private_int %data %int_5
%346 = OpLoad %int %345
%347 = OpConvertSToF %float %346
%348 = OpFDiv %float %347 %float_10
%349 = OpFAdd %float %float_0_5 %348
OpStore %grey %349
OpBranch %341
%343 = OpLabel
%350 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%351 = OpLoad %float %350
%352 = OpConvertFToS %int %351
%354 = OpSLessThan %bool %352 %int_210
OpSelectionMerge %355 None
OpBranchConditional %354 %356 %357
%356 = OpLabel
%359 = OpAccessChain %_ptr_Private_int %data %int_6
%360 = OpLoad %int %359
%361 = OpConvertSToF %float %360
%362 = OpFDiv %float %361 %float_10
%363 = OpFAdd %float %float_0_5 %362
OpStore %grey %363
OpBranch %355
%357 = OpLabel
%364 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%365 = OpLoad %float %364
%366 = OpConvertFToS %int %365
%368 = OpSLessThan %bool %366 %int_240
OpSelectionMerge %369 None
OpBranchConditional %368 %370 %371
%370 = OpLabel
%373 = OpAccessChain %_ptr_Private_int %data %int_7
%374 = OpLoad %int %373
%375 = OpConvertSToF %float %374
%376 = OpFDiv %float %375 %float_10
%377 = OpFAdd %float %float_0_5 %376
OpStore %grey %377
OpBranch %369
%371 = OpLabel
%378 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%379 = OpLoad %float %378
%380 = OpConvertFToS %int %379
%382 = OpSLessThan %bool %380 %int_270
OpSelectionMerge %383 None
OpBranchConditional %382 %384 %385
%384 = OpLabel
%387 = OpAccessChain %_ptr_Private_int %data %int_8
%388 = OpLoad %int %387
%389 = OpConvertSToF %float %388
%390 = OpFDiv %float %389 %float_10
%391 = OpFAdd %float %float_0_5 %390
OpStore %grey %391
OpBranch %383
%385 = OpLabel
OpKill
%383 = OpLabel
OpBranch %369
%369 = OpLabel
OpBranch %355
%355 = OpLabel
OpBranch %341
%341 = OpLabel
OpBranch %333
%333 = OpLabel
OpBranch %320
%320 = OpLabel
OpBranch %307
%307 = OpLabel
OpBranch %294
%294 = OpLabel
OpBranch %279
%279 = OpLabel
%392 = OpLoad %float %grey
%394 = OpCompositeConstruct %v3float %392 %392 %392
%395 = OpCompositeExtract %float %394 0
%396 = OpCompositeExtract %float %394 1
%397 = OpCompositeExtract %float %394 2
%399 = OpCompositeConstruct %v4float %395 %396 %397 %float_1
OpStore %x_GLF_color %399
OpReturn
OpFunctionEnd
%main_inner = OpFunction %main_out None %400
%gl_FragCoord_param = OpFunctionParameter %v4float
%404 = OpLabel
OpStore %gl_FragCoord %gl_FragCoord_param
%405 = OpFunctionCall %void %main_1
%406 = OpLoad %v4float %x_GLF_color
%407 = OpCompositeConstruct %main_out %406
OpReturnValue %407
OpFunctionEnd
%main = OpFunction %void None %132
%409 = OpLabel
%411 = OpLoad %v4float %gl_FragCoord_param_1
%410 = OpFunctionCall %main_out %main_inner %411
%412 = OpCompositeExtract %v4float %410 0
OpStore %x_GLF_color_1_1 %412
OpReturn
OpFunctionEnd