| ; SPIR-V | |
| ; Version: 1.3 | |
| ; Generator: Google Tint Compiler; 0 | |
| ; Bound: 279 | |
| ; Schema: 0 | |
| OpCapability Shader | |
| %39 = OpExtInstImport "GLSL.std.450" | |
| OpMemoryModel Logical GLSL450 | |
| OpEntryPoint Vertex %vert_main "vert_main" %a_particlePos_1 %a_particleVel_1 %a_pos_1 %value %vertex_point_size | |
| OpEntryPoint Fragment %frag_main "frag_main" %value_1 | |
| OpEntryPoint GLCompute %comp_main "comp_main" %gl_GlobalInvocationID_1 | |
| OpExecutionMode %frag_main OriginUpperLeft | |
| OpExecutionMode %comp_main LocalSize 1 1 1 | |
| OpName %a_particlePos_1 "a_particlePos_1" | |
| OpName %a_particleVel_1 "a_particleVel_1" | |
| OpName %a_pos_1 "a_pos_1" | |
| OpName %value "value" | |
| OpName %vertex_point_size "vertex_point_size" | |
| OpName %value_1 "value_1" | |
| OpName %gl_GlobalInvocationID_1 "gl_GlobalInvocationID_1" | |
| OpName %params_block "params_block" | |
| OpMemberName %params_block 0 "inner" | |
| OpName %SimParams "SimParams" | |
| OpMemberName %SimParams 0 "deltaT" | |
| OpMemberName %SimParams 1 "rule1Distance" | |
| OpMemberName %SimParams 2 "rule2Distance" | |
| OpMemberName %SimParams 3 "rule3Distance" | |
| OpMemberName %SimParams 4 "rule1Scale" | |
| OpMemberName %SimParams 5 "rule2Scale" | |
| OpMemberName %SimParams 6 "rule3Scale" | |
| OpName %params "params" | |
| OpName %particlesA_block "particlesA_block" | |
| OpMemberName %particlesA_block 0 "inner" | |
| OpName %Particles "Particles" | |
| OpMemberName %Particles 0 "particles" | |
| OpName %Particle "Particle" | |
| OpMemberName %Particle 0 "pos" | |
| OpMemberName %Particle 1 "vel" | |
| OpName %particlesA "particlesA" | |
| OpName %particlesB "particlesB" | |
| OpName %vert_main_inner "vert_main_inner" | |
| OpName %a_particlePos "a_particlePos" | |
| OpName %a_particleVel "a_particleVel" | |
| OpName %a_pos "a_pos" | |
| OpName %angle "angle" | |
| OpName %pos "pos" | |
| OpName %vert_main "vert_main" | |
| OpName %frag_main_inner "frag_main_inner" | |
| OpName %frag_main "frag_main" | |
| OpName %comp_main_inner "comp_main_inner" | |
| OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" | |
| OpName %index "index" | |
| OpName %vPos "vPos" | |
| OpName %vVel "vVel" | |
| OpName %cMass "cMass" | |
| OpName %cVel "cVel" | |
| OpName %colVel "colVel" | |
| OpName %cMassCount "cMassCount" | |
| OpName %cVelCount "cVelCount" | |
| OpName %pos_0 "pos" | |
| OpName %vel "vel" | |
| OpName %i "i" | |
| OpName %comp_main "comp_main" | |
| OpDecorate %a_particlePos_1 Location 0 | |
| OpDecorate %a_particleVel_1 Location 1 | |
| OpDecorate %a_pos_1 Location 2 | |
| OpDecorate %value BuiltIn Position | |
| OpDecorate %vertex_point_size BuiltIn PointSize | |
| OpDecorate %value_1 Location 0 | |
| OpDecorate %gl_GlobalInvocationID_1 BuiltIn GlobalInvocationId | |
| OpDecorate %params_block Block | |
| OpMemberDecorate %params_block 0 Offset 0 | |
| OpMemberDecorate %SimParams 0 Offset 0 | |
| OpMemberDecorate %SimParams 1 Offset 4 | |
| OpMemberDecorate %SimParams 2 Offset 8 | |
| OpMemberDecorate %SimParams 3 Offset 12 | |
| OpMemberDecorate %SimParams 4 Offset 16 | |
| OpMemberDecorate %SimParams 5 Offset 20 | |
| OpMemberDecorate %SimParams 6 Offset 24 | |
| OpDecorate %params NonWritable | |
| OpDecorate %params Binding 0 | |
| OpDecorate %params DescriptorSet 0 | |
| OpDecorate %particlesA_block Block | |
| OpMemberDecorate %particlesA_block 0 Offset 0 | |
| OpMemberDecorate %Particles 0 Offset 0 | |
| OpMemberDecorate %Particle 0 Offset 0 | |
| OpMemberDecorate %Particle 1 Offset 8 | |
| OpDecorate %_arr_Particle_uint_5 ArrayStride 16 | |
| OpDecorate %particlesA Binding 1 | |
| OpDecorate %particlesA DescriptorSet 0 | |
| OpDecorate %particlesB Binding 2 | |
| OpDecorate %particlesB DescriptorSet 0 | |
| %float = OpTypeFloat 32 | |
| %v2float = OpTypeVector %float 2 | |
| %_ptr_Input_v2float = OpTypePointer Input %v2float | |
| %a_particlePos_1 = OpVariable %_ptr_Input_v2float Input | |
| %a_particleVel_1 = OpVariable %_ptr_Input_v2float Input | |
| %a_pos_1 = OpVariable %_ptr_Input_v2float Input | |
| %v4float = OpTypeVector %float 4 | |
| %_ptr_Output_v4float = OpTypePointer Output %v4float | |
| %10 = OpConstantNull %v4float | |
| %value = OpVariable %_ptr_Output_v4float Output %10 | |
| %_ptr_Output_float = OpTypePointer Output %float | |
| %13 = OpConstantNull %float | |
| %vertex_point_size = OpVariable %_ptr_Output_float Output %13 | |
| %value_1 = OpVariable %_ptr_Output_v4float Output %10 | |
| %uint = OpTypeInt 32 0 | |
| %v3uint = OpTypeVector %uint 3 | |
| %_ptr_Input_v3uint = OpTypePointer Input %v3uint | |
| %gl_GlobalInvocationID_1 = OpVariable %_ptr_Input_v3uint Input | |
| %SimParams = OpTypeStruct %float %float %float %float %float %float %float | |
| %params_block = OpTypeStruct %SimParams | |
| %_ptr_Uniform_params_block = OpTypePointer Uniform %params_block | |
| %params = OpVariable %_ptr_Uniform_params_block Uniform | |
| %Particle = OpTypeStruct %v2float %v2float | |
| %uint_5 = OpConstant %uint 5 | |
| %_arr_Particle_uint_5 = OpTypeArray %Particle %uint_5 | |
| %Particles = OpTypeStruct %_arr_Particle_uint_5 | |
| %particlesA_block = OpTypeStruct %Particles | |
| %_ptr_StorageBuffer_particlesA_block = OpTypePointer StorageBuffer %particlesA_block | |
| %particlesA = OpVariable %_ptr_StorageBuffer_particlesA_block StorageBuffer | |
| %particlesB = OpVariable %_ptr_StorageBuffer_particlesA_block StorageBuffer | |
| %31 = OpTypeFunction %v4float %v2float %v2float %v2float | |
| %_ptr_Function_float = OpTypePointer Function %float | |
| %_ptr_Function_v2float = OpTypePointer Function %v2float | |
| %65 = OpConstantNull %v2float | |
| %float_1 = OpConstant %float 1 | |
| %void = OpTypeVoid | |
| %72 = OpTypeFunction %void | |
| %80 = OpTypeFunction %v4float | |
| %83 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 | |
| %87 = OpTypeFunction %void %v3uint | |
| %_ptr_Function_uint = OpTypePointer Function %uint | |
| %94 = OpConstantNull %uint | |
| %bool = OpTypeBool | |
| %uint_0 = OpConstant %uint 0 | |
| %_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float | |
| %uint_1 = OpConstant %uint 1 | |
| %int = OpTypeInt 32 1 | |
| %115 = OpConstantNull %int | |
| %_ptr_Function_int = OpTypePointer Function %int | |
| %_ptr_Uniform_float = OpTypePointer Uniform %float | |
| %int_1 = OpConstant %int 1 | |
| %uint_2 = OpConstant %uint 2 | |
| %uint_3 = OpConstant %uint 3 | |
| %uint_4 = OpConstant %uint 4 | |
| %uint_6 = OpConstant %uint 6 | |
| %float_0_100000001 = OpConstant %float 0.100000001 | |
| %float_n1 = OpConstant %float -1 | |
| %vert_main_inner = OpFunction %v4float None %31 | |
| %a_particlePos = OpFunctionParameter %v2float | |
| %a_particleVel = OpFunctionParameter %v2float | |
| %a_pos = OpFunctionParameter %v2float | |
| %36 = OpLabel | |
| %angle = OpVariable %_ptr_Function_float Function %13 | |
| %pos = OpVariable %_ptr_Function_v2float Function %65 | |
| %40 = OpCompositeExtract %float %a_particleVel 0 | |
| %41 = OpCompositeExtract %float %a_particleVel 1 | |
| %38 = OpExtInst %float %39 Atan2 %40 %41 | |
| %37 = OpFNegate %float %38 | |
| OpStore %angle %37 | |
| %44 = OpCompositeExtract %float %a_pos 0 | |
| %46 = OpLoad %float %angle | |
| %45 = OpExtInst %float %39 Cos %46 | |
| %47 = OpFMul %float %44 %45 | |
| %48 = OpCompositeExtract %float %a_pos 1 | |
| %50 = OpLoad %float %angle | |
| %49 = OpExtInst %float %39 Sin %50 | |
| %51 = OpFMul %float %48 %49 | |
| %52 = OpFSub %float %47 %51 | |
| %53 = OpCompositeExtract %float %a_pos 0 | |
| %55 = OpLoad %float %angle | |
| %54 = OpExtInst %float %39 Sin %55 | |
| %56 = OpFMul %float %53 %54 | |
| %57 = OpCompositeExtract %float %a_pos 1 | |
| %59 = OpLoad %float %angle | |
| %58 = OpExtInst %float %39 Cos %59 | |
| %60 = OpFMul %float %57 %58 | |
| %61 = OpFAdd %float %56 %60 | |
| %62 = OpCompositeConstruct %v2float %52 %61 | |
| OpStore %pos %62 | |
| %66 = OpLoad %v2float %pos | |
| %67 = OpFAdd %v2float %66 %a_particlePos | |
| %68 = OpCompositeExtract %float %67 0 | |
| %69 = OpCompositeExtract %float %67 1 | |
| %71 = OpCompositeConstruct %v4float %68 %69 %13 %float_1 | |
| OpReturnValue %71 | |
| OpFunctionEnd | |
| %vert_main = OpFunction %void None %72 | |
| %75 = OpLabel | |
| %77 = OpLoad %v2float %a_particlePos_1 | |
| %78 = OpLoad %v2float %a_particleVel_1 | |
| %79 = OpLoad %v2float %a_pos_1 | |
| %76 = OpFunctionCall %v4float %vert_main_inner %77 %78 %79 | |
| OpStore %value %76 | |
| OpStore %vertex_point_size %float_1 | |
| OpReturn | |
| OpFunctionEnd | |
| %frag_main_inner = OpFunction %v4float None %80 | |
| %82 = OpLabel | |
| OpReturnValue %83 | |
| OpFunctionEnd | |
| %frag_main = OpFunction %void None %72 | |
| %85 = OpLabel | |
| %86 = OpFunctionCall %v4float %frag_main_inner | |
| OpStore %value_1 %86 | |
| OpReturn | |
| OpFunctionEnd | |
| %comp_main_inner = OpFunction %void None %87 | |
| %gl_GlobalInvocationID = OpFunctionParameter %v3uint | |
| %90 = OpLabel | |
| %index = OpVariable %_ptr_Function_uint Function %94 | |
| %vPos = OpVariable %_ptr_Function_v2float Function %65 | |
| %vVel = OpVariable %_ptr_Function_v2float Function %65 | |
| %cMass = OpVariable %_ptr_Function_v2float Function %65 | |
| %cVel = OpVariable %_ptr_Function_v2float Function %65 | |
| %colVel = OpVariable %_ptr_Function_v2float Function %65 | |
| %cMassCount = OpVariable %_ptr_Function_int Function %115 | |
| %cVelCount = OpVariable %_ptr_Function_int Function %115 | |
| %pos_0 = OpVariable %_ptr_Function_v2float Function %65 | |
| %vel = OpVariable %_ptr_Function_v2float Function %65 | |
| %i = OpVariable %_ptr_Function_uint Function %94 | |
| %91 = OpCompositeExtract %uint %gl_GlobalInvocationID 0 | |
| OpStore %index %91 | |
| %95 = OpLoad %uint %index | |
| %96 = OpUGreaterThanEqual %bool %95 %uint_5 | |
| OpSelectionMerge %98 None | |
| OpBranchConditional %96 %99 %98 | |
| %99 = OpLabel | |
| OpReturn | |
| %98 = OpLabel | |
| %101 = OpLoad %uint %index | |
| %103 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %uint_0 %101 %uint_0 | |
| %104 = OpLoad %v2float %103 | |
| OpStore %vPos %104 | |
| %106 = OpLoad %uint %index | |
| %108 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %uint_0 %106 %uint_1 | |
| %109 = OpLoad %v2float %108 | |
| OpStore %vVel %109 | |
| OpStore %cMass %65 | |
| OpStore %cVel %65 | |
| OpStore %colVel %65 | |
| OpStore %cMassCount %115 | |
| OpStore %cVelCount %115 | |
| OpStore %i %94 | |
| OpBranch %122 | |
| %122 = OpLabel | |
| OpLoopMerge %123 %124 None | |
| OpBranch %125 | |
| %125 = OpLabel | |
| %127 = OpLoad %uint %i | |
| %128 = OpULessThan %bool %127 %uint_5 | |
| %126 = OpLogicalNot %bool %128 | |
| OpSelectionMerge %129 None | |
| OpBranchConditional %126 %130 %129 | |
| %130 = OpLabel | |
| OpBranch %123 | |
| %129 = OpLabel | |
| %131 = OpLoad %uint %i | |
| %132 = OpLoad %uint %index | |
| %133 = OpIEqual %bool %131 %132 | |
| OpSelectionMerge %134 None | |
| OpBranchConditional %133 %135 %134 | |
| %135 = OpLabel | |
| OpBranch %124 | |
| %134 = OpLabel | |
| %136 = OpLoad %uint %i | |
| %137 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %uint_0 %136 %uint_0 | |
| %138 = OpLoad %v2float %137 | |
| %139 = OpVectorShuffle %v2float %138 %138 0 1 | |
| OpStore %pos_0 %139 | |
| %140 = OpLoad %uint %i | |
| %141 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesA %uint_0 %uint_0 %140 %uint_1 | |
| %142 = OpLoad %v2float %141 | |
| %143 = OpVectorShuffle %v2float %142 %142 0 1 | |
| OpStore %vel %143 | |
| %145 = OpLoad %v2float %pos_0 | |
| %146 = OpLoad %v2float %vPos | |
| %144 = OpExtInst %float %39 Distance %145 %146 | |
| %148 = OpAccessChain %_ptr_Uniform_float %params %uint_0 %uint_1 | |
| %149 = OpLoad %float %148 | |
| %150 = OpFOrdLessThan %bool %144 %149 | |
| OpSelectionMerge %151 None | |
| OpBranchConditional %150 %152 %151 | |
| %152 = OpLabel | |
| %153 = OpLoad %v2float %cMass | |
| %154 = OpLoad %v2float %pos_0 | |
| %155 = OpFAdd %v2float %153 %154 | |
| OpStore %cMass %155 | |
| %156 = OpLoad %int %cMassCount | |
| %158 = OpIAdd %int %156 %int_1 | |
| OpStore %cMassCount %158 | |
| OpBranch %151 | |
| %151 = OpLabel | |
| %160 = OpLoad %v2float %pos_0 | |
| %161 = OpLoad %v2float %vPos | |
| %159 = OpExtInst %float %39 Distance %160 %161 | |
| %163 = OpAccessChain %_ptr_Uniform_float %params %uint_0 %uint_2 | |
| %164 = OpLoad %float %163 | |
| %165 = OpFOrdLessThan %bool %159 %164 | |
| OpSelectionMerge %166 None | |
| OpBranchConditional %165 %167 %166 | |
| %167 = OpLabel | |
| %168 = OpLoad %v2float %colVel | |
| %169 = OpLoad %v2float %pos_0 | |
| %170 = OpLoad %v2float %vPos | |
| %171 = OpFSub %v2float %169 %170 | |
| %172 = OpFSub %v2float %168 %171 | |
| OpStore %colVel %172 | |
| OpBranch %166 | |
| %166 = OpLabel | |
| %174 = OpLoad %v2float %pos_0 | |
| %175 = OpLoad %v2float %vPos | |
| %173 = OpExtInst %float %39 Distance %174 %175 | |
| %177 = OpAccessChain %_ptr_Uniform_float %params %uint_0 %uint_3 | |
| %178 = OpLoad %float %177 | |
| %179 = OpFOrdLessThan %bool %173 %178 | |
| OpSelectionMerge %180 None | |
| OpBranchConditional %179 %181 %180 | |
| %181 = OpLabel | |
| %182 = OpLoad %v2float %cVel | |
| %183 = OpLoad %v2float %vel | |
| %184 = OpFAdd %v2float %182 %183 | |
| OpStore %cVel %184 | |
| %185 = OpLoad %int %cVelCount | |
| %186 = OpIAdd %int %185 %int_1 | |
| OpStore %cVelCount %186 | |
| OpBranch %180 | |
| %180 = OpLabel | |
| OpBranch %124 | |
| %124 = OpLabel | |
| %187 = OpLoad %uint %i | |
| %188 = OpIAdd %uint %187 %uint_1 | |
| OpStore %i %188 | |
| OpBranch %122 | |
| %123 = OpLabel | |
| %189 = OpLoad %int %cMassCount | |
| %190 = OpSGreaterThan %bool %189 %115 | |
| OpSelectionMerge %191 None | |
| OpBranchConditional %190 %192 %191 | |
| %192 = OpLabel | |
| %193 = OpLoad %v2float %cMass | |
| %195 = OpLoad %int %cMassCount | |
| %194 = OpConvertSToF %float %195 | |
| %197 = OpLoad %int %cMassCount | |
| %196 = OpConvertSToF %float %197 | |
| %198 = OpCompositeConstruct %v2float %194 %196 | |
| %199 = OpFDiv %v2float %193 %198 | |
| %200 = OpLoad %v2float %vPos | |
| %201 = OpFSub %v2float %199 %200 | |
| OpStore %cMass %201 | |
| OpBranch %191 | |
| %191 = OpLabel | |
| %202 = OpLoad %int %cVelCount | |
| %203 = OpSGreaterThan %bool %202 %115 | |
| OpSelectionMerge %204 None | |
| OpBranchConditional %203 %205 %204 | |
| %205 = OpLabel | |
| %206 = OpLoad %v2float %cVel | |
| %208 = OpLoad %int %cVelCount | |
| %207 = OpConvertSToF %float %208 | |
| %210 = OpLoad %int %cVelCount | |
| %209 = OpConvertSToF %float %210 | |
| %211 = OpCompositeConstruct %v2float %207 %209 | |
| %212 = OpFDiv %v2float %206 %211 | |
| OpStore %cVel %212 | |
| OpBranch %204 | |
| %204 = OpLabel | |
| %213 = OpLoad %v2float %vVel | |
| %214 = OpLoad %v2float %cMass | |
| %216 = OpAccessChain %_ptr_Uniform_float %params %uint_0 %uint_4 | |
| %217 = OpLoad %float %216 | |
| %218 = OpVectorTimesScalar %v2float %214 %217 | |
| %219 = OpFAdd %v2float %213 %218 | |
| %220 = OpLoad %v2float %colVel | |
| %221 = OpAccessChain %_ptr_Uniform_float %params %uint_0 %uint_5 | |
| %222 = OpLoad %float %221 | |
| %223 = OpVectorTimesScalar %v2float %220 %222 | |
| %224 = OpFAdd %v2float %219 %223 | |
| %225 = OpLoad %v2float %cVel | |
| %227 = OpAccessChain %_ptr_Uniform_float %params %uint_0 %uint_6 | |
| %228 = OpLoad %float %227 | |
| %229 = OpVectorTimesScalar %v2float %225 %228 | |
| %230 = OpFAdd %v2float %224 %229 | |
| OpStore %vVel %230 | |
| %232 = OpLoad %v2float %vVel | |
| %231 = OpExtInst %v2float %39 Normalize %232 | |
| %235 = OpLoad %v2float %vVel | |
| %234 = OpExtInst %float %39 Length %235 | |
| %233 = OpExtInst %float %39 NClamp %234 %13 %float_0_100000001 | |
| %237 = OpVectorTimesScalar %v2float %231 %233 | |
| OpStore %vVel %237 | |
| %238 = OpLoad %v2float %vPos | |
| %239 = OpLoad %v2float %vVel | |
| %240 = OpAccessChain %_ptr_Uniform_float %params %uint_0 %uint_0 | |
| %241 = OpLoad %float %240 | |
| %242 = OpVectorTimesScalar %v2float %239 %241 | |
| %243 = OpFAdd %v2float %238 %242 | |
| OpStore %vPos %243 | |
| %244 = OpAccessChain %_ptr_Function_float %vPos %uint_0 | |
| %245 = OpLoad %float %244 | |
| %247 = OpFOrdLessThan %bool %245 %float_n1 | |
| OpSelectionMerge %248 None | |
| OpBranchConditional %247 %249 %248 | |
| %249 = OpLabel | |
| %250 = OpAccessChain %_ptr_Function_float %vPos %uint_0 | |
| OpStore %250 %float_1 | |
| OpBranch %248 | |
| %248 = OpLabel | |
| %251 = OpAccessChain %_ptr_Function_float %vPos %uint_0 | |
| %252 = OpLoad %float %251 | |
| %253 = OpFOrdGreaterThan %bool %252 %float_1 | |
| OpSelectionMerge %254 None | |
| OpBranchConditional %253 %255 %254 | |
| %255 = OpLabel | |
| %256 = OpAccessChain %_ptr_Function_float %vPos %uint_0 | |
| OpStore %256 %float_n1 | |
| OpBranch %254 | |
| %254 = OpLabel | |
| %257 = OpAccessChain %_ptr_Function_float %vPos %uint_1 | |
| %258 = OpLoad %float %257 | |
| %259 = OpFOrdLessThan %bool %258 %float_n1 | |
| OpSelectionMerge %260 None | |
| OpBranchConditional %259 %261 %260 | |
| %261 = OpLabel | |
| %262 = OpAccessChain %_ptr_Function_float %vPos %uint_1 | |
| OpStore %262 %float_1 | |
| OpBranch %260 | |
| %260 = OpLabel | |
| %263 = OpAccessChain %_ptr_Function_float %vPos %uint_1 | |
| %264 = OpLoad %float %263 | |
| %265 = OpFOrdGreaterThan %bool %264 %float_1 | |
| OpSelectionMerge %266 None | |
| OpBranchConditional %265 %267 %266 | |
| %267 = OpLabel | |
| %268 = OpAccessChain %_ptr_Function_float %vPos %uint_1 | |
| OpStore %268 %float_n1 | |
| OpBranch %266 | |
| %266 = OpLabel | |
| %269 = OpLoad %uint %index | |
| %270 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesB %uint_0 %uint_0 %269 %uint_0 | |
| %271 = OpLoad %v2float %vPos | |
| OpStore %270 %271 | |
| %272 = OpLoad %uint %index | |
| %273 = OpAccessChain %_ptr_StorageBuffer_v2float %particlesB %uint_0 %uint_0 %272 %uint_1 | |
| %274 = OpLoad %v2float %vVel | |
| OpStore %273 %274 | |
| OpReturn | |
| OpFunctionEnd | |
| %comp_main = OpFunction %void None %72 | |
| %276 = OpLabel | |
| %278 = OpLoad %v3uint %gl_GlobalInvocationID_1 | |
| %277 = OpFunctionCall %void %comp_main_inner %278 | |
| OpReturn | |
| OpFunctionEnd |