blob: 8a911271241efdbec7b51f7e0713296d4d4fa8da [file] [log] [blame]
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 402
; 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
%188 = OpConstantNull %int
%_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%_ptr_Function_int = OpTypePointer Function %int
%204 = 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 %141
%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 %188
%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 %188
%186 = OpAtomicLoad %uint %190 %uint_1 %uint_0
OpStore %b53 %186
%192 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %188
%193 = OpLoad %uint %192
OpStore %rwg %193
%195 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %188
%196 = OpLoad %float %195
OpStore %rb5 %196
%201 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %188
%198 = OpAtomicLoad %int %201 %uint_1 %uint_0
OpStore %g55 %198
OpReturn
OpFunctionEnd
%main_count_inner = OpFunction %void None %204
%GlobalInvocationID = OpFunctionParameter %v3uint
%207 = 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
%252 = 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
%208 = OpCompositeExtract %uint %GlobalInvocationID 0
OpStore %triangleIndex %208
%210 = OpLoad %uint %triangleIndex
%211 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
%212 = OpLoad %uint %211
%213 = OpUGreaterThanEqual %bool %210 %212
OpSelectionMerge %215 None
OpBranchConditional %213 %216 %215
%216 = OpLabel
OpReturn
%215 = OpLabel
%217 = OpFunctionCall %void %doIgnore
%218 = OpLoad %uint %triangleIndex
%219 = OpIMul %uint %uint_3 %218
%220 = OpIAdd %uint %219 %141
%221 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %220
%222 = OpLoad %uint %221
OpStore %i0 %222
%224 = OpLoad %uint %triangleIndex
%225 = OpIMul %uint %uint_3 %224
%226 = OpIAdd %uint %225 %uint_1
%227 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %226
%228 = OpLoad %uint %227
OpStore %i1 %228
%230 = OpLoad %uint %triangleIndex
%231 = OpIMul %uint %uint_3 %230
%232 = OpIAdd %uint %231 %uint_2
%233 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %232
%234 = OpLoad %uint %233
OpStore %i2 %234
%237 = OpLoad %uint %i0
%236 = OpFunctionCall %v3float %loadPosition %237
OpStore %p0 %236
%240 = OpLoad %uint %i1
%239 = OpFunctionCall %v3float %loadPosition %240
OpStore %p1 %239
%243 = OpLoad %uint %i2
%242 = OpFunctionCall %v3float %loadPosition %243
OpStore %p2 %242
%245 = OpLoad %v3float %p0
%246 = OpLoad %v3float %p1
%247 = OpFAdd %v3float %245 %246
%248 = OpLoad %v3float %p2
%249 = OpFAdd %v3float %247 %248
%253 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3
%251 = OpFDiv %v3float %249 %253
OpStore %center %251
%256 = OpLoad %v3float %center
%255 = OpFunctionCall %v3float %toVoxelPos %256
OpStore %voxelPos_0 %255
%259 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%260 = OpLoad %uint %259
%261 = OpLoad %v3float %voxelPos_0
%258 = OpFunctionCall %uint %toIndex1D %260 %261
OpStore %voxelIndex %258
%265 = OpLoad %uint %voxelIndex
%266 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %265
%263 = OpAtomicIAdd %uint %266 %uint_1 %uint_0 %uint_1
OpStore %acefg %263
%268 = OpLoad %uint %triangleIndex
%269 = OpIEqual %bool %268 %141
OpSelectionMerge %270 None
OpBranchConditional %269 %271 %270
%271 = OpLabel
%272 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_4
%273 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%274 = OpLoad %uint %273
OpStore %272 %274
%276 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_8
%277 = OpAccessChain %_ptr_Function_float %center %uint_0
%278 = OpLoad %float %277
OpStore %276 %278
%280 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_9
%281 = OpAccessChain %_ptr_Function_float %center %uint_1
%282 = OpLoad %float %281
OpStore %280 %282
%284 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_10
%285 = OpAccessChain %_ptr_Function_float %center %uint_2
%286 = OpLoad %float %285
OpStore %284 %286
OpBranch %270
%270 = OpLabel
OpReturn
OpFunctionEnd
%main_count = OpFunction %void None %175
%288 = OpLabel
%290 = OpLoad %v3uint %GlobalInvocationID_1
%289 = OpFunctionCall %void %main_count_inner %290
OpReturn
OpFunctionEnd
%main_create_lut_inner = OpFunction %void None %204
%GlobalInvocationID_0 = OpFunctionParameter %v3uint
%293 = 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 %188
%294 = OpCompositeExtract %uint %GlobalInvocationID_0 0
OpStore %voxelIndex_0 %294
%296 = OpFunctionCall %void %doIgnore
%297 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%298 = OpLoad %uint %297
%299 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%300 = OpLoad %uint %299
%301 = OpIMul %uint %298 %300
%302 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%303 = OpLoad %uint %302
%304 = OpIMul %uint %301 %303
OpStore %maxVoxels %304
%306 = OpLoad %uint %voxelIndex_0
%307 = OpLoad %uint %maxVoxels
%308 = OpUGreaterThanEqual %bool %306 %307
OpSelectionMerge %309 None
OpBranchConditional %308 %310 %309
%310 = OpLabel
OpReturn
%309 = OpLabel
%313 = OpLoad %uint %voxelIndex_0
%314 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %313
%311 = OpAtomicLoad %uint %314 %uint_1 %uint_0
OpStore %numTriangles %311
OpStore %offset %int_n1
%318 = OpLoad %uint %numTriangles
%319 = OpUGreaterThan %bool %318 %141
OpSelectionMerge %320 None
OpBranchConditional %319 %321 %320
%321 = OpLabel
%324 = OpAccessChain %_ptr_StorageBuffer_uint_0 %dbg %uint_0
%325 = OpLoad %uint %numTriangles
%322 = OpAtomicIAdd %uint %324 %uint_1 %uint_0 %325
%326 = OpBitcast %int %322
OpStore %offset %326
OpBranch %320
%320 = OpLabel
%329 = OpLoad %uint %voxelIndex_0
%330 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %329
%331 = OpLoad %int %offset
OpAtomicStore %330 %uint_1 %uint_0 %331
OpReturn
OpFunctionEnd
%main_create_lut = OpFunction %void None %175
%333 = OpLabel
%335 = OpLoad %v3uint %GlobalInvocationID_2
%334 = OpFunctionCall %void %main_create_lut_inner %335
OpReturn
OpFunctionEnd
%main_sort_triangles_inner = OpFunction %void None %204
%GlobalInvocationID_4 = OpFunctionParameter %v3uint
%338 = 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
%381 = 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 %188
%339 = OpCompositeExtract %uint %GlobalInvocationID_4 0
OpStore %triangleIndex_0 %339
%341 = OpFunctionCall %void %doIgnore
%342 = OpLoad %uint %triangleIndex_0
%343 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0
%344 = OpLoad %uint %343
%345 = OpUGreaterThanEqual %bool %342 %344
OpSelectionMerge %346 None
OpBranchConditional %345 %347 %346
%347 = OpLabel
OpReturn
%346 = OpLabel
%348 = OpLoad %uint %triangleIndex_0
%349 = OpIMul %uint %uint_3 %348
%350 = OpIAdd %uint %349 %141
%351 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %350
%352 = OpLoad %uint %351
OpStore %i0_0 %352
%354 = OpLoad %uint %triangleIndex_0
%355 = OpIMul %uint %uint_3 %354
%356 = OpIAdd %uint %355 %uint_1
%357 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %356
%358 = OpLoad %uint %357
OpStore %i1_0 %358
%360 = OpLoad %uint %triangleIndex_0
%361 = OpIMul %uint %uint_3 %360
%362 = OpIAdd %uint %361 %uint_2
%363 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %362
%364 = OpLoad %uint %363
OpStore %i2_0 %364
%367 = OpLoad %uint %i0_0
%366 = OpFunctionCall %v3float %loadPosition %367
OpStore %p0_0 %366
%370 = OpLoad %uint %i1_0
%369 = OpFunctionCall %v3float %loadPosition %370
OpStore %p1_0 %369
%373 = OpLoad %uint %i2_0
%372 = OpFunctionCall %v3float %loadPosition %373
OpStore %p2_0 %372
%375 = OpLoad %v3float %p0_0
%376 = OpLoad %v3float %p1_0
%377 = OpFAdd %v3float %375 %376
%378 = OpLoad %v3float %p2_0
%379 = OpFAdd %v3float %377 %378
%382 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3
%380 = OpFDiv %v3float %379 %382
OpStore %center_0 %380
%385 = OpLoad %v3float %center_0
%384 = OpFunctionCall %v3float %toVoxelPos %385
OpStore %voxelPos_1 %384
%388 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_1
%389 = OpLoad %uint %388
%390 = OpLoad %v3float %voxelPos_1
%387 = OpFunctionCall %uint %toIndex1D %389 %390
OpStore %voxelIndex_1 %387
%394 = OpLoad %uint %voxelIndex_1
%395 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %394
%392 = OpAtomicIAdd %int %395 %uint_1 %uint_0 %int_1
OpStore %triangleOffset %392
OpReturn
OpFunctionEnd
%main_sort_triangles = OpFunction %void None %175
%399 = OpLabel
%401 = OpLoad %v3uint %GlobalInvocationID_3
%400 = OpFunctionCall %void %main_sort_triangles_inner %401
OpReturn
OpFunctionEnd