| ; SPIR-V |
| ; Version: 1.3 |
| ; Generator: Google Tint Compiler; 0 |
| ; Bound: 243 |
| ; Schema: 0 |
| OpCapability Shader |
| %167 = OpExtInstImport "GLSL.std.450" |
| OpMemoryModel Logical GLSL450 |
| OpEntryPoint GLCompute %main "main" %x_3_param_1 %local_invocation_index_1 |
| OpExecutionMode %main LocalSize 32 1 1 |
| OpName %x_3_param_1 "x_3_param_1" |
| OpName %local_invocation_index_1 "local_invocation_index_1" |
| OpName %S "S" |
| OpMemberName %S 0 "field0" |
| OpMemberName %S 1 "field1" |
| OpName %x_28 "x_28" |
| OpName %x_34 "x_34" |
| OpName %x_35 "x_35" |
| OpName %x_36 "x_36" |
| OpName %x_37 "x_37" |
| OpName %x_3 "x_3" |
| OpName %x_6_block "x_6_block" |
| OpMemberName %x_6_block 0 "inner" |
| OpName %S_2 "S_2" |
| OpMemberName %S_2 0 "field0" |
| OpName %S_1 "S_1" |
| OpMemberName %S_1 0 "field0" |
| OpName %x_6 "x_6" |
| OpName %S_3 "S_3" |
| OpMemberName %S_3 0 "field0" |
| OpName %x_9 "x_9" |
| OpName %S_4 "S_4" |
| OpMemberName %S_4 0 "field0" |
| OpName %x_12 "x_12" |
| OpName %tint_zero_workgroup_memory "tint_zero_workgroup_memory" |
| OpName %local_idx "local_idx" |
| OpName %idx "idx" |
| OpName %main_1 "main_1" |
| OpName %x_54 "x_54" |
| OpName %x_58 "x_58" |
| OpName %x_85 "x_85" |
| OpName %x_88 "x_88" |
| OpName %x_55 "x_55" |
| OpName %x_111 "x_111" |
| OpName %x_86 "x_86" |
| OpName %x_89 "x_89" |
| OpName %x_103_1 "x_103_1" |
| OpName %x_105_1 "x_105_1" |
| OpName %x_109_1 "x_109_1" |
| OpName %main_inner "main_inner" |
| OpName %x_3_param "x_3_param" |
| OpName %local_invocation_index "local_invocation_index" |
| OpName %main "main" |
| OpDecorate %x_3_param_1 BuiltIn LocalInvocationId |
| OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex |
| OpMemberDecorate %S 0 Offset 0 |
| OpMemberDecorate %S 1 Offset 8 |
| OpDecorate %_arr_S_uint_4096 ArrayStride 16 |
| OpDecorate %x_6_block Block |
| OpMemberDecorate %x_6_block 0 Offset 0 |
| OpMemberDecorate %S_2 0 Offset 0 |
| OpMemberDecorate %S_1 0 Offset 0 |
| OpDecorate %x_6 NonWritable |
| OpDecorate %x_6 DescriptorSet 0 |
| OpDecorate %x_6 Binding 1 |
| OpDecorate %S_3 Block |
| OpMemberDecorate %S_3 0 Offset 0 |
| OpDecorate %_runtimearr_v4float ArrayStride 16 |
| OpDecorate %x_9 NonWritable |
| OpDecorate %x_9 DescriptorSet 0 |
| OpDecorate %x_9 Binding 2 |
| OpDecorate %S_4 Block |
| OpMemberDecorate %S_4 0 Offset 0 |
| OpDecorate %x_12 DescriptorSet 0 |
| OpDecorate %x_12 Binding 3 |
| %uint = OpTypeInt 32 0 |
| %v3uint = OpTypeVector %uint 3 |
| %_ptr_Input_v3uint = OpTypePointer Input %v3uint |
| %x_3_param_1 = OpVariable %_ptr_Input_v3uint Input |
| %_ptr_Input_uint = OpTypePointer Input %uint |
| %local_invocation_index_1 = OpVariable %_ptr_Input_uint Input |
| %float = OpTypeFloat 32 |
| %v2float = OpTypeVector %float 2 |
| %S = OpTypeStruct %v2float %uint |
| %uint_4096 = OpConstant %uint 4096 |
| %_arr_S_uint_4096 = OpTypeArray %S %uint_4096 |
| %_ptr_Workgroup__arr_S_uint_4096 = OpTypePointer Workgroup %_arr_S_uint_4096 |
| %x_28 = OpVariable %_ptr_Workgroup__arr_S_uint_4096 Workgroup |
| %_ptr_Workgroup_uint = OpTypePointer Workgroup %uint |
| %x_34 = OpVariable %_ptr_Workgroup_uint Workgroup |
| %x_35 = OpVariable %_ptr_Workgroup_uint Workgroup |
| %x_36 = OpVariable %_ptr_Workgroup_uint Workgroup |
| %x_37 = OpVariable %_ptr_Workgroup_uint Workgroup |
| %_ptr_Private_v3uint = OpTypePointer Private %v3uint |
| %21 = OpConstantNull %v3uint |
| %x_3 = OpVariable %_ptr_Private_v3uint Private %21 |
| %S_1 = OpTypeStruct %uint |
| %S_2 = OpTypeStruct %S_1 |
| %x_6_block = OpTypeStruct %S_2 |
| %_ptr_Uniform_x_6_block = OpTypePointer Uniform %x_6_block |
| %x_6 = OpVariable %_ptr_Uniform_x_6_block Uniform |
| %v4float = OpTypeVector %float 4 |
| %_runtimearr_v4float = OpTypeRuntimeArray %v4float |
| %S_3 = OpTypeStruct %_runtimearr_v4float |
| %_ptr_StorageBuffer_S_3 = OpTypePointer StorageBuffer %S_3 |
| %x_9 = OpVariable %_ptr_StorageBuffer_S_3 StorageBuffer |
| %S_4 = OpTypeStruct %_runtimearr_v4float |
| %_ptr_StorageBuffer_S_4 = OpTypePointer StorageBuffer %S_4 |
| %x_12 = OpVariable %_ptr_StorageBuffer_S_4 StorageBuffer |
| %void = OpTypeVoid |
| %35 = OpTypeFunction %void %uint |
| %uint_1 = OpConstant %uint 1 |
| %bool = OpTypeBool |
| %uint_2 = OpConstant %uint 2 |
| %uint_0 = OpConstant %uint 0 |
| %49 = OpConstantNull %uint |
| %_ptr_Function_uint = OpTypePointer Function %uint |
| %_ptr_Workgroup_S = OpTypePointer Workgroup %S |
| %70 = OpConstantNull %S |
| %uint_32 = OpConstant %uint 32 |
| %uint_264 = OpConstant %uint 264 |
| %76 = OpTypeFunction %void |
| %_ptr_Function_v4float = OpTypePointer Function %v4float |
| %83 = OpConstantNull %v4float |
| %_ptr_Private_uint = OpTypePointer Private %uint |
| %_ptr_Uniform_uint = OpTypePointer Uniform %uint |
| %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float |
| %float_0_5 = OpConstant %float 0.5 |
| %int = OpTypeInt 32 1 |
| %125 = OpConstantNull %int |
| %_ptr_Workgroup_v2float = OpTypePointer Workgroup %v2float |
| %v2uint = OpTypeVector %uint 2 |
| %_ptr_Function_float = OpTypePointer Function %float |
| %uint_3 = OpConstant %uint 3 |
| %231 = OpTypeFunction %void %v3uint %uint |
| %tint_zero_workgroup_memory = OpFunction %void None %35 |
| %local_idx = OpFunctionParameter %uint |
| %39 = OpLabel |
| %idx = OpVariable %_ptr_Function_uint Function %49 |
| %41 = OpULessThan %bool %local_idx %uint_1 |
| OpSelectionMerge %43 None |
| OpBranchConditional %41 %44 %43 |
| %44 = OpLabel |
| OpAtomicStore %x_34 %uint_2 %uint_0 %49 |
| OpAtomicStore %x_35 %uint_2 %uint_0 %49 |
| OpAtomicStore %x_36 %uint_2 %uint_0 %49 |
| OpAtomicStore %x_37 %uint_2 %uint_0 %49 |
| OpBranch %43 |
| %43 = OpLabel |
| OpStore %idx %local_idx |
| OpBranch %58 |
| %58 = OpLabel |
| OpLoopMerge %59 %60 None |
| OpBranch %61 |
| %61 = OpLabel |
| %63 = OpLoad %uint %idx |
| %64 = OpULessThan %bool %63 %uint_4096 |
| %62 = OpLogicalNot %bool %64 |
| OpSelectionMerge %65 None |
| OpBranchConditional %62 %66 %65 |
| %66 = OpLabel |
| OpBranch %59 |
| %65 = OpLabel |
| %67 = OpLoad %uint %idx |
| %69 = OpAccessChain %_ptr_Workgroup_S %x_28 %67 |
| OpStore %69 %70 |
| OpBranch %60 |
| %60 = OpLabel |
| %71 = OpLoad %uint %idx |
| %73 = OpIAdd %uint %71 %uint_32 |
| OpStore %idx %73 |
| OpBranch %58 |
| %59 = OpLabel |
| OpControlBarrier %uint_2 %uint_2 %uint_264 |
| OpReturn |
| OpFunctionEnd |
| %main_1 = OpFunction %void None %76 |
| %78 = OpLabel |
| %x_54 = OpVariable %_ptr_Function_uint Function %49 |
| %x_58 = OpVariable %_ptr_Function_uint Function %49 |
| %x_85 = OpVariable %_ptr_Function_v4float Function %83 |
| %x_88 = OpVariable %_ptr_Function_uint Function %49 |
| %x_55 = OpVariable %_ptr_Function_uint Function %49 |
| %x_111 = OpVariable %_ptr_Function_v4float Function %83 |
| %x_86 = OpVariable %_ptr_Function_v4float Function %83 |
| %x_89 = OpVariable %_ptr_Function_uint Function %49 |
| %x_103_1 = OpVariable %_ptr_Function_v4float Function %83 |
| %x_105_1 = OpVariable %_ptr_Function_v4float Function %83 |
| %x_109_1 = OpVariable %_ptr_Function_v4float Function %83 |
| %86 = OpAccessChain %_ptr_Private_uint %x_3 %uint_0 |
| %87 = OpLoad %uint %86 |
| OpStore %x_54 %49 |
| OpBranch %88 |
| %88 = OpLabel |
| OpLoopMerge %89 %90 None |
| OpBranch %91 |
| %91 = OpLabel |
| %94 = OpAccessChain %_ptr_Uniform_uint %x_6 %uint_0 %uint_0 %uint_0 |
| %95 = OpLoad %uint %94 |
| OpStore %x_58 %95 |
| %96 = OpLoad %uint %x_54 |
| %97 = OpLoad %uint %x_58 |
| %98 = OpULessThan %bool %96 %97 |
| OpSelectionMerge %99 None |
| OpBranchConditional %98 %100 %101 |
| %100 = OpLabel |
| OpBranch %99 |
| %101 = OpLabel |
| OpBranch %89 |
| %99 = OpLabel |
| %102 = OpLoad %uint %x_54 |
| %103 = OpIAdd %uint %102 %87 |
| %104 = OpLoad %uint %x_58 |
| %105 = OpUGreaterThanEqual %bool %103 %104 |
| OpSelectionMerge %106 None |
| OpBranchConditional %105 %107 %106 |
| %107 = OpLabel |
| %109 = OpAccessChain %_ptr_StorageBuffer_v4float %x_9 %uint_0 %103 |
| %110 = OpLoad %v4float %109 |
| %111 = OpAccessChain %_ptr_Workgroup_S %x_28 %103 |
| %112 = OpVectorShuffle %v2float %110 %110 0 1 |
| %113 = OpVectorShuffle %v2float %110 %110 2 3 |
| %114 = OpFAdd %v2float %112 %113 |
| %116 = OpVectorTimesScalar %v2float %114 %float_0_5 |
| %117 = OpCompositeConstruct %S %116 %103 |
| OpStore %111 %117 |
| OpBranch %106 |
| %106 = OpLabel |
| OpBranch %90 |
| %90 = OpLabel |
| %118 = OpLoad %uint %x_54 |
| %119 = OpIAdd %uint %118 %uint_32 |
| OpStore %x_55 %119 |
| %120 = OpLoad %uint %x_55 |
| OpStore %x_54 %120 |
| OpBranch %88 |
| %89 = OpLabel |
| OpControlBarrier %uint_2 %uint_2 %uint_264 |
| %124 = OpLoad %uint %x_58 |
| %122 = OpBitcast %int %124 |
| %127 = OpAccessChain %_ptr_Workgroup_v2float %x_28 %125 %uint_0 |
| %128 = OpLoad %v2float %127 |
| %129 = OpIEqual %bool %87 %49 |
| OpSelectionMerge %130 None |
| OpBranchConditional %129 %131 %130 |
| %131 = OpLabel |
| %132 = OpBitcast %v2uint %128 |
| %134 = OpCompositeExtract %uint %132 0 |
| OpAtomicStore %x_34 %uint_2 %uint_0 %134 |
| %137 = OpCompositeExtract %uint %132 1 |
| OpAtomicStore %x_35 %uint_2 %uint_0 %137 |
| OpAtomicStore %x_36 %uint_2 %uint_0 %134 |
| OpAtomicStore %x_37 %uint_2 %uint_0 %137 |
| OpBranch %130 |
| %130 = OpLabel |
| %144 = OpVectorShuffle %v4float %128 %128 0 1 0 1 |
| OpStore %x_85 %144 |
| OpStore %x_88 %uint_1 |
| OpBranch %145 |
| %145 = OpLabel |
| OpLoopMerge %146 %147 None |
| OpBranch %148 |
| %148 = OpLabel |
| %152 = OpBitcast %uint %122 |
| %153 = OpLoad %uint %x_88 |
| %154 = OpULessThan %bool %153 %152 |
| OpSelectionMerge %155 None |
| OpBranchConditional %154 %156 %157 |
| %156 = OpLabel |
| OpBranch %155 |
| %157 = OpLabel |
| OpBranch %146 |
| %155 = OpLabel |
| %158 = OpLoad %uint %x_88 |
| %159 = OpIAdd %uint %158 %87 |
| %160 = OpLoad %v4float %x_85 |
| OpStore %x_86 %160 |
| %161 = OpUGreaterThanEqual %bool %159 %152 |
| OpSelectionMerge %162 None |
| OpBranchConditional %161 %163 %162 |
| %163 = OpLabel |
| %164 = OpAccessChain %_ptr_Workgroup_v2float %x_28 %159 %uint_0 |
| %165 = OpLoad %v2float %164 |
| %168 = OpLoad %v4float %x_85 |
| %169 = OpVectorShuffle %v2float %168 %168 0 1 |
| %166 = OpExtInst %v2float %167 NMin %169 %165 |
| %170 = OpLoad %v4float %x_85 |
| OpStore %x_103_1 %170 |
| %173 = OpAccessChain %_ptr_Function_float %x_103_1 %uint_0 |
| %174 = OpCompositeExtract %float %166 0 |
| OpStore %173 %174 |
| %175 = OpLoad %v4float %x_103_1 |
| OpStore %x_105_1 %175 |
| %177 = OpAccessChain %_ptr_Function_float %x_105_1 %uint_1 |
| %178 = OpCompositeExtract %float %166 1 |
| OpStore %177 %178 |
| %179 = OpLoad %v4float %x_105_1 |
| %181 = OpLoad %v4float %x_105_1 |
| %182 = OpVectorShuffle %v2float %181 %181 2 3 |
| %180 = OpExtInst %v2float %167 NMax %182 %165 |
| OpStore %x_109_1 %179 |
| %184 = OpAccessChain %_ptr_Function_float %x_109_1 %uint_2 |
| %185 = OpCompositeExtract %float %180 0 |
| OpStore %184 %185 |
| %186 = OpLoad %v4float %x_109_1 |
| OpStore %x_111 %186 |
| %188 = OpAccessChain %_ptr_Function_float %x_111 %uint_3 |
| %189 = OpCompositeExtract %float %180 1 |
| OpStore %188 %189 |
| %190 = OpLoad %v4float %x_111 |
| OpStore %x_86 %190 |
| OpBranch %162 |
| %162 = OpLabel |
| OpBranch %147 |
| %147 = OpLabel |
| %191 = OpLoad %uint %x_88 |
| %192 = OpIAdd %uint %191 %uint_32 |
| OpStore %x_89 %192 |
| %193 = OpLoad %v4float %x_86 |
| OpStore %x_85 %193 |
| %194 = OpLoad %uint %x_89 |
| OpStore %x_88 %194 |
| OpBranch %145 |
| %146 = OpLabel |
| OpControlBarrier %uint_2 %uint_2 %uint_264 |
| %199 = OpAccessChain %_ptr_Function_float %x_85 %uint_0 |
| %200 = OpLoad %float %199 |
| %198 = OpBitcast %uint %200 |
| %196 = OpAtomicUMin %uint %x_34 %uint_2 %uint_0 %198 |
| %204 = OpAccessChain %_ptr_Function_float %x_85 %uint_1 |
| %205 = OpLoad %float %204 |
| %203 = OpBitcast %uint %205 |
| %201 = OpAtomicUMin %uint %x_35 %uint_2 %uint_0 %203 |
| %209 = OpAccessChain %_ptr_Function_float %x_85 %uint_2 |
| %210 = OpLoad %float %209 |
| %208 = OpBitcast %uint %210 |
| %206 = OpAtomicUMax %uint %x_36 %uint_2 %uint_0 %208 |
| %214 = OpAccessChain %_ptr_Function_float %x_85 %uint_3 |
| %215 = OpLoad %float %214 |
| %213 = OpBitcast %uint %215 |
| %211 = OpAtomicUMax %uint %x_37 %uint_2 %uint_0 %213 |
| OpControlBarrier %uint_2 %uint_2 %uint_264 |
| %217 = OpAccessChain %_ptr_StorageBuffer_v4float %x_12 %uint_0 %125 |
| %219 = OpAtomicLoad %uint %x_34 %uint_2 %uint_0 |
| %218 = OpBitcast %float %219 |
| %222 = OpAtomicLoad %uint %x_35 %uint_2 %uint_0 |
| %221 = OpBitcast %float %222 |
| %225 = OpAtomicLoad %uint %x_36 %uint_2 %uint_0 |
| %224 = OpBitcast %float %225 |
| %228 = OpAtomicLoad %uint %x_37 %uint_2 %uint_0 |
| %227 = OpBitcast %float %228 |
| %230 = OpCompositeConstruct %v4float %218 %221 %224 %227 |
| OpStore %217 %230 |
| OpReturn |
| OpFunctionEnd |
| %main_inner = OpFunction %void None %231 |
| %x_3_param = OpFunctionParameter %v3uint |
| %local_invocation_index = OpFunctionParameter %uint |
| %235 = OpLabel |
| %236 = OpFunctionCall %void %tint_zero_workgroup_memory %local_invocation_index |
| OpStore %x_3 %x_3_param |
| %237 = OpFunctionCall %void %main_1 |
| OpReturn |
| OpFunctionEnd |
| %main = OpFunction %void None %76 |
| %239 = OpLabel |
| %241 = OpLoad %v3uint %x_3_param_1 |
| %242 = OpLoad %uint %local_invocation_index_1 |
| %240 = OpFunctionCall %void %main_inner %241 %242 |
| OpReturn |
| OpFunctionEnd |