blob: 2c81dd2367d1c22228bfd91a1610ff1594eb90f0 [file] [log] [blame]
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
; Bound: 115
; Schema: 0
OpCapability Shader
%104 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %foo "foo" %foo_loc0_Input %foo_loc1_Input %foo_loc0_Output
OpExecutionMode %foo OriginUpperLeft
OpName %t "t"
OpName %s "s"
OpMemberName %a_block 0 "inner"
OpName %a_block "a_block"
OpName %continue_execution "continue_execution"
OpName %foo_loc0_Input "foo_loc0_Input"
OpName %foo_loc1_Input "foo_loc1_Input"
OpName %foo_loc0_Output "foo_loc0_Output"
OpName %foo_inner "foo_inner"
OpName %in "in"
OpName %coord "coord"
OpName %result "result"
OpName %tint_loop_idx "tint_loop_idx"
OpName %i "i"
OpName %tint_low_inc "tint_low_inc"
OpName %tint_carry "tint_carry"
OpName %tint_f32_to_i32 "tint_f32_to_i32"
OpName %value "value"
OpName %foo "foo"
OpDecorate %t DescriptorSet 0
OpDecorate %t Binding 0
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 1
OpMemberDecorate %a_block 0 Offset 0
OpDecorate %a_block Block
OpDecorate %8 DescriptorSet 0
OpDecorate %8 Binding 2
OpDecorate %8 Coherent
OpDecorate %foo_loc0_Input Location 0
OpDecorate %foo_loc1_Input Location 1
OpDecorate %foo_loc0_Output Location 0
%float = OpTypeFloat 32
%3 = OpTypeImage %float 2D 0 0 0 1 Unknown
%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
%t = OpVariable %_ptr_UniformConstant_3 UniformConstant
%7 = OpTypeSampler
%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
%s = OpVariable %_ptr_UniformConstant_7 UniformConstant
%int = OpTypeInt 32 1
%a_block = OpTypeStruct %int
%_ptr_StorageBuffer_a_block = OpTypePointer StorageBuffer %a_block
%8 = OpVariable %_ptr_StorageBuffer_a_block StorageBuffer
%bool = OpTypeBool
%_ptr_Private_bool = OpTypePointer Private %bool
%true = OpConstantTrue %bool
%continue_execution = OpVariable %_ptr_Private_bool Private %true
%_ptr_Input_float = OpTypePointer Input %float
%foo_loc0_Input = OpVariable %_ptr_Input_float Input
%v2float = OpTypeVector %float 2
%_ptr_Input_v2float = OpTypePointer Input %v2float
%foo_loc1_Input = OpVariable %_ptr_Input_v2float Input
%_ptr_Output_int = OpTypePointer Output %int
%foo_loc0_Output = OpVariable %_ptr_Output_int Output
%26 = OpTypeFunction %int %float %v2float
%float_0 = OpConstant %float 0
%35 = OpTypeSampledImage %3
%v4float = OpTypeVector %float 4
%_ptr_Function_int = OpTypePointer Function %int
%false = OpConstantFalse %bool
%uint = OpTypeInt 32 0
%v2uint = OpTypeVector %uint 2
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
%uint_4294967295 = OpConstant %uint 4294967295
%58 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295
%int_0 = OpConstant %int 0
%64 = OpConstantNull %v2uint
%v2bool = OpTypeVector %bool 2
%int_10 = OpConstant %int 10
%_ptr_Function_uint = OpTypePointer Function %uint
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%98 = OpUndef %int
%int_1 = OpConstant %int 1
%101 = OpTypeFunction %int %float
%float_n2_14748365e_09 = OpConstant %float -2.14748365e+09
%float_2_14748352e_09 = OpConstant %float 2.14748352e+09
%void = OpTypeVoid
%110 = OpTypeFunction %void
%foo_inner = OpFunction %int None %26
%in = OpFunctionParameter %float
%coord = OpFunctionParameter %v2float
%27 = OpLabel
%result = OpVariable %_ptr_Function_int Function
%tint_loop_idx = OpVariable %_ptr_Function_v2uint Function
%i = OpVariable %_ptr_Function_int Function
%28 = OpFOrdEqual %bool %in %float_0
OpSelectionMerge %30 None
OpBranchConditional %28 %31 %30
%31 = OpLabel
OpStore %continue_execution %false None
OpBranch %30
%30 = OpLabel
%32 = OpLoad %3 %t None
%33 = OpLoad %7 %s None
%34 = OpSampledImage %35 %32 %33
%36 = OpImageSampleImplicitLod %v4float %34 %coord None
%38 = OpCompositeExtract %float %36 0
%39 = OpFunctionCall %int %tint_f32_to_i32 %38
OpStore %result %39
OpBranch %43
%43 = OpLabel
OpStore %tint_loop_idx %58
OpStore %i %int_0
OpBranch %46
%46 = OpLabel
OpLoopMerge %47 %45 None
OpBranch %44
%44 = OpLabel
%62 = OpLoad %v2uint %tint_loop_idx None
%63 = OpIEqual %v2bool %62 %64
%66 = OpAll %bool %63
OpSelectionMerge %67 None
OpBranchConditional %66 %68 %67
%68 = OpLabel
OpBranch %47
%67 = OpLabel
%69 = OpLoad %int %i None
%70 = OpSLessThan %bool %69 %int_10
OpSelectionMerge %72 None
OpBranchConditional %70 %72 %73
%73 = OpLabel
OpBranch %47
%72 = OpLabel
%74 = OpLoad %int %i None
%75 = OpLoad %int %result None
%76 = OpIAdd %int %75 %74
OpStore %result %76 None
OpBranch %45
%45 = OpLabel
%77 = OpAccessChain %_ptr_Function_uint %tint_loop_idx %uint_0
%80 = OpLoad %uint %77 None
%tint_low_inc = OpISub %uint %80 %uint_1
%83 = OpAccessChain %_ptr_Function_uint %tint_loop_idx %uint_0
OpStore %83 %tint_low_inc None
%84 = OpIEqual %bool %tint_low_inc %uint_4294967295
%tint_carry = OpSelect %uint %84 %uint_1 %uint_0
%86 = OpAccessChain %_ptr_Function_uint %tint_loop_idx %uint_1
%87 = OpLoad %uint %86 None
%88 = OpISub %uint %87 %tint_carry
%89 = OpAccessChain %_ptr_Function_uint %tint_loop_idx %uint_1
OpStore %89 %88 None
%90 = OpAccessChain %_ptr_StorageBuffer_int %8 %uint_0
%92 = OpLoad %bool %continue_execution None
OpSelectionMerge %93 None
OpBranchConditional %92 %94 %95
%94 = OpLabel
%97 = OpAtomicIAdd %int %90 %uint_1 %uint_0 %int_1
OpBranch %93
%95 = OpLabel
OpBranch %93
%93 = OpLabel
%96 = OpPhi %int %97 %94 %98 %95
OpStore %i %96 None
OpBranch %46
%47 = OpLabel
%48 = OpLoad %int %result None
%49 = OpLoad %bool %continue_execution None
%50 = OpLogicalNot %bool %49
OpSelectionMerge %51 None
OpBranchConditional %50 %52 %51
%52 = OpLabel
OpKill
%51 = OpLabel
OpReturnValue %48
OpFunctionEnd
%tint_f32_to_i32 = OpFunction %int None %101
%value = OpFunctionParameter %float
%102 = OpLabel
%103 = OpExtInst %float %104 NClamp %value %float_n2_14748365e_09 %float_2_14748352e_09
%107 = OpConvertFToS %int %103
OpReturnValue %107
OpFunctionEnd
%foo = OpFunction %void None %110
%111 = OpLabel
%112 = OpLoad %float %foo_loc0_Input None
%113 = OpLoad %v2float %foo_loc1_Input None
%114 = OpFunctionCall %int %foo_inner %112 %113
OpStore %foo_loc0_Output %114 None
OpReturn
OpFunctionEnd