blob: dbea510733e7e527f537fbcd05b973513906a3ed [file] [log] [blame]
;
; vert_main
;
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
; Bound: 59
; Schema: 0
OpCapability Shader
%21 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vert_main "vert_main" %vert_main_loc0_Input %vert_main_loc1_Input %vert_main_loc2_Input %vert_main_position_Output %vert_main___point_size_Output
OpName %vert_main_loc0_Input "vert_main_loc0_Input"
OpName %vert_main_loc1_Input "vert_main_loc1_Input"
OpName %vert_main_loc2_Input "vert_main_loc2_Input"
OpName %vert_main_position_Output "vert_main_position_Output"
OpName %vert_main___point_size_Output "vert_main___point_size_Output"
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"
OpDecorate %vert_main_loc0_Input Location 0
OpDecorate %vert_main_loc1_Input Location 1
OpDecorate %vert_main_loc2_Input Location 2
OpDecorate %vert_main_position_Output BuiltIn Position
OpDecorate %vert_main___point_size_Output BuiltIn PointSize
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%_ptr_Input_v2float = OpTypePointer Input %v2float
%vert_main_loc0_Input = OpVariable %_ptr_Input_v2float Input
%vert_main_loc1_Input = OpVariable %_ptr_Input_v2float Input
%vert_main_loc2_Input = OpVariable %_ptr_Input_v2float Input
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%vert_main_position_Output = OpVariable %_ptr_Output_v4float Output
%_ptr_Output_float = OpTypePointer Output %float
%vert_main___point_size_Output = OpVariable %_ptr_Output_float Output
%16 = OpTypeFunction %v4float %v2float %v2float %v2float
%_ptr_Function_float = OpTypePointer Function %float
%_ptr_Function_v2float = OpTypePointer Function %v2float
%float_0 = OpConstant %float 0
%float_1 = OpConstant %float 1
%void = OpTypeVoid
%53 = OpTypeFunction %void
%vert_main_inner = OpFunction %v4float None %16
%a_particlePos = OpFunctionParameter %v2float
%a_particleVel = OpFunctionParameter %v2float
%a_pos = OpFunctionParameter %v2float
%17 = OpLabel
%angle = OpVariable %_ptr_Function_float Function
%pos = OpVariable %_ptr_Function_v2float Function
%18 = OpCompositeExtract %float %a_particleVel 0
%19 = OpCompositeExtract %float %a_particleVel 1
%20 = OpExtInst %float %21 Atan2 %18 %19
%22 = OpFNegate %float %20
OpStore %angle %22
%25 = OpCompositeExtract %float %a_pos 0
%26 = OpLoad %float %angle None
%27 = OpExtInst %float %21 Cos %26
%28 = OpFMul %float %25 %27
%29 = OpCompositeExtract %float %a_pos 1
%30 = OpLoad %float %angle None
%31 = OpExtInst %float %21 Sin %30
%32 = OpFMul %float %29 %31
%33 = OpFSub %float %28 %32
%34 = OpCompositeExtract %float %a_pos 0
%35 = OpLoad %float %angle None
%36 = OpExtInst %float %21 Sin %35
%37 = OpFMul %float %34 %36
%38 = OpCompositeExtract %float %a_pos 1
%39 = OpLoad %float %angle None
%40 = OpExtInst %float %21 Cos %39
%41 = OpFMul %float %38 %40
%42 = OpFAdd %float %37 %41
%43 = OpCompositeConstruct %v2float %33 %42
OpStore %pos %43
%46 = OpLoad %v2float %pos None
%47 = OpFAdd %v2float %46 %a_particlePos
%48 = OpCompositeConstruct %v4float %47 %float_0 %float_1
OpReturnValue %48
OpFunctionEnd
%vert_main = OpFunction %void None %53
%54 = OpLabel
%55 = OpLoad %v2float %vert_main_loc0_Input None
%56 = OpLoad %v2float %vert_main_loc1_Input None
%57 = OpLoad %v2float %vert_main_loc2_Input None
%58 = OpFunctionCall %v4float %vert_main_inner %55 %56 %57
OpStore %vert_main_position_Output %58 None
OpStore %vert_main___point_size_Output %float_1 None
OpReturn
OpFunctionEnd
;
; frag_main
;
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
; Bound: 15
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %frag_main "frag_main" %frag_main_loc0_Output
OpExecutionMode %frag_main OriginUpperLeft
OpName %frag_main_loc0_Output "frag_main_loc0_Output"
OpName %frag_main_inner "frag_main_inner"
OpName %frag_main "frag_main"
OpDecorate %frag_main_loc0_Output Location 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%frag_main_loc0_Output = OpVariable %_ptr_Output_v4float Output
%6 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%8 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%void = OpTypeVoid
%12 = OpTypeFunction %void
%frag_main_inner = OpFunction %v4float None %6
%7 = OpLabel
OpReturnValue %8
OpFunctionEnd
%frag_main = OpFunction %void None %12
%13 = OpLabel
%14 = OpFunctionCall %v4float %frag_main_inner
OpStore %frag_main_loc0_Output %14 None
OpReturn
OpFunctionEnd
;
; comp_main
;
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
; Bound: 226
; Schema: 0
OpCapability Shader
%36 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %comp_main "comp_main" %comp_main_global_invocation_id_Input
OpExecutionMode %comp_main LocalSize 1 1 1
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 %SimParams "SimParams"
OpMemberName %params_block 0 "inner"
OpName %params_block "params_block"
OpMemberName %Particle 0 "pos"
OpMemberName %Particle 1 "vel"
OpName %Particle "Particle"
OpMemberName %Particles_tint_explicit_layout 0 "particles"
OpName %Particles_tint_explicit_layout "Particles_tint_explicit_layout"
OpMemberName %particlesA_block_tint_explicit_layout 0 "inner"
OpName %particlesA_block_tint_explicit_layout "particlesA_block_tint_explicit_layout"
OpMemberName %particlesB_block_tint_explicit_layout 0 "inner"
OpName %particlesB_block_tint_explicit_layout "particlesB_block_tint_explicit_layout"
OpName %comp_main_global_invocation_id_Input "comp_main_global_invocation_id_Input"
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 "pos"
OpName %vel "vel"
OpName %i "i"
OpName %comp_main "comp_main"
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
OpMemberDecorate %params_block 0 Offset 0
OpDecorate %params_block Block
OpDecorate %1 DescriptorSet 0
OpDecorate %1 Binding 0
OpDecorate %1 NonWritable
OpMemberDecorate %Particle 0 Offset 0
OpMemberDecorate %Particle 1 Offset 8
OpDecorate %_arr_Particle_uint_5 ArrayStride 16
OpMemberDecorate %Particles_tint_explicit_layout 0 Offset 0
OpMemberDecorate %particlesA_block_tint_explicit_layout 0 Offset 0
OpDecorate %particlesA_block_tint_explicit_layout Block
OpDecorate %6 DescriptorSet 0
OpDecorate %6 Binding 1
OpDecorate %6 Coherent
OpMemberDecorate %particlesB_block_tint_explicit_layout 0 Offset 0
OpDecorate %particlesB_block_tint_explicit_layout Block
OpDecorate %15 DescriptorSet 0
OpDecorate %15 Binding 2
OpDecorate %15 Coherent
OpDecorate %comp_main_global_invocation_id_Input BuiltIn GlobalInvocationId
%float = OpTypeFloat 32
%SimParams = OpTypeStruct %float %float %float %float %float %float %float
%params_block = OpTypeStruct %SimParams
%_ptr_Uniform_params_block = OpTypePointer Uniform %params_block
%1 = OpVariable %_ptr_Uniform_params_block Uniform
%v2float = OpTypeVector %float 2
%Particle = OpTypeStruct %v2float %v2float
%uint = OpTypeInt 32 0
%uint_5 = OpConstant %uint 5
%_arr_Particle_uint_5 = OpTypeArray %Particle %uint_5
%Particles_tint_explicit_layout = OpTypeStruct %_arr_Particle_uint_5
%particlesA_block_tint_explicit_layout = OpTypeStruct %Particles_tint_explicit_layout
%_ptr_StorageBuffer_particlesA_block_tint_explicit_layout = OpTypePointer StorageBuffer %particlesA_block_tint_explicit_layout
%6 = OpVariable %_ptr_StorageBuffer_particlesA_block_tint_explicit_layout StorageBuffer
%particlesB_block_tint_explicit_layout = OpTypeStruct %Particles_tint_explicit_layout
%_ptr_StorageBuffer_particlesB_block_tint_explicit_layout = OpTypePointer StorageBuffer %particlesB_block_tint_explicit_layout
%15 = OpVariable %_ptr_StorageBuffer_particlesB_block_tint_explicit_layout StorageBuffer
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%comp_main_global_invocation_id_Input = OpVariable %_ptr_Input_v3uint Input
%void = OpTypeVoid
%24 = OpTypeFunction %void %v3uint
%_ptr_Function_uint = OpTypePointer Function %uint
%bool = OpTypeBool
%uint_4 = OpConstant %uint 4
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
%uint_0 = OpConstant %uint 0
%_ptr_Function_v2float = OpTypePointer Function %v2float
%uint_1 = OpConstant %uint 1
%51 = OpConstantNull %v2float
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%int_0 = OpConstant %int 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%uint_6 = OpConstant %uint 6
%float_0 = OpConstant %float 0
%float_0_100000001 = OpConstant %float 0.100000001
%_ptr_Function_float = OpTypePointer Function %float
%float_n1 = OpConstant %float -1
%float_1 = OpConstant %float 1
%uint_2 = OpConstant %uint 2
%uint_3 = OpConstant %uint 3
%int_1 = OpConstant %int 1
%222 = OpTypeFunction %void
%comp_main_inner = OpFunction %void None %24
%gl_GlobalInvocationID = OpFunctionParameter %v3uint
%25 = OpLabel
%index = OpVariable %_ptr_Function_uint Function
%vPos = OpVariable %_ptr_Function_v2float Function
%vVel = OpVariable %_ptr_Function_v2float Function
%cMass = OpVariable %_ptr_Function_v2float Function
%cVel = OpVariable %_ptr_Function_v2float Function
%colVel = OpVariable %_ptr_Function_v2float Function
%cMassCount = OpVariable %_ptr_Function_int Function
%cVelCount = OpVariable %_ptr_Function_int Function
%pos = OpVariable %_ptr_Function_v2float Function %51
%vel = OpVariable %_ptr_Function_v2float Function %51
%i = OpVariable %_ptr_Function_uint Function
%26 = OpCompositeExtract %uint %gl_GlobalInvocationID 0
OpStore %index %26
%29 = OpLoad %uint %index None
%30 = OpUGreaterThanEqual %bool %29 %uint_5
OpSelectionMerge %32 None
OpBranchConditional %30 %33 %32
%33 = OpLabel
OpReturn
%32 = OpLabel
%34 = OpLoad %uint %index None
%35 = OpExtInst %uint %36 UMin %34 %uint_4
%38 = OpAccessChain %_ptr_StorageBuffer_v2float %6 %uint_0 %uint_0 %35 %uint_0
%41 = OpLoad %v2float %38 None
OpStore %vPos %41
%44 = OpLoad %uint %index None
%45 = OpExtInst %uint %36 UMin %44 %uint_4
%46 = OpAccessChain %_ptr_StorageBuffer_v2float %6 %uint_0 %uint_0 %45 %uint_1
%48 = OpLoad %v2float %46 None
OpStore %vVel %48
OpStore %cMass %51
OpStore %cVel %51
OpStore %colVel %51
OpStore %cMassCount %int_0
OpStore %cVelCount %int_0
OpBranch %61
%61 = OpLabel
OpStore %i %uint_0
OpBranch %64
%64 = OpLabel
OpLoopMerge %65 %63 None
OpBranch %62
%62 = OpLabel
%138 = OpLoad %uint %i None
%139 = OpULessThan %bool %138 %uint_5
OpSelectionMerge %140 None
OpBranchConditional %139 %140 %141
%141 = OpLabel
OpBranch %65
%140 = OpLabel
%142 = OpLoad %uint %i None
%143 = OpLoad %uint %index None
%144 = OpIEqual %bool %142 %143
OpSelectionMerge %145 None
OpBranchConditional %144 %146 %145
%146 = OpLabel
OpBranch %63
%145 = OpLabel
%147 = OpLoad %uint %i None
%148 = OpExtInst %uint %36 UMin %147 %uint_4
%149 = OpAccessChain %_ptr_StorageBuffer_v2float %6 %uint_0 %uint_0 %148 %uint_0
%150 = OpLoad %v2float %149 None
%151 = OpVectorShuffle %v2float %150 %150 0 1
OpStore %pos %151 None
%152 = OpLoad %uint %i None
%153 = OpExtInst %uint %36 UMin %152 %uint_4
%154 = OpAccessChain %_ptr_StorageBuffer_v2float %6 %uint_0 %uint_0 %153 %uint_1
%155 = OpLoad %v2float %154 None
%156 = OpVectorShuffle %v2float %155 %155 0 1
OpStore %vel %156 None
%157 = OpLoad %v2float %pos None
%158 = OpLoad %v2float %vPos None
%159 = OpExtInst %float %36 Distance %157 %158
%160 = OpAccessChain %_ptr_Uniform_float %1 %uint_0 %uint_1
%161 = OpLoad %float %160 None
%162 = OpFOrdLessThan %bool %159 %161
OpSelectionMerge %163 None
OpBranchConditional %162 %164 %163
%164 = OpLabel
%205 = OpLoad %v2float %cMass None
%206 = OpLoad %v2float %pos None
%207 = OpFAdd %v2float %205 %206
OpStore %cMass %207 None
%208 = OpLoad %int %cMassCount None
%209 = OpIAdd %int %208 %int_1
OpStore %cMassCount %209 None
OpBranch %163
%163 = OpLabel
%165 = OpLoad %v2float %pos None
%166 = OpLoad %v2float %vPos None
%167 = OpExtInst %float %36 Distance %165 %166
%168 = OpAccessChain %_ptr_Uniform_float %1 %uint_0 %uint_2
%170 = OpLoad %float %168 None
%171 = OpFOrdLessThan %bool %167 %170
OpSelectionMerge %172 None
OpBranchConditional %171 %173 %172
%173 = OpLabel
%211 = OpLoad %v2float %colVel None
%212 = OpLoad %v2float %pos None
%213 = OpLoad %v2float %vPos None
%214 = OpFSub %v2float %212 %213
%215 = OpFSub %v2float %211 %214
OpStore %colVel %215 None
OpBranch %172
%172 = OpLabel
%174 = OpLoad %v2float %pos None
%175 = OpLoad %v2float %vPos None
%176 = OpExtInst %float %36 Distance %174 %175
%177 = OpAccessChain %_ptr_Uniform_float %1 %uint_0 %uint_3
%179 = OpLoad %float %177 None
%180 = OpFOrdLessThan %bool %176 %179
OpSelectionMerge %181 None
OpBranchConditional %180 %182 %181
%182 = OpLabel
%216 = OpLoad %v2float %cVel None
%217 = OpLoad %v2float %vel None
%218 = OpFAdd %v2float %216 %217
OpStore %cVel %218 None
%219 = OpLoad %int %cVelCount None
%220 = OpIAdd %int %219 %int_1
OpStore %cVelCount %220 None
OpBranch %181
%181 = OpLabel
OpBranch %63
%63 = OpLabel
%183 = OpLoad %uint %i None
%184 = OpIAdd %uint %183 %uint_1
OpStore %i %184 None
OpBranch %64
%65 = OpLabel
%66 = OpLoad %int %cMassCount None
%67 = OpSGreaterThan %bool %66 %int_0
OpSelectionMerge %68 None
OpBranchConditional %67 %69 %68
%69 = OpLabel
%185 = OpLoad %v2float %cMass None
%186 = OpLoad %int %cMassCount None
%187 = OpConvertSToF %float %186
%188 = OpLoad %int %cMassCount None
%189 = OpConvertSToF %float %188
%190 = OpCompositeConstruct %v2float %187 %189
%191 = OpFDiv %v2float %185 %190
%192 = OpLoad %v2float %vPos None
%193 = OpFSub %v2float %191 %192
OpStore %cMass %193 None
OpBranch %68
%68 = OpLabel
%70 = OpLoad %int %cVelCount None
%71 = OpSGreaterThan %bool %70 %int_0
OpSelectionMerge %72 None
OpBranchConditional %71 %73 %72
%73 = OpLabel
%194 = OpLoad %v2float %cVel None
%195 = OpLoad %int %cVelCount None
%196 = OpConvertSToF %float %195
%197 = OpLoad %int %cVelCount None
%198 = OpConvertSToF %float %197
%199 = OpCompositeConstruct %v2float %196 %198
%200 = OpFDiv %v2float %194 %199
OpStore %cVel %200 None
OpBranch %72
%72 = OpLabel
%74 = OpLoad %v2float %vVel None
%75 = OpLoad %v2float %cMass None
%76 = OpAccessChain %_ptr_Uniform_float %1 %uint_0 %uint_4
%78 = OpLoad %float %76 None
%79 = OpVectorTimesScalar %v2float %75 %78
%80 = OpFAdd %v2float %74 %79
%81 = OpLoad %v2float %colVel None
%82 = OpAccessChain %_ptr_Uniform_float %1 %uint_0 %uint_5
%83 = OpLoad %float %82 None
%84 = OpVectorTimesScalar %v2float %81 %83
%85 = OpFAdd %v2float %80 %84
%86 = OpLoad %v2float %cVel None
%87 = OpAccessChain %_ptr_Uniform_float %1 %uint_0 %uint_6
%89 = OpLoad %float %87 None
%90 = OpVectorTimesScalar %v2float %86 %89
%91 = OpFAdd %v2float %85 %90
OpStore %vVel %91 None
%92 = OpLoad %v2float %vVel None
%93 = OpExtInst %v2float %36 Normalize %92
%94 = OpLoad %v2float %vVel None
%95 = OpExtInst %float %36 Length %94
%96 = OpExtInst %float %36 NClamp %95 %float_0 %float_0_100000001
%99 = OpVectorTimesScalar %v2float %93 %96
OpStore %vVel %99 None
%100 = OpLoad %v2float %vPos None
%101 = OpLoad %v2float %vVel None
%102 = OpAccessChain %_ptr_Uniform_float %1 %uint_0 %uint_0
%103 = OpLoad %float %102 None
%104 = OpVectorTimesScalar %v2float %101 %103
%105 = OpFAdd %v2float %100 %104
OpStore %vPos %105 None
%106 = OpAccessChain %_ptr_Function_float %vPos %uint_0
%108 = OpLoad %float %106 None
%109 = OpFOrdLessThan %bool %108 %float_n1
OpSelectionMerge %111 None
OpBranchConditional %109 %112 %111
%112 = OpLabel
%201 = OpAccessChain %_ptr_Function_float %vPos %uint_0
OpStore %201 %float_1 None
OpBranch %111
%111 = OpLabel
%113 = OpAccessChain %_ptr_Function_float %vPos %uint_0
%114 = OpLoad %float %113 None
%115 = OpFOrdGreaterThan %bool %114 %float_1
OpSelectionMerge %117 None
OpBranchConditional %115 %118 %117
%118 = OpLabel
%202 = OpAccessChain %_ptr_Function_float %vPos %uint_0
OpStore %202 %float_n1 None
OpBranch %117
%117 = OpLabel
%119 = OpAccessChain %_ptr_Function_float %vPos %uint_1
%120 = OpLoad %float %119 None
%121 = OpFOrdLessThan %bool %120 %float_n1
OpSelectionMerge %122 None
OpBranchConditional %121 %123 %122
%123 = OpLabel
%203 = OpAccessChain %_ptr_Function_float %vPos %uint_1
OpStore %203 %float_1 None
OpBranch %122
%122 = OpLabel
%124 = OpAccessChain %_ptr_Function_float %vPos %uint_1
%125 = OpLoad %float %124 None
%126 = OpFOrdGreaterThan %bool %125 %float_1
OpSelectionMerge %127 None
OpBranchConditional %126 %128 %127
%128 = OpLabel
%204 = OpAccessChain %_ptr_Function_float %vPos %uint_1
OpStore %204 %float_n1 None
OpBranch %127
%127 = OpLabel
%129 = OpLoad %uint %index None
%130 = OpExtInst %uint %36 UMin %129 %uint_4
%131 = OpAccessChain %_ptr_StorageBuffer_v2float %15 %uint_0 %uint_0 %130 %uint_0
%132 = OpLoad %v2float %vPos None
OpStore %131 %132 None
%133 = OpLoad %uint %index None
%134 = OpExtInst %uint %36 UMin %133 %uint_4
%135 = OpAccessChain %_ptr_StorageBuffer_v2float %15 %uint_0 %uint_0 %134 %uint_1
%136 = OpLoad %v2float %vVel None
OpStore %135 %136 None
OpReturn
OpFunctionEnd
%comp_main = OpFunction %void None %222
%223 = OpLabel
%224 = OpLoad %v3uint %comp_main_global_invocation_id_Input None
%225 = OpFunctionCall %void %comp_main_inner %224
OpReturn
OpFunctionEnd