blob: fc5ae50538352bf2f9404582c357343b9e69e17c [file] [log] [blame]
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 403
; Schema: 0
OpCapability Shader
%65 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main_count "main_count" %GlobalInvocationID_1
OpEntryPoint GLCompute %main_create_lut "main_create_lut" %GlobalInvocationID_2
OpEntryPoint GLCompute %main_sort_triangles "main_sort_triangles" %GlobalInvocationID_3
OpExecutionMode %main_count LocalSize 128 1 1
OpExecutionMode %main_create_lut LocalSize 128 1 1
OpExecutionMode %main_sort_triangles LocalSize 128 1 1
OpName %GlobalInvocationID_1 "GlobalInvocationID_1"
OpName %GlobalInvocationID_2 "GlobalInvocationID_2"
OpName %GlobalInvocationID_3 "GlobalInvocationID_3"
OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "numTriangles"
OpMemberName %Uniforms 1 "gridSize"
OpMemberName %Uniforms 2 "pad1"
OpMemberName %Uniforms 3 "pad2"
OpMemberName %Uniforms 4 "bbMin"
OpMemberName %Uniforms 5 "bbMax"
OpName %uniforms "uniforms"
OpName %U32s "U32s"
OpMemberName %U32s 0 "values"
OpName %indices "indices"
OpName %F32s "F32s"
OpMemberName %F32s 0 "values"
OpName %positions "positions"
OpName %AU32s "AU32s"
OpMemberName %AU32s 0 "values"
OpName %counters "counters"
OpName %AI32s "AI32s"
OpMemberName %AI32s 0 "values"
OpName %LUT "LUT"
OpName %Dbg "Dbg"
OpMemberName %Dbg 0 "offsetCounter"
OpMemberName %Dbg 1 "pad0"
OpMemberName %Dbg 2 "pad1"
OpMemberName %Dbg 3 "pad2"
OpMemberName %Dbg 4 "value0"
OpMemberName %Dbg 5 "value1"
OpMemberName %Dbg 6 "value2"
OpMemberName %Dbg 7 "value3"
OpMemberName %Dbg 8 "value_f32_0"
OpMemberName %Dbg 9 "value_f32_1"
OpMemberName %Dbg 10 "value_f32_2"
OpMemberName %Dbg 11 "value_f32_3"
OpName %dbg "dbg"
OpName %toVoxelPos "toVoxelPos"
OpName %position "position"
OpName %bbMin "bbMin"
OpName %bbMax "bbMax"
OpName %bbSize "bbSize"
OpName %cubeSize "cubeSize"
OpName %gridSize "gridSize"
OpName %gx "gx"
OpName %gy "gy"
OpName %gz "gz"
OpName %toIndex1D "toIndex1D"
OpName %gridSize_0 "gridSize"
OpName %voxelPos "voxelPos"
OpName %icoord "icoord"
OpName %toIndex3D "toIndex3D"
OpName %gridSize_1 "gridSize"
OpName %index "index"
OpName %z "z"
OpName %y "y"
OpName %x "x"
OpName %loadPosition "loadPosition"
OpName %vertexIndex "vertexIndex"
OpName %position_0 "position"
OpName %doIgnore "doIgnore"
OpName %g42 "g42"
OpName %kj6 "kj6"
OpName %b53 "b53"
OpName %rwg "rwg"
OpName %rb5 "rb5"
OpName %g55 "g55"
OpName %main_count_inner "main_count_inner"
OpName %GlobalInvocationID "GlobalInvocationID"
OpName %triangleIndex "triangleIndex"
OpName %i0 "i0"
OpName %i1 "i1"
OpName %i2 "i2"
OpName %p0 "p0"
OpName %p1 "p1"
OpName %p2 "p2"
OpName %center "center"
OpName %voxelPos_0 "voxelPos"
OpName %voxelIndex "voxelIndex"
OpName %acefg "acefg"
OpName %main_count "main_count"
OpName %main_create_lut_inner "main_create_lut_inner"
OpName %GlobalInvocationID_0 "GlobalInvocationID"
OpName %voxelIndex_0 "voxelIndex"
OpName %maxVoxels "maxVoxels"
OpName %numTriangles "numTriangles"
OpName %offset "offset"
OpName %main_create_lut "main_create_lut"
OpName %main_sort_triangles_inner "main_sort_triangles_inner"
OpName %GlobalInvocationID_4 "GlobalInvocationID"
OpName %triangleIndex_0 "triangleIndex"
OpName %i0_0 "i0"
OpName %i1_0 "i1"
OpName %i2_0 "i2"
OpName %p0_0 "p0"
OpName %p1_0 "p1"
OpName %p2_0 "p2"
OpName %center_0 "center"
OpName %voxelPos_1 "voxelPos"
OpName %voxelIndex_1 "voxelIndex"
OpName %triangleOffset "triangleOffset"
OpName %main_sort_triangles "main_sort_triangles"
OpDecorate %GlobalInvocationID_1 BuiltIn GlobalInvocationId
OpDecorate %GlobalInvocationID_2 BuiltIn GlobalInvocationId
OpDecorate %GlobalInvocationID_3 BuiltIn GlobalInvocationId
OpDecorate %Uniforms Block
OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 4
OpMemberDecorate %Uniforms 2 Offset 8
OpMemberDecorate %Uniforms 3 Offset 12
OpMemberDecorate %Uniforms 4 Offset 16
OpMemberDecorate %Uniforms 5 Offset 32
OpDecorate %uniforms NonWritable
OpDecorate %uniforms Binding 0
OpDecorate %uniforms DescriptorSet 0
OpDecorate %U32s Block
OpMemberDecorate %U32s 0 Offset 0
OpDecorate %_runtimearr_uint ArrayStride 4
OpDecorate %indices Binding 10
OpDecorate %indices DescriptorSet 0
OpDecorate %F32s Block
OpMemberDecorate %F32s 0 Offset 0
OpDecorate %_runtimearr_float ArrayStride 4
OpDecorate %positions Binding 11
OpDecorate %positions DescriptorSet 0
OpDecorate %AU32s Block
OpMemberDecorate %AU32s 0 Offset 0
OpDecorate %_runtimearr_uint_0 ArrayStride 4
OpDecorate %counters Binding 20
OpDecorate %counters DescriptorSet 0
OpDecorate %AI32s Block
OpMemberDecorate %AI32s 0 Offset 0
OpDecorate %_runtimearr_int ArrayStride 4
OpDecorate %LUT Binding 21
OpDecorate %LUT DescriptorSet 0
OpDecorate %Dbg Block
OpMemberDecorate %Dbg 0 Offset 0
OpMemberDecorate %Dbg 1 Offset 4
OpMemberDecorate %Dbg 2 Offset 8
OpMemberDecorate %Dbg 3 Offset 12
OpMemberDecorate %Dbg 4 Offset 16
OpMemberDecorate %Dbg 5 Offset 20
OpMemberDecorate %Dbg 6 Offset 24
OpMemberDecorate %Dbg 7 Offset 28
OpMemberDecorate %Dbg 8 Offset 32
OpMemberDecorate %Dbg 9 Offset 36
OpMemberDecorate %Dbg 10 Offset 40
OpMemberDecorate %Dbg 11 Offset 44
OpDecorate %dbg Binding 50
OpDecorate %dbg DescriptorSet 0
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%GlobalInvocationID_1 = OpVariable %_ptr_Input_v3uint Input
%GlobalInvocationID_2 = OpVariable %_ptr_Input_v3uint Input
%GlobalInvocationID_3 = OpVariable %_ptr_Input_v3uint Input
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%Uniforms = OpTypeStruct %uint %uint %uint %uint %v3float %v3float
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform
%_runtimearr_uint = OpTypeRuntimeArray %uint
%U32s = OpTypeStruct %_runtimearr_uint
%_ptr_StorageBuffer_U32s = OpTypePointer StorageBuffer %U32s
%indices = OpVariable %_ptr_StorageBuffer_U32s StorageBuffer
%_runtimearr_float = OpTypeRuntimeArray %float
%F32s = OpTypeStruct %_runtimearr_float
%_ptr_StorageBuffer_F32s = OpTypePointer StorageBuffer %F32s
%positions = OpVariable %_ptr_StorageBuffer_F32s StorageBuffer
%_runtimearr_uint_0 = OpTypeRuntimeArray %uint
%AU32s = OpTypeStruct %_runtimearr_uint_0
%_ptr_StorageBuffer_AU32s = OpTypePointer StorageBuffer %AU32s
%counters = OpVariable %_ptr_StorageBuffer_AU32s StorageBuffer
%int = OpTypeInt 32 1
%_runtimearr_int = OpTypeRuntimeArray %int
%AI32s = OpTypeStruct %_runtimearr_int
%_ptr_StorageBuffer_AI32s = OpTypePointer StorageBuffer %AI32s
%LUT = OpVariable %_ptr_StorageBuffer_AI32s StorageBuffer
%Dbg = OpTypeStruct %uint %uint %uint %uint %uint %uint %uint %uint %float %float %float %float
%_ptr_StorageBuffer_Dbg = OpTypePointer StorageBuffer %Dbg
%dbg = OpVariable %_ptr_StorageBuffer_Dbg StorageBuffer
%32 = OpTypeFunction %v3float %v3float
%uint_4 = OpConstant %uint 4
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2
%_ptr_Function_v3float = OpTypePointer Function %v3float
%50 = OpConstantNull %v3float
%uint_5 = OpConstant %uint 5
%_ptr_Function_float = OpTypePointer Function %float
%75 = OpConstantNull %float
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%112 = OpTypeFunction %uint %uint %v3float
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
%120 = OpConstantNull %v3uint
%_ptr_Function_uint = OpTypePointer Function %uint
%133 = OpTypeFunction %v3uint %uint %uint
%141 = OpConstantNull %uint
%154 = OpTypeFunction %v3float %uint
%uint_3 = OpConstant %uint 3
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%void = OpTypeVoid
%175 = OpTypeFunction %void
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%int_0 = OpConstant %int 0
%_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_Function_int = OpTypePointer Function %int
%204 = OpConstantNull %int
%205 = OpTypeFunction %void %v3uint
%bool = OpTypeBool
%float_3 = OpConstant %float 3
%uint_8 = OpConstant %uint 8
%uint_9 = OpConstant %uint 9
%uint_10 = OpConstant %uint 10
%int_n1 = OpConstant %int -1
%int_1 = OpConstant %int 1
%toVoxelPos = OpFunction %v3float None %32
%position = OpFunctionParameter %v3float
%35 = OpLabel
%bbMin = OpVariable %_ptr_Function_v3float Function %50
%bbMax = OpVariable %_ptr_Function_v3float Function %50
%bbSize = OpVariable %_ptr_Function_v3float Function %50
%cubeSize = OpVariable %_ptr_Function_float Function %75
%gridSize = OpVariable %_ptr_Function_float Function %75
%gx = OpVariable %_ptr_Function_float Function %75
%gy = OpVariable %_ptr_Function_float Function %75
%gz = OpVariable %_ptr_Function_float Function %75
%39 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_0
%40 = OpLoad %float %39
%42 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_1
%43 = OpLoad %float %42
%45 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_2
%46 = OpLoad %float %45
%47 = OpCompositeConstruct %v3float %40 %43 %46
OpStore %bbMin %47
%52 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_0
%53 = OpLoad %float %52
%54 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_1
%55 = OpLoad %float %54
%56 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_5 %uint_2
%57 = OpLoad %float %56
%58 = OpCompositeConstruct %v3float %53 %55 %57
OpStore %bbMax %58
%60 = OpLoad %v3float %bbMax
%61 = OpLoad %v3float %bbMin
%62 = OpFSub %v3float %60 %61
OpStore %bbSize %62
%68 = OpAccessChain %_ptr_Function_float %bbSize %uint_0
%69 = OpLoad %float %68
%70 = OpAccessChain %_ptr_Function_float %bbSize %uint_1
%71 = OpLoad %float %70
%66 = OpExtInst %float %65 NMax %69 %71
%72 = OpAccessChain %_ptr_Function_float %bbSize %uint_2
%73 = OpLoad %float %72
%64 = OpExtInst %float %65 NMax %66 %73
OpStore %cubeSize %64
%78 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%79 = OpLoad %uint %78
%76 = OpConvertUToF %float %79
OpStore %gridSize %76
%81 = OpLoad %float %gridSize
%82 = OpCompositeExtract %float %position 0
%83 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_0
%84 = OpLoad %float %83
%85 = OpFSub %float %82 %84
%86 = OpFMul %float %81 %85
%87 = OpLoad %float %cubeSize
%88 = OpFDiv %float %86 %87
OpStore %gx %88
%90 = OpLoad %float %gridSize
%91 = OpCompositeExtract %float %position 1
%92 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_1
%93 = OpLoad %float %92
%94 = OpFSub %float %91 %93
%95 = OpFMul %float %90 %94
%96 = OpLoad %float %cubeSize
%97 = OpFDiv %float %95 %96
OpStore %gy %97
%99 = OpLoad %float %gridSize
%100 = OpCompositeExtract %float %position 2
%101 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_4 %uint_2
%102 = OpLoad %float %101
%103 = OpFSub %float %100 %102
%104 = OpFMul %float %99 %103
%105 = OpLoad %float %cubeSize
%106 = OpFDiv %float %104 %105
OpStore %gz %106
%108 = OpLoad %float %gx
%109 = OpLoad %float %gy
%110 = OpLoad %float %gz
%111 = OpCompositeConstruct %v3float %108 %109 %110
OpReturnValue %111
OpFunctionEnd
%toIndex1D = OpFunction %uint None %112
%gridSize_0 = OpFunctionParameter %uint
%voxelPos = OpFunctionParameter %v3float
%116 = OpLabel
%icoord = OpVariable %_ptr_Function_v3uint Function %120
%117 = OpConvertFToU %v3uint %voxelPos
OpStore %icoord %117
%122 = OpAccessChain %_ptr_Function_uint %icoord %uint_0
%123 = OpLoad %uint %122
%124 = OpAccessChain %_ptr_Function_uint %icoord %uint_1
%125 = OpLoad %uint %124
%126 = OpIMul %uint %gridSize_0 %125
%127 = OpIAdd %uint %123 %126
%128 = OpIMul %uint %gridSize_0 %gridSize_0
%129 = OpAccessChain %_ptr_Function_uint %icoord %uint_2
%130 = OpLoad %uint %129
%131 = OpIMul %uint %128 %130
%132 = OpIAdd %uint %127 %131
OpReturnValue %132
OpFunctionEnd
%toIndex3D = OpFunction %v3uint None %133
%gridSize_1 = OpFunctionParameter %uint
%index = OpFunctionParameter %uint
%137 = OpLabel
%z = OpVariable %_ptr_Function_uint Function %141
%y = OpVariable %_ptr_Function_uint Function %141
%x = OpVariable %_ptr_Function_uint Function %141
%138 = OpIMul %uint %gridSize_1 %gridSize_1
%139 = OpUDiv %uint %index %138
OpStore %z %139
%142 = OpIMul %uint %gridSize_1 %gridSize_1
%143 = OpLoad %uint %z
%144 = OpIMul %uint %142 %143
%145 = OpISub %uint %index %144
%146 = OpUDiv %uint %145 %gridSize_1
OpStore %y %146
%148 = OpUMod %uint %index %gridSize_1
OpStore %x %148
%150 = OpLoad %uint %x
%151 = OpLoad %uint %y
%152 = OpLoad %uint %z
%153 = OpCompositeConstruct %v3uint %150 %151 %152
OpReturnValue %153
OpFunctionEnd
%loadPosition = OpFunction %v3float None %154
%vertexIndex = OpFunctionParameter %uint
%157 = OpLabel
%position_0 = OpVariable %_ptr_Function_v3float Function %50
%159 = OpIMul %uint %uint_3 %vertexIndex
%160 = OpIAdd %uint %159 %uint_0
%162 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %160
%163 = OpLoad %float %162
%164 = OpIMul %uint %uint_3 %vertexIndex
%165 = OpIAdd %uint %164 %uint_1
%166 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %165
%167 = OpLoad %float %166
%168 = OpIMul %uint %uint_3 %vertexIndex
%169 = OpIAdd %uint %168 %uint_2
%170 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %169
%171 = OpLoad %float %170
%172 = OpCompositeConstruct %v3float %163 %167 %171
OpStore %position_0 %172
%174 = OpLoad %v3float %position_0
OpReturnValue %174
OpFunctionEnd
%doIgnore = OpFunction %void None %175
%178 = OpLabel
%g42 = OpVariable %_ptr_Function_uint Function %141
%kj6 = OpVariable %_ptr_Function_uint Function %141
%b53 = OpVariable %_ptr_Function_uint Function %141
%rwg = OpVariable %_ptr_Function_uint Function %141
%rb5 = OpVariable %_ptr_Function_float Function %75
%g55 = OpVariable %_ptr_Function_int Function %204
%179 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
%180 = OpLoad %uint %179
OpStore %g42 %180
%183 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_5
%184 = OpLoad %uint %183
OpStore %kj6 %184
%190 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %int_0
%186 = OpAtomicLoad %uint %190 %uint_1 %uint_0
OpStore %b53 %186
%192 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %int_0
%193 = OpLoad %uint %192
OpStore %rwg %193
%195 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %int_0
%196 = OpLoad %float %195
OpStore %rb5 %196
%201 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %int_0
%198 = OpAtomicLoad %int %201 %uint_1 %uint_0
OpStore %g55 %198
OpReturn
OpFunctionEnd
%main_count_inner = OpFunction %void None %205
%GlobalInvocationID = OpFunctionParameter %v3uint
%208 = OpLabel
%triangleIndex = OpVariable %_ptr_Function_uint Function %141
%i0 = OpVariable %_ptr_Function_uint Function %141
%i1 = OpVariable %_ptr_Function_uint Function %141
%i2 = OpVariable %_ptr_Function_uint Function %141
%p0 = OpVariable %_ptr_Function_v3float Function %50
%p1 = OpVariable %_ptr_Function_v3float Function %50
%p2 = OpVariable %_ptr_Function_v3float Function %50
%253 = OpVariable %_ptr_Function_v3float Function %50
%center = OpVariable %_ptr_Function_v3float Function %50
%voxelPos_0 = OpVariable %_ptr_Function_v3float Function %50
%voxelIndex = OpVariable %_ptr_Function_uint Function %141
%acefg = OpVariable %_ptr_Function_uint Function %141
%209 = OpCompositeExtract %uint %GlobalInvocationID 0
OpStore %triangleIndex %209
%211 = OpLoad %uint %triangleIndex
%212 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
%213 = OpLoad %uint %212
%214 = OpUGreaterThanEqual %bool %211 %213
OpSelectionMerge %216 None
OpBranchConditional %214 %217 %216
%217 = OpLabel
OpReturn
%216 = OpLabel
%218 = OpFunctionCall %void %doIgnore
%219 = OpLoad %uint %triangleIndex
%220 = OpIMul %uint %uint_3 %219
%221 = OpIAdd %uint %220 %uint_0
%222 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %221
%223 = OpLoad %uint %222
OpStore %i0 %223
%225 = OpLoad %uint %triangleIndex
%226 = OpIMul %uint %uint_3 %225
%227 = OpIAdd %uint %226 %uint_1
%228 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %227
%229 = OpLoad %uint %228
OpStore %i1 %229
%231 = OpLoad %uint %triangleIndex
%232 = OpIMul %uint %uint_3 %231
%233 = OpIAdd %uint %232 %uint_2
%234 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %233
%235 = OpLoad %uint %234
OpStore %i2 %235
%238 = OpLoad %uint %i0
%237 = OpFunctionCall %v3float %loadPosition %238
OpStore %p0 %237
%241 = OpLoad %uint %i1
%240 = OpFunctionCall %v3float %loadPosition %241
OpStore %p1 %240
%244 = OpLoad %uint %i2
%243 = OpFunctionCall %v3float %loadPosition %244
OpStore %p2 %243
%246 = OpLoad %v3float %p0
%247 = OpLoad %v3float %p1
%248 = OpFAdd %v3float %246 %247
%249 = OpLoad %v3float %p2
%250 = OpFAdd %v3float %248 %249
%254 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3
%252 = OpFDiv %v3float %250 %254
OpStore %center %252
%257 = OpLoad %v3float %center
%256 = OpFunctionCall %v3float %toVoxelPos %257
OpStore %voxelPos_0 %256
%260 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%261 = OpLoad %uint %260
%262 = OpLoad %v3float %voxelPos_0
%259 = OpFunctionCall %uint %toIndex1D %261 %262
OpStore %voxelIndex %259
%266 = OpLoad %uint %voxelIndex
%267 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %266
%264 = OpAtomicIAdd %uint %267 %uint_1 %uint_0 %uint_1
OpStore %acefg %264
%269 = OpLoad %uint %triangleIndex
%270 = OpIEqual %bool %269 %uint_0
OpSelectionMerge %271 None
OpBranchConditional %270 %272 %271
%272 = OpLabel
%273 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_4
%274 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%275 = OpLoad %uint %274
OpStore %273 %275
%277 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_8
%278 = OpAccessChain %_ptr_Function_float %center %uint_0
%279 = OpLoad %float %278
OpStore %277 %279
%281 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_9
%282 = OpAccessChain %_ptr_Function_float %center %uint_1
%283 = OpLoad %float %282
OpStore %281 %283
%285 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_10
%286 = OpAccessChain %_ptr_Function_float %center %uint_2
%287 = OpLoad %float %286
OpStore %285 %287
OpBranch %271
%271 = OpLabel
OpReturn
OpFunctionEnd
%main_count = OpFunction %void None %175
%289 = OpLabel
%291 = OpLoad %v3uint %GlobalInvocationID_1
%290 = OpFunctionCall %void %main_count_inner %291
OpReturn
OpFunctionEnd
%main_create_lut_inner = OpFunction %void None %205
%GlobalInvocationID_0 = OpFunctionParameter %v3uint
%294 = OpLabel
%voxelIndex_0 = OpVariable %_ptr_Function_uint Function %141
%maxVoxels = OpVariable %_ptr_Function_uint Function %141
%numTriangles = OpVariable %_ptr_Function_uint Function %141
%offset = OpVariable %_ptr_Function_int Function %204
%295 = OpCompositeExtract %uint %GlobalInvocationID_0 0
OpStore %voxelIndex_0 %295
%297 = OpFunctionCall %void %doIgnore
%298 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%299 = OpLoad %uint %298
%300 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%301 = OpLoad %uint %300
%302 = OpIMul %uint %299 %301
%303 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%304 = OpLoad %uint %303
%305 = OpIMul %uint %302 %304
OpStore %maxVoxels %305
%307 = OpLoad %uint %voxelIndex_0
%308 = OpLoad %uint %maxVoxels
%309 = OpUGreaterThanEqual %bool %307 %308
OpSelectionMerge %310 None
OpBranchConditional %309 %311 %310
%311 = OpLabel
OpReturn
%310 = OpLabel
%314 = OpLoad %uint %voxelIndex_0
%315 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %314
%312 = OpAtomicLoad %uint %315 %uint_1 %uint_0
OpStore %numTriangles %312
OpStore %offset %int_n1
%319 = OpLoad %uint %numTriangles
%320 = OpUGreaterThan %bool %319 %uint_0
OpSelectionMerge %321 None
OpBranchConditional %320 %322 %321
%322 = OpLabel
%326 = OpAccessChain %_ptr_StorageBuffer_uint_0 %dbg %uint_0
%327 = OpLoad %uint %numTriangles
%324 = OpAtomicIAdd %uint %326 %uint_1 %uint_0 %327
%323 = OpBitcast %int %324
OpStore %offset %323
OpBranch %321
%321 = OpLabel
%330 = OpLoad %uint %voxelIndex_0
%331 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %330
%332 = OpLoad %int %offset
OpAtomicStore %331 %uint_1 %uint_0 %332
OpReturn
OpFunctionEnd
%main_create_lut = OpFunction %void None %175
%334 = OpLabel
%336 = OpLoad %v3uint %GlobalInvocationID_2
%335 = OpFunctionCall %void %main_create_lut_inner %336
OpReturn
OpFunctionEnd
%main_sort_triangles_inner = OpFunction %void None %205
%GlobalInvocationID_4 = OpFunctionParameter %v3uint
%339 = OpLabel
%triangleIndex_0 = OpVariable %_ptr_Function_uint Function %141
%i0_0 = OpVariable %_ptr_Function_uint Function %141
%i1_0 = OpVariable %_ptr_Function_uint Function %141
%i2_0 = OpVariable %_ptr_Function_uint Function %141
%p0_0 = OpVariable %_ptr_Function_v3float Function %50
%p1_0 = OpVariable %_ptr_Function_v3float Function %50
%p2_0 = OpVariable %_ptr_Function_v3float Function %50
%382 = OpVariable %_ptr_Function_v3float Function %50
%center_0 = OpVariable %_ptr_Function_v3float Function %50
%voxelPos_1 = OpVariable %_ptr_Function_v3float Function %50
%voxelIndex_1 = OpVariable %_ptr_Function_uint Function %141
%triangleOffset = OpVariable %_ptr_Function_int Function %204
%340 = OpCompositeExtract %uint %GlobalInvocationID_4 0
OpStore %triangleIndex_0 %340
%342 = OpFunctionCall %void %doIgnore
%343 = OpLoad %uint %triangleIndex_0
%344 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
%345 = OpLoad %uint %344
%346 = OpUGreaterThanEqual %bool %343 %345
OpSelectionMerge %347 None
OpBranchConditional %346 %348 %347
%348 = OpLabel
OpReturn
%347 = OpLabel
%349 = OpLoad %uint %triangleIndex_0
%350 = OpIMul %uint %uint_3 %349
%351 = OpIAdd %uint %350 %uint_0
%352 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %351
%353 = OpLoad %uint %352
OpStore %i0_0 %353
%355 = OpLoad %uint %triangleIndex_0
%356 = OpIMul %uint %uint_3 %355
%357 = OpIAdd %uint %356 %uint_1
%358 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %357
%359 = OpLoad %uint %358
OpStore %i1_0 %359
%361 = OpLoad %uint %triangleIndex_0
%362 = OpIMul %uint %uint_3 %361
%363 = OpIAdd %uint %362 %uint_2
%364 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %363
%365 = OpLoad %uint %364
OpStore %i2_0 %365
%368 = OpLoad %uint %i0_0
%367 = OpFunctionCall %v3float %loadPosition %368
OpStore %p0_0 %367
%371 = OpLoad %uint %i1_0
%370 = OpFunctionCall %v3float %loadPosition %371
OpStore %p1_0 %370
%374 = OpLoad %uint %i2_0
%373 = OpFunctionCall %v3float %loadPosition %374
OpStore %p2_0 %373
%376 = OpLoad %v3float %p0_0
%377 = OpLoad %v3float %p1_0
%378 = OpFAdd %v3float %376 %377
%379 = OpLoad %v3float %p2_0
%380 = OpFAdd %v3float %378 %379
%383 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3
%381 = OpFDiv %v3float %380 %383
OpStore %center_0 %381
%386 = OpLoad %v3float %center_0
%385 = OpFunctionCall %v3float %toVoxelPos %386
OpStore %voxelPos_1 %385
%389 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%390 = OpLoad %uint %389
%391 = OpLoad %v3float %voxelPos_1
%388 = OpFunctionCall %uint %toIndex1D %390 %391
OpStore %voxelIndex_1 %388
%395 = OpLoad %uint %voxelIndex_1
%396 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %395
%393 = OpAtomicIAdd %int %396 %uint_1 %uint_0 %int_1
OpStore %triangleOffset %393
OpReturn
OpFunctionEnd
%main_sort_triangles = OpFunction %void None %175
%400 = OpLabel
%402 = OpLoad %v3uint %GlobalInvocationID_3
%401 = OpFunctionCall %void %main_sort_triangles_inner %402
OpReturn
OpFunctionEnd