| ; SPIR-V |
| ; Version: 1.3 |
| ; Generator: Google Tint Compiler; 0 |
| ; Bound: 419 |
| ; 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 %tint_div "tint_div" |
| OpName %lhs "lhs" |
| OpName %rhs "rhs" |
| OpName %tint_mod "tint_mod" |
| OpName %lhs_0 "lhs" |
| OpName %rhs_0 "rhs" |
| 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 %uint %uint %uint |
| %141 = OpConstantNull %uint |
| %bool = OpTypeBool |
| %152 = OpTypeFunction %v3uint %uint %uint |
| %172 = OpTypeFunction %v3float %uint |
| %uint_3 = OpConstant %uint 3 |
| %_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float |
| %void = OpTypeVoid |
| %193 = OpTypeFunction %void |
| %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint |
| %206 = OpConstantNull %int |
| %_ptr_StorageBuffer_uint_0 = OpTypePointer StorageBuffer %uint |
| %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int |
| %_ptr_Function_int = OpTypePointer Function %int |
| %222 = OpTypeFunction %void %v3uint |
| %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 |
| %tint_div = OpFunction %uint None %135 |
| %lhs = OpFunctionParameter %uint |
| %rhs = OpFunctionParameter %uint |
| %139 = OpLabel |
| %142 = OpIEqual %bool %rhs %141 |
| %140 = OpSelect %uint %142 %uint_1 %rhs |
| %144 = OpUDiv %uint %lhs %140 |
| OpReturnValue %144 |
| OpFunctionEnd |
| %tint_mod = OpFunction %uint None %135 |
| %lhs_0 = OpFunctionParameter %uint |
| %rhs_0 = OpFunctionParameter %uint |
| %148 = OpLabel |
| %150 = OpIEqual %bool %rhs_0 %141 |
| %149 = OpSelect %uint %150 %uint_1 %rhs_0 |
| %151 = OpUMod %uint %lhs_0 %149 |
| OpReturnValue %151 |
| OpFunctionEnd |
| %toIndex3D = OpFunction %v3uint None %152 |
| %gridSize_1 = OpFunctionParameter %uint |
| %index = OpFunctionParameter %uint |
| %156 = OpLabel |
| %z = OpVariable %_ptr_Function_uint Function %141 |
| %y = OpVariable %_ptr_Function_uint Function %141 |
| %x = OpVariable %_ptr_Function_uint Function %141 |
| %158 = OpIMul %uint %gridSize_1 %gridSize_1 |
| %157 = OpFunctionCall %uint %tint_div %index %158 |
| OpStore %z %157 |
| %161 = OpIMul %uint %gridSize_1 %gridSize_1 |
| %162 = OpLoad %uint %z |
| %163 = OpIMul %uint %161 %162 |
| %164 = OpISub %uint %index %163 |
| %160 = OpFunctionCall %uint %tint_div %164 %gridSize_1 |
| OpStore %y %160 |
| %166 = OpFunctionCall %uint %tint_mod %index %gridSize_1 |
| OpStore %x %166 |
| %168 = OpLoad %uint %x |
| %169 = OpLoad %uint %y |
| %170 = OpLoad %uint %z |
| %171 = OpCompositeConstruct %v3uint %168 %169 %170 |
| OpReturnValue %171 |
| OpFunctionEnd |
| %loadPosition = OpFunction %v3float None %172 |
| %vertexIndex = OpFunctionParameter %uint |
| %175 = OpLabel |
| %position_0 = OpVariable %_ptr_Function_v3float Function %52 |
| %177 = OpIMul %uint %uint_3 %vertexIndex |
| %178 = OpIAdd %uint %177 %141 |
| %180 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %178 |
| %181 = OpLoad %float %180 |
| %182 = OpIMul %uint %uint_3 %vertexIndex |
| %183 = OpIAdd %uint %182 %uint_1 |
| %184 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %183 |
| %185 = OpLoad %float %184 |
| %186 = OpIMul %uint %uint_3 %vertexIndex |
| %187 = OpIAdd %uint %186 %uint_2 |
| %188 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %187 |
| %189 = OpLoad %float %188 |
| %190 = OpCompositeConstruct %v3float %181 %185 %189 |
| OpStore %position_0 %190 |
| %192 = OpLoad %v3float %position_0 |
| OpReturnValue %192 |
| OpFunctionEnd |
| %doIgnore = OpFunction %void None %193 |
| %196 = 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 %77 |
| %g55 = OpVariable %_ptr_Function_int Function %206 |
| %197 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 |
| %198 = OpLoad %uint %197 |
| OpStore %g42 %198 |
| %201 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_0 %uint_5 |
| %202 = OpLoad %uint %201 |
| OpStore %kj6 %202 |
| %208 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %206 |
| %204 = OpAtomicLoad %uint %208 %uint_1 %uint_0 |
| OpStore %b53 %204 |
| %210 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %206 |
| %211 = OpLoad %uint %210 |
| OpStore %rwg %211 |
| %213 = OpAccessChain %_ptr_StorageBuffer_float %positions %uint_0 %206 |
| %214 = OpLoad %float %213 |
| OpStore %rb5 %214 |
| %219 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %206 |
| %216 = OpAtomicLoad %int %219 %uint_1 %uint_0 |
| OpStore %g55 %216 |
| OpReturn |
| OpFunctionEnd |
| %main_count_inner = OpFunction %void None %222 |
| %GlobalInvocationID = OpFunctionParameter %v3uint |
| %225 = 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 %52 |
| %p1 = OpVariable %_ptr_Function_v3float Function %52 |
| %p2 = OpVariable %_ptr_Function_v3float Function %52 |
| %269 = 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 %141 |
| %acefg = OpVariable %_ptr_Function_uint Function %141 |
| %226 = OpCompositeExtract %uint %GlobalInvocationID 0 |
| OpStore %triangleIndex %226 |
| %228 = OpLoad %uint %triangleIndex |
| %229 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 |
| %230 = OpLoad %uint %229 |
| %231 = OpUGreaterThanEqual %bool %228 %230 |
| OpSelectionMerge %232 None |
| OpBranchConditional %231 %233 %232 |
| %233 = OpLabel |
| OpReturn |
| %232 = OpLabel |
| %234 = OpFunctionCall %void %doIgnore |
| %235 = OpLoad %uint %triangleIndex |
| %236 = OpIMul %uint %uint_3 %235 |
| %237 = OpIAdd %uint %236 %141 |
| %238 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %237 |
| %239 = OpLoad %uint %238 |
| OpStore %i0 %239 |
| %241 = OpLoad %uint %triangleIndex |
| %242 = OpIMul %uint %uint_3 %241 |
| %243 = OpIAdd %uint %242 %uint_1 |
| %244 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %243 |
| %245 = OpLoad %uint %244 |
| OpStore %i1 %245 |
| %247 = OpLoad %uint %triangleIndex |
| %248 = OpIMul %uint %uint_3 %247 |
| %249 = OpIAdd %uint %248 %uint_2 |
| %250 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %249 |
| %251 = OpLoad %uint %250 |
| OpStore %i2 %251 |
| %254 = OpLoad %uint %i0 |
| %253 = OpFunctionCall %v3float %loadPosition %254 |
| OpStore %p0 %253 |
| %257 = OpLoad %uint %i1 |
| %256 = OpFunctionCall %v3float %loadPosition %257 |
| OpStore %p1 %256 |
| %260 = OpLoad %uint %i2 |
| %259 = OpFunctionCall %v3float %loadPosition %260 |
| OpStore %p2 %259 |
| %262 = OpLoad %v3float %p0 |
| %263 = OpLoad %v3float %p1 |
| %264 = OpFAdd %v3float %262 %263 |
| %265 = OpLoad %v3float %p2 |
| %266 = OpFAdd %v3float %264 %265 |
| %270 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 |
| %268 = OpFDiv %v3float %266 %270 |
| OpStore %center %268 |
| %273 = OpLoad %v3float %center |
| %272 = OpFunctionCall %v3float %toVoxelPos %273 |
| OpStore %voxelPos_0 %272 |
| %276 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 |
| %277 = OpLoad %uint %276 |
| %278 = OpLoad %v3float %voxelPos_0 |
| %275 = OpFunctionCall %uint %toIndex1D %277 %278 |
| OpStore %voxelIndex %275 |
| %282 = OpLoad %uint %voxelIndex |
| %283 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %282 |
| %280 = OpAtomicIAdd %uint %283 %uint_1 %uint_0 %uint_1 |
| OpStore %acefg %280 |
| %285 = OpLoad %uint %triangleIndex |
| %286 = OpIEqual %bool %285 %141 |
| OpSelectionMerge %287 None |
| OpBranchConditional %286 %288 %287 |
| %288 = OpLabel |
| %289 = OpAccessChain %_ptr_StorageBuffer_uint %dbg %uint_0 %uint_4 |
| %290 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 |
| %291 = OpLoad %uint %290 |
| OpStore %289 %291 |
| %293 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_0 %uint_8 |
| %294 = OpAccessChain %_ptr_Function_float %center %uint_0 |
| %295 = OpLoad %float %294 |
| OpStore %293 %295 |
| %297 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_0 %uint_9 |
| %298 = OpAccessChain %_ptr_Function_float %center %uint_1 |
| %299 = OpLoad %float %298 |
| OpStore %297 %299 |
| %301 = OpAccessChain %_ptr_StorageBuffer_float %dbg %uint_0 %uint_10 |
| %302 = OpAccessChain %_ptr_Function_float %center %uint_2 |
| %303 = OpLoad %float %302 |
| OpStore %301 %303 |
| OpBranch %287 |
| %287 = OpLabel |
| OpReturn |
| OpFunctionEnd |
| %main_count = OpFunction %void None %193 |
| %305 = OpLabel |
| %307 = OpLoad %v3uint %GlobalInvocationID_1 |
| %306 = OpFunctionCall %void %main_count_inner %307 |
| OpReturn |
| OpFunctionEnd |
| %main_create_lut_inner = OpFunction %void None %222 |
| %GlobalInvocationID_0 = OpFunctionParameter %v3uint |
| %310 = 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 %206 |
| %311 = OpCompositeExtract %uint %GlobalInvocationID_0 0 |
| OpStore %voxelIndex_0 %311 |
| %313 = OpFunctionCall %void %doIgnore |
| %314 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 |
| %315 = OpLoad %uint %314 |
| %316 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 |
| %317 = OpLoad %uint %316 |
| %318 = OpIMul %uint %315 %317 |
| %319 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 |
| %320 = OpLoad %uint %319 |
| %321 = OpIMul %uint %318 %320 |
| OpStore %maxVoxels %321 |
| %323 = OpLoad %uint %voxelIndex_0 |
| %324 = OpLoad %uint %maxVoxels |
| %325 = OpUGreaterThanEqual %bool %323 %324 |
| OpSelectionMerge %326 None |
| OpBranchConditional %325 %327 %326 |
| %327 = OpLabel |
| OpReturn |
| %326 = OpLabel |
| %330 = OpLoad %uint %voxelIndex_0 |
| %331 = OpAccessChain %_ptr_StorageBuffer_uint_0 %counters %uint_0 %330 |
| %328 = OpAtomicLoad %uint %331 %uint_1 %uint_0 |
| OpStore %numTriangles %328 |
| OpStore %offset %int_n1 |
| %335 = OpLoad %uint %numTriangles |
| %336 = OpUGreaterThan %bool %335 %141 |
| OpSelectionMerge %337 None |
| OpBranchConditional %336 %338 %337 |
| %338 = OpLabel |
| %341 = OpAccessChain %_ptr_StorageBuffer_uint_0 %dbg %uint_0 %uint_0 |
| %342 = OpLoad %uint %numTriangles |
| %339 = OpAtomicIAdd %uint %341 %uint_1 %uint_0 %342 |
| %343 = OpBitcast %int %339 |
| OpStore %offset %343 |
| OpBranch %337 |
| %337 = OpLabel |
| %346 = OpLoad %uint %voxelIndex_0 |
| %347 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %346 |
| %348 = OpLoad %int %offset |
| OpAtomicStore %347 %uint_1 %uint_0 %348 |
| OpReturn |
| OpFunctionEnd |
| %main_create_lut = OpFunction %void None %193 |
| %350 = OpLabel |
| %352 = OpLoad %v3uint %GlobalInvocationID_2 |
| %351 = OpFunctionCall %void %main_create_lut_inner %352 |
| OpReturn |
| OpFunctionEnd |
| %main_sort_triangles_inner = OpFunction %void None %222 |
| %GlobalInvocationID_4 = OpFunctionParameter %v3uint |
| %355 = 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 %52 |
| %p1_0 = OpVariable %_ptr_Function_v3float Function %52 |
| %p2_0 = OpVariable %_ptr_Function_v3float Function %52 |
| %398 = 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 %141 |
| %triangleOffset = OpVariable %_ptr_Function_int Function %206 |
| %356 = OpCompositeExtract %uint %GlobalInvocationID_4 0 |
| OpStore %triangleIndex_0 %356 |
| %358 = OpFunctionCall %void %doIgnore |
| %359 = OpLoad %uint %triangleIndex_0 |
| %360 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_0 |
| %361 = OpLoad %uint %360 |
| %362 = OpUGreaterThanEqual %bool %359 %361 |
| OpSelectionMerge %363 None |
| OpBranchConditional %362 %364 %363 |
| %364 = OpLabel |
| OpReturn |
| %363 = OpLabel |
| %365 = OpLoad %uint %triangleIndex_0 |
| %366 = OpIMul %uint %uint_3 %365 |
| %367 = OpIAdd %uint %366 %141 |
| %368 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %367 |
| %369 = OpLoad %uint %368 |
| OpStore %i0_0 %369 |
| %371 = OpLoad %uint %triangleIndex_0 |
| %372 = OpIMul %uint %uint_3 %371 |
| %373 = OpIAdd %uint %372 %uint_1 |
| %374 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %373 |
| %375 = OpLoad %uint %374 |
| OpStore %i1_0 %375 |
| %377 = OpLoad %uint %triangleIndex_0 |
| %378 = OpIMul %uint %uint_3 %377 |
| %379 = OpIAdd %uint %378 %uint_2 |
| %380 = OpAccessChain %_ptr_StorageBuffer_uint %indices %uint_0 %379 |
| %381 = OpLoad %uint %380 |
| OpStore %i2_0 %381 |
| %384 = OpLoad %uint %i0_0 |
| %383 = OpFunctionCall %v3float %loadPosition %384 |
| OpStore %p0_0 %383 |
| %387 = OpLoad %uint %i1_0 |
| %386 = OpFunctionCall %v3float %loadPosition %387 |
| OpStore %p1_0 %386 |
| %390 = OpLoad %uint %i2_0 |
| %389 = OpFunctionCall %v3float %loadPosition %390 |
| OpStore %p2_0 %389 |
| %392 = OpLoad %v3float %p0_0 |
| %393 = OpLoad %v3float %p1_0 |
| %394 = OpFAdd %v3float %392 %393 |
| %395 = OpLoad %v3float %p2_0 |
| %396 = OpFAdd %v3float %394 %395 |
| %399 = OpCompositeConstruct %v3float %float_3 %float_3 %float_3 |
| %397 = OpFDiv %v3float %396 %399 |
| OpStore %center_0 %397 |
| %402 = OpLoad %v3float %center_0 |
| %401 = OpFunctionCall %v3float %toVoxelPos %402 |
| OpStore %voxelPos_1 %401 |
| %405 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_0 %uint_1 |
| %406 = OpLoad %uint %405 |
| %407 = OpLoad %v3float %voxelPos_1 |
| %404 = OpFunctionCall %uint %toIndex1D %406 %407 |
| OpStore %voxelIndex_1 %404 |
| %411 = OpLoad %uint %voxelIndex_1 |
| %412 = OpAccessChain %_ptr_StorageBuffer_int %LUT %uint_0 %411 |
| %409 = OpAtomicIAdd %int %412 %uint_1 %uint_0 %int_1 |
| OpStore %triangleOffset %409 |
| OpReturn |
| OpFunctionEnd |
| %main_sort_triangles = OpFunction %void None %193 |
| %416 = OpLabel |
| %418 = OpLoad %v3uint %GlobalInvocationID_3 |
| %417 = OpFunctionCall %void %main_sort_triangles_inner %418 |
| OpReturn |
| OpFunctionEnd |