blob: ae2be84b18724a5f5a1ff504471f0c6453561b22 [file] [log] [blame]
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 404
; Schema: 0
OpCapability Shader
%67 = 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_block "uniforms_block"
OpMemberName %uniforms_block 0 "inner"
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_block "dbg_block"
OpMemberName %dbg_block 0 "inner"
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 Block
OpMemberDecorate %uniforms_block 0 Offset 0
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 Block
OpMemberDecorate %dbg_block 0 Offset 0
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
%uniforms_block = OpTypeStruct %Uniforms
%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
%uniforms = OpVariable %_ptr_Uniform_uniforms_block 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
%dbg_block = OpTypeStruct %Dbg
%_ptr_StorageBuffer_dbg_block = OpTypePointer StorageBuffer %dbg_block
%dbg = OpVariable %_ptr_StorageBuffer_dbg_block StorageBuffer
%34 = OpTypeFunction %v3float %v3float
%uint_0 = OpConstant %uint 0
%uint_4 = OpConstant %uint 4
%_ptr_Uniform_float = OpTypePointer Uniform %float
%uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2
%_ptr_Function_v3float = OpTypePointer Function %v3float
%52 = OpConstantNull %v3float
%uint_5 = OpConstant %uint 5
%_ptr_Function_float = OpTypePointer Function %float
%77 = OpConstantNull %float
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%114 = OpTypeFunction %uint %uint %v3float
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
%122 = OpConstantNull %v3uint
%_ptr_Function_uint = OpTypePointer Function %uint
%135 = OpTypeFunction %v3uint %uint %uint
%143 = OpConstantNull %uint
%156 = OpTypeFunction %v3float %uint
%uint_3 = OpConstant %uint 3
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%void = OpTypeVoid
%177 = OpTypeFunction %void
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%190 = OpConstantNull %int
%_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_Function_int = OpTypePointer Function %int
%206 = 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 %34
%position = OpFunctionParameter %v3float
%37 = OpLabel
%bbMin = OpVariable %_ptr_Function_v3float Function %52
%bbMax = OpVariable %_ptr_Function_v3float Function %52
%bbSize = OpVariable %_ptr_Function_v3float Function %52
%cubeSize = OpVariable %_ptr_Function_float Function %77
%gridSize = OpVariable %_ptr_Function_float Function %77
%gx = OpVariable %_ptr_Function_float Function %77
%gy = OpVariable %_ptr_Function_float Function %77
%gz = OpVariable %_ptr_Function_float Function %77
%41 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0
%42 = OpLoad %float %41
%44 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1
%45 = OpLoad %float %44
%47 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2
%48 = OpLoad %float %47
%49 = OpCompositeConstruct %v3float %42 %45 %48
OpStore %bbMin %49
%54 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_0
%55 = OpLoad %float %54
%56 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_1
%57 = OpLoad %float %56
%58 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_5 %uint_2
%59 = OpLoad %float %58
%60 = OpCompositeConstruct %v3float %55 %57 %59
OpStore %bbMax %60
%62 = OpLoad %v3float %bbMax
%63 = OpLoad %v3float %bbMin
%64 = OpFSub %v3float %62 %63
OpStore %bbSize %64
%70 = OpAccessChain %_ptr_Function_float %bbSize %uint_0
%71 = OpLoad %float %70
%72 = OpAccessChain %_ptr_Function_float %bbSize %uint_1
%73 = OpLoad %float %72
%68 = OpExtInst %float %67 NMax %71 %73
%74 = OpAccessChain %_ptr_Function_float %bbSize %uint_2
%75 = OpLoad %float %74
%66 = OpExtInst %float %67 NMax %68 %75
OpStore %cubeSize %66
%80 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%81 = OpLoad %uint %80
%78 = OpConvertUToF %float %81
OpStore %gridSize %78
%83 = OpLoad %float %gridSize
%84 = OpCompositeExtract %float %position 0
%85 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_0
%86 = OpLoad %float %85
%87 = OpFSub %float %84 %86
%88 = OpFMul %float %83 %87
%89 = OpLoad %float %cubeSize
%90 = OpFDiv %float %88 %89
OpStore %gx %90
%92 = OpLoad %float %gridSize
%93 = OpCompositeExtract %float %position 1
%94 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_1
%95 = OpLoad %float %94
%96 = OpFSub %float %93 %95
%97 = OpFMul %float %92 %96
%98 = OpLoad %float %cubeSize
%99 = OpFDiv %float %97 %98
OpStore %gy %99
%101 = OpLoad %float %gridSize
%102 = OpCompositeExtract %float %position 2
%103 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_4 %uint_2
%104 = OpLoad %float %103
%105 = OpFSub %float %102 %104
%106 = OpFMul %float %101 %105
%107 = OpLoad %float %cubeSize
%108 = OpFDiv %float %106 %107
OpStore %gz %108
%110 = OpLoad %float %gx
%111 = OpLoad %float %gy
%112 = OpLoad %float %gz
%113 = OpCompositeConstruct %v3float %110 %111 %112
OpReturnValue %113
OpFunctionEnd
%toIndex1D = OpFunction %uint None %114
%gridSize_0 = OpFunctionParameter %uint
%voxelPos = OpFunctionParameter %v3float
%118 = OpLabel
%icoord = OpVariable %_ptr_Function_v3uint Function %122
%119 = OpConvertFToU %v3uint %voxelPos
OpStore %icoord %119
%124 = OpAccessChain %_ptr_Function_uint %icoord %uint_0
%125 = OpLoad %uint %124
%126 = OpAccessChain %_ptr_Function_uint %icoord %uint_1
%127 = OpLoad %uint %126
%128 = OpIMul %uint %gridSize_0 %127
%129 = OpIAdd %uint %125 %128
%130 = OpIMul %uint %gridSize_0 %gridSize_0
%131 = OpAccessChain %_ptr_Function_uint %icoord %uint_2
%132 = OpLoad %uint %131
%133 = OpIMul %uint %130 %132
%134 = OpIAdd %uint %129 %133
OpReturnValue %134
OpFunctionEnd
%toIndex3D = OpFunction %v3uint None %135
%gridSize_1 = OpFunctionParameter %uint
%index = OpFunctionParameter %uint
%139 = OpLabel
%z = OpVariable %_ptr_Function_uint Function %143
%y = OpVariable %_ptr_Function_uint Function %143
%x = OpVariable %_ptr_Function_uint Function %143
%140 = OpIMul %uint %gridSize_1 %gridSize_1
%141 = OpUDiv %uint %index %140
OpStore %z %141
%144 = OpIMul %uint %gridSize_1 %gridSize_1
%145 = OpLoad %uint %z
%146 = OpIMul %uint %144 %145
%147 = OpISub %uint %index %146
%148 = OpUDiv %uint %147 %gridSize_1
OpStore %y %148
%150 = OpUMod %uint %index %gridSize_1
OpStore %x %150
%152 = OpLoad %uint %x
%153 = OpLoad %uint %y
%154 = OpLoad %uint %z
%155 = OpCompositeConstruct %v3uint %152 %153 %154
OpReturnValue %155
OpFunctionEnd
%loadPosition = OpFunction %v3float None %156
%vertexIndex = OpFunctionParameter %uint
%159 = OpLabel
%position_0 = OpVariable %_ptr_Function_v3float Function %52
%161 = OpIMul %uint %uint_3 %vertexIndex
%162 = OpIAdd %uint %161 %143
%164 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %162
%165 = OpLoad %float %164
%166 = OpIMul %uint %uint_3 %vertexIndex
%167 = OpIAdd %uint %166 %uint_1
%168 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %167
%169 = OpLoad %float %168
%170 = OpIMul %uint %uint_3 %vertexIndex
%171 = OpIAdd %uint %170 %uint_2
%172 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %171
%173 = OpLoad %float %172
%174 = OpCompositeConstruct %v3float %165 %169 %173
OpStore %position_0 %174
%176 = OpLoad %v3float %position_0
OpReturnValue %176
OpFunctionEnd
%doIgnore = OpFunction %void None %177
%180 = OpLabel
%g42 = OpVariable %_ptr_Function_uint Function %143
%kj6 = OpVariable %_ptr_Function_uint Function %143
%b53 = OpVariable %_ptr_Function_uint Function %143
%rwg = OpVariable %_ptr_Function_uint Function %143
%rb5 = OpVariable %_ptr_Function_float Function %77
%g55 = OpVariable %_ptr_Function_int Function %190
%181 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%182 = OpLoad %uint %181
OpStore %g42 %182
%185 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_0 %uint_5
%186 = OpLoad %uint %185
OpStore %kj6 %186
%192 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %190
%188 = OpAtomicLoad %uint %192 %uint_1 %uint_0
OpStore %b53 %188
%194 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %190
%195 = OpLoad %uint %194
OpStore %rwg %195
%197 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %190
%198 = OpLoad %float %197
OpStore %rb5 %198
%203 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %190
%200 = OpAtomicLoad %int %203 %uint_1 %uint_0
OpStore %g55 %200
OpReturn
OpFunctionEnd
%main_count_inner = OpFunction %void None %206
%GlobalInvocationID = OpFunctionParameter %v3uint
%209 = OpLabel
%triangleIndex = OpVariable %_ptr_Function_uint Function %143
%i0 = OpVariable %_ptr_Function_uint Function %143
%i1 = OpVariable %_ptr_Function_uint Function %143
%i2 = OpVariable %_ptr_Function_uint Function %143
%p0 = OpVariable %_ptr_Function_v3float Function %52
%p1 = OpVariable %_ptr_Function_v3float Function %52
%p2 = OpVariable %_ptr_Function_v3float Function %52
%254 = OpVariable %_ptr_Function_v3float Function %52
%center = OpVariable %_ptr_Function_v3float Function %52
%voxelPos_0 = OpVariable %_ptr_Function_v3float Function %52
%voxelIndex = OpVariable %_ptr_Function_uint Function %143
%acefg = OpVariable %_ptr_Function_uint Function %143
%210 = OpCompositeExtract %uint %GlobalInvocationID 0
OpStore %triangleIndex %210
%212 = OpLoad %uint %triangleIndex
%213 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%214 = OpLoad %uint %213
%215 = OpUGreaterThanEqual %bool %212 %214
OpSelectionMerge %217 None
OpBranchConditional %215 %218 %217
%218 = OpLabel
OpReturn
%217 = OpLabel
%219 = OpFunctionCall %void %doIgnore
%220 = OpLoad %uint %triangleIndex
%221 = OpIMul %uint %uint_3 %220
%222 = OpIAdd %uint %221 %143
%223 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %222
%224 = OpLoad %uint %223
OpStore %i0 %224
%226 = OpLoad %uint %triangleIndex
%227 = OpIMul %uint %uint_3 %226
%228 = OpIAdd %uint %227 %uint_1
%229 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %228
%230 = OpLoad %uint %229
OpStore %i1 %230
%232 = OpLoad %uint %triangleIndex
%233 = OpIMul %uint %uint_3 %232
%234 = OpIAdd %uint %233 %uint_2
%235 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %234
%236 = OpLoad %uint %235
OpStore %i2 %236
%239 = OpLoad %uint %i0
%238 = OpFunctionCall %v3float %loadPosition %239
OpStore %p0 %238
%242 = OpLoad %uint %i1
%241 = OpFunctionCall %v3float %loadPosition %242
OpStore %p1 %241
%245 = OpLoad %uint %i2
%244 = OpFunctionCall %v3float %loadPosition %245
OpStore %p2 %244
%247 = OpLoad %v3float %p0
%248 = OpLoad %v3float %p1
%249 = OpFAdd %v3float %247 %248
%250 = OpLoad %v3float %p2
%251 = OpFAdd %v3float %249 %250
%255 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3
%253 = OpFDiv %v3float %251 %255
OpStore %center %253
%258 = OpLoad %v3float %center
%257 = OpFunctionCall %v3float %toVoxelPos %258
OpStore %voxelPos_0 %257
%261 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%262 = OpLoad %uint %261
%263 = OpLoad %v3float %voxelPos_0
%260 = OpFunctionCall %uint %toIndex1D %262 %263
OpStore %voxelIndex %260
%267 = OpLoad %uint %voxelIndex
%268 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %267
%265 = OpAtomicIAdd %uint %268 %uint_1 %uint_0 %uint_1
OpStore %acefg %265
%270 = OpLoad %uint %triangleIndex
%271 = OpIEqual %bool %270 %143
OpSelectionMerge %272 None
OpBranchConditional %271 %273 %272
%273 = OpLabel
%274 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_0 %uint_4
%275 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%276 = OpLoad %uint %275
OpStore %274 %276
%278 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_0 %uint_8
%279 = OpAccessChain %_ptr_Function_float %center %uint_0
%280 = OpLoad %float %279
OpStore %278 %280
%282 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_0 %uint_9
%283 = OpAccessChain %_ptr_Function_float %center %uint_1
%284 = OpLoad %float %283
OpStore %282 %284
%286 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_0 %uint_10
%287 = OpAccessChain %_ptr_Function_float %center %uint_2
%288 = OpLoad %float %287
OpStore %286 %288
OpBranch %272
%272 = OpLabel
OpReturn
OpFunctionEnd
%main_count = OpFunction %void None %177
%290 = OpLabel
%292 = OpLoad %v3uint %GlobalInvocationID_1
%291 = OpFunctionCall %void %main_count_inner %292
OpReturn
OpFunctionEnd
%main_create_lut_inner = OpFunction %void None %206
%GlobalInvocationID_0 = OpFunctionParameter %v3uint
%295 = OpLabel
%voxelIndex_0 = OpVariable %_ptr_Function_uint Function %143
%maxVoxels = OpVariable %_ptr_Function_uint Function %143
%numTriangles = OpVariable %_ptr_Function_uint Function %143
%offset = OpVariable %_ptr_Function_int Function %190
%296 = OpCompositeExtract %uint %GlobalInvocationID_0 0
OpStore %voxelIndex_0 %296
%298 = OpFunctionCall %void %doIgnore
%299 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%300 = OpLoad %uint %299
%301 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%302 = OpLoad %uint %301
%303 = OpIMul %uint %300 %302
%304 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%305 = OpLoad %uint %304
%306 = OpIMul %uint %303 %305
OpStore %maxVoxels %306
%308 = OpLoad %uint %voxelIndex_0
%309 = OpLoad %uint %maxVoxels
%310 = OpUGreaterThanEqual %bool %308 %309
OpSelectionMerge %311 None
OpBranchConditional %310 %312 %311
%312 = OpLabel
OpReturn
%311 = OpLabel
%315 = OpLoad %uint %voxelIndex_0
%316 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %315
%313 = OpAtomicLoad %uint %316 %uint_1 %uint_0
OpStore %numTriangles %313
OpStore %offset %int_n1
%320 = OpLoad %uint %numTriangles
%321 = OpUGreaterThan %bool %320 %143
OpSelectionMerge %322 None
OpBranchConditional %321 %323 %322
%323 = OpLabel
%326 = OpAccessChain %_ptr_StorageBuffer_uint_0 %dbg %uint_0 %uint_0
%327 = OpLoad %uint %numTriangles
%324 = OpAtomicIAdd %uint %326 %uint_1 %uint_0 %327
%328 = OpBitcast %int %324
OpStore %offset %328
OpBranch %322
%322 = OpLabel
%331 = OpLoad %uint %voxelIndex_0
%332 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %331
%333 = OpLoad %int %offset
OpAtomicStore %332 %uint_1 %uint_0 %333
OpReturn
OpFunctionEnd
%main_create_lut = OpFunction %void None %177
%335 = OpLabel
%337 = OpLoad %v3uint %GlobalInvocationID_2
%336 = OpFunctionCall %void %main_create_lut_inner %337
OpReturn
OpFunctionEnd
%main_sort_triangles_inner = OpFunction %void None %206
%GlobalInvocationID_4 = OpFunctionParameter %v3uint
%340 = OpLabel
%triangleIndex_0 = OpVariable %_ptr_Function_uint Function %143
%i0_0 = OpVariable %_ptr_Function_uint Function %143
%i1_0 = OpVariable %_ptr_Function_uint Function %143
%i2_0 = OpVariable %_ptr_Function_uint Function %143
%p0_0 = OpVariable %_ptr_Function_v3float Function %52
%p1_0 = OpVariable %_ptr_Function_v3float Function %52
%p2_0 = OpVariable %_ptr_Function_v3float Function %52
%383 = OpVariable %_ptr_Function_v3float Function %52
%center_0 = OpVariable %_ptr_Function_v3float Function %52
%voxelPos_1 = OpVariable %_ptr_Function_v3float Function %52
%voxelIndex_1 = OpVariable %_ptr_Function_uint Function %143
%triangleOffset = OpVariable %_ptr_Function_int Function %190
%341 = OpCompositeExtract %uint %GlobalInvocationID_4 0
OpStore %triangleIndex_0 %341
%343 = OpFunctionCall %void %doIgnore
%344 = OpLoad %uint %triangleIndex_0
%345 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0
%346 = OpLoad %uint %345
%347 = OpUGreaterThanEqual %bool %344 %346
OpSelectionMerge %348 None
OpBranchConditional %347 %349 %348
%349 = OpLabel
OpReturn
%348 = OpLabel
%350 = OpLoad %uint %triangleIndex_0
%351 = OpIMul %uint %uint_3 %350
%352 = OpIAdd %uint %351 %143
%353 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %352
%354 = OpLoad %uint %353
OpStore %i0_0 %354
%356 = OpLoad %uint %triangleIndex_0
%357 = OpIMul %uint %uint_3 %356
%358 = OpIAdd %uint %357 %uint_1
%359 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %358
%360 = OpLoad %uint %359
OpStore %i1_0 %360
%362 = OpLoad %uint %triangleIndex_0
%363 = OpIMul %uint %uint_3 %362
%364 = OpIAdd %uint %363 %uint_2
%365 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %364
%366 = OpLoad %uint %365
OpStore %i2_0 %366
%369 = OpLoad %uint %i0_0
%368 = OpFunctionCall %v3float %loadPosition %369
OpStore %p0_0 %368
%372 = OpLoad %uint %i1_0
%371 = OpFunctionCall %v3float %loadPosition %372
OpStore %p1_0 %371
%375 = OpLoad %uint %i2_0
%374 = OpFunctionCall %v3float %loadPosition %375
OpStore %p2_0 %374
%377 = OpLoad %v3float %p0_0
%378 = OpLoad %v3float %p1_0
%379 = OpFAdd %v3float %377 %378
%380 = OpLoad %v3float %p2_0
%381 = OpFAdd %v3float %379 %380
%384 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3
%382 = OpFDiv %v3float %381 %384
OpStore %center_0 %382
%387 = OpLoad %v3float %center_0
%386 = OpFunctionCall %v3float %toVoxelPos %387
OpStore %voxelPos_1 %386
%390 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1
%391 = OpLoad %uint %390
%392 = OpLoad %v3float %voxelPos_1
%389 = OpFunctionCall %uint %toIndex1D %391 %392
OpStore %voxelIndex_1 %389
%396 = OpLoad %uint %voxelIndex_1
%397 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %396
%394 = OpAtomicIAdd %int %397 %uint_1 %uint_0 %int_1
OpStore %triangleOffset %394
OpReturn
OpFunctionEnd
%main_sort_triangles = OpFunction %void None %177
%401 = OpLabel
%403 = OpLoad %v3uint %GlobalInvocationID_3
%402 = OpFunctionCall %void %main_sort_triangles_inner %403
OpReturn
OpFunctionEnd