1 module shaders.instancingcompute; 2 import sg = sokol.gfx; 3 import m = handmade.math; 4 extern(C): 5 6 /* 7 #version:1# (machine generated, don't edit!) 8 9 Generated by sokol-shdc (https://github.com/floooh/sokol-tools) 10 11 Cmdline: 12 sokol-shdc -i examples/shaders/instancingcompute.glsl -o examples/shaders/instancingcompute.d -l glsl430:glsl310es:metal_macos:hlsl5:wgsl -f sokol_d 13 14 Overview: 15 ========= 16 Shader program: 'display': 17 Get shader desc: displayShaderDesc(sg.queryBackend()); 18 Vertex Shader: vs 19 Fragment Shader: fs 20 Attributes: 21 ATTR_DISPLAY_POS => 0 22 ATTR_DISPLAY_COLOR0 => 1 23 Shader program: 'init': 24 Get shader desc: initShaderDesc(sg.queryBackend()); 25 Compute Shader: cs_init 26 Shader program: 'update': 27 Get shader desc: updateShaderDesc(sg.queryBackend()); 28 Compute Shader: cs_update 29 Bindings: 30 Uniform block 'vs_params': 31 D struct: VsParams 32 Bind slot: UB_VS_PARAMS => 0 33 Uniform block 'cs_params': 34 D struct: CsParams 35 Bind slot: UB_CS_PARAMS => 0 36 Storage buffer 'vs_ssbo': 37 D struct: Particle 38 Bind slot: SBUF_VS_SSBO => 0 39 Readonly: true 40 Storage buffer 'cs_ssbo': 41 D struct: Particle 42 Bind slot: SBUF_CS_SSBO => 0 43 Readonly: false 44 */ 45 enum ATTR_DISPLAY_POS = 0; 46 enum ATTR_DISPLAY_COLOR0 = 1; 47 enum UB_VS_PARAMS = 0; 48 enum UB_CS_PARAMS = 0; 49 enum SBUF_VS_SSBO = 0; 50 enum SBUF_CS_SSBO = 0; 51 struct VsParams { 52 align(16) m.Mat4 mvp; 53 } 54 struct CsParams { 55 align(16) float dt = 0; 56 align(1) int num_particles = 0; 57 align(1) ubyte[8] _pad_8 = 0; 58 } 59 struct Particle { 60 align(16) float[4] pos = 0; 61 align(1) float[4] vel = 0; 62 } 63 /* 64 #version 430 65 layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; 66 67 struct particle 68 { 69 vec4 pos; 70 vec4 vel; 71 }; 72 73 layout(binding = 0, std430) buffer cs_ssbo 74 { 75 particle prt[]; 76 } _59; 77 78 uint xorshift32(inout uint x) 79 { 80 x ^= (x << uint(13)); 81 x ^= (x >> uint(17)); 82 x ^= (x << uint(5)); 83 return x; 84 } 85 86 void main() 87 { 88 uint param = 305419896u ^ gl_GlobalInvocationID.x; 89 uint _44 = xorshift32(param); 90 uint param_1 = _44; 91 uint _48 = xorshift32(param_1); 92 uint param_2 = _48; 93 uint _52 = xorshift32(param_2); 94 _59.prt[gl_GlobalInvocationID.x].pos = vec4(0.0); 95 _59.prt[gl_GlobalInvocationID.x].vel = vec4((float(_44 & 32767u) * 3.0518509447574615478515625e-05) - 0.5, (float(_48 & 32767u) * 1.52592547237873077392578125e-05) + 2.0, (float(_52 & 32767u) * 3.0518509447574615478515625e-05) - 0.5, 0.0); 96 } 97 98 */ 99 __gshared char[854] CS_INIT_SOURCE_GLSL430 = [ 100 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x6c,0x61,0x79, 101 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x73,0x69,0x7a,0x65,0x5f,0x78, 102 0x20,0x3d,0x20,0x36,0x34,0x2c,0x20,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x73,0x69,0x7a, 103 0x65,0x5f,0x79,0x20,0x3d,0x20,0x31,0x2c,0x20,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x73, 104 0x69,0x7a,0x65,0x5f,0x7a,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x3b,0x0a,0x0a, 105 0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x0a, 106 0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x3b,0x0a, 107 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x65,0x6c,0x3b,0x0a,0x7d,0x3b, 108 0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67, 109 0x20,0x3d,0x20,0x30,0x2c,0x20,0x73,0x74,0x64,0x34,0x33,0x30,0x29,0x20,0x62,0x75, 110 0x66,0x66,0x65,0x72,0x20,0x63,0x73,0x5f,0x73,0x73,0x62,0x6f,0x0a,0x7b,0x0a,0x20, 111 0x20,0x20,0x20,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x20,0x70,0x72,0x74,0x5b, 112 0x5d,0x3b,0x0a,0x7d,0x20,0x5f,0x35,0x39,0x3b,0x0a,0x0a,0x75,0x69,0x6e,0x74,0x20, 113 0x78,0x6f,0x72,0x73,0x68,0x69,0x66,0x74,0x33,0x32,0x28,0x69,0x6e,0x6f,0x75,0x74, 114 0x20,0x75,0x69,0x6e,0x74,0x20,0x78,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x78, 115 0x20,0x5e,0x3d,0x20,0x28,0x78,0x20,0x3c,0x3c,0x20,0x75,0x69,0x6e,0x74,0x28,0x31, 116 0x33,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x78,0x20,0x5e,0x3d,0x20,0x28,0x78, 117 0x20,0x3e,0x3e,0x20,0x75,0x69,0x6e,0x74,0x28,0x31,0x37,0x29,0x29,0x3b,0x0a,0x20, 118 0x20,0x20,0x20,0x78,0x20,0x5e,0x3d,0x20,0x28,0x78,0x20,0x3c,0x3c,0x20,0x75,0x69, 119 0x6e,0x74,0x28,0x35,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75, 120 0x72,0x6e,0x20,0x78,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61, 121 0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20, 122 0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x33,0x30,0x35,0x34,0x31,0x39,0x38,0x39, 123 0x36,0x75,0x20,0x5e,0x20,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e, 124 0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x3b,0x0a,0x20,0x20, 125 0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x5f,0x34,0x34,0x20,0x3d,0x20,0x78,0x6f,0x72, 126 0x73,0x68,0x69,0x66,0x74,0x33,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a, 127 0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, 128 0x20,0x3d,0x20,0x5f,0x34,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74, 129 0x20,0x5f,0x34,0x38,0x20,0x3d,0x20,0x78,0x6f,0x72,0x73,0x68,0x69,0x66,0x74,0x33, 130 0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, 131 0x75,0x69,0x6e,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x5f, 132 0x34,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x5f,0x35,0x32, 133 0x20,0x3d,0x20,0x78,0x6f,0x72,0x73,0x68,0x69,0x66,0x74,0x33,0x32,0x28,0x70,0x61, 134 0x72,0x61,0x6d,0x5f,0x32,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x35,0x39,0x2e, 135 0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76, 136 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x5d,0x2e,0x70,0x6f,0x73, 137 0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x30,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20, 138 0x20,0x20,0x5f,0x35,0x39,0x2e,0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f,0x47,0x6c,0x6f, 139 0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e, 140 0x78,0x5d,0x2e,0x76,0x65,0x6c,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x66, 141 0x6c,0x6f,0x61,0x74,0x28,0x5f,0x34,0x34,0x20,0x26,0x20,0x33,0x32,0x37,0x36,0x37, 142 0x75,0x29,0x20,0x2a,0x20,0x33,0x2e,0x30,0x35,0x31,0x38,0x35,0x30,0x39,0x34,0x34, 143 0x37,0x35,0x37,0x34,0x36,0x31,0x35,0x34,0x37,0x38,0x35,0x31,0x35,0x36,0x32,0x35, 144 0x65,0x2d,0x30,0x35,0x29,0x20,0x2d,0x20,0x30,0x2e,0x35,0x2c,0x20,0x28,0x66,0x6c, 145 0x6f,0x61,0x74,0x28,0x5f,0x34,0x38,0x20,0x26,0x20,0x33,0x32,0x37,0x36,0x37,0x75, 146 0x29,0x20,0x2a,0x20,0x31,0x2e,0x35,0x32,0x35,0x39,0x32,0x35,0x34,0x37,0x32,0x33, 147 0x37,0x38,0x37,0x33,0x30,0x37,0x37,0x33,0x39,0x32,0x35,0x37,0x38,0x31,0x32,0x35, 148 0x65,0x2d,0x30,0x35,0x29,0x20,0x2b,0x20,0x32,0x2e,0x30,0x2c,0x20,0x28,0x66,0x6c, 149 0x6f,0x61,0x74,0x28,0x5f,0x35,0x32,0x20,0x26,0x20,0x33,0x32,0x37,0x36,0x37,0x75, 150 0x29,0x20,0x2a,0x20,0x33,0x2e,0x30,0x35,0x31,0x38,0x35,0x30,0x39,0x34,0x34,0x37, 151 0x35,0x37,0x34,0x36,0x31,0x35,0x34,0x37,0x38,0x35,0x31,0x35,0x36,0x32,0x35,0x65, 152 0x2d,0x30,0x35,0x29,0x20,0x2d,0x20,0x30,0x2e,0x35,0x2c,0x20,0x30,0x2e,0x30,0x29, 153 0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 154 ]; 155 /* 156 #version 430 157 layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; 158 159 struct particle 160 { 161 vec4 pos; 162 vec4 vel; 163 }; 164 165 struct cs_params 166 { 167 float dt; 168 int num_particles; 169 }; 170 171 uniform cs_params _21; 172 173 layout(binding = 0, std430) buffer cs_ssbo 174 { 175 particle prt[]; 176 } _39; 177 178 void main() 179 { 180 if (gl_GlobalInvocationID.x >= uint(_21.num_particles)) 181 { 182 return; 183 } 184 vec4 _48 = _39.prt[gl_GlobalInvocationID.x].vel; 185 _48.y = _48.y - _21.dt; 186 vec4 vel = _48; 187 vec4 _65 = _39.prt[gl_GlobalInvocationID.x].pos + (_48 * _21.dt); 188 vec4 pos = _65; 189 if (_65.y < (-2.0)) 190 { 191 vec4 _92 = pos; 192 _92.y = -1.7999999523162841796875; 193 pos = _92; 194 vel *= vec4(0.800000011920928955078125, -0.800000011920928955078125, 0.800000011920928955078125, 0.0); 195 } 196 _39.prt[gl_GlobalInvocationID.x].pos = pos; 197 _39.prt[gl_GlobalInvocationID.x].vel = vel; 198 } 199 200 */ 201 __gshared char[913] CS_UPDATE_SOURCE_GLSL430 = [ 202 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x6c,0x61,0x79, 203 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x73,0x69,0x7a,0x65,0x5f,0x78, 204 0x20,0x3d,0x20,0x36,0x34,0x2c,0x20,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x73,0x69,0x7a, 205 0x65,0x5f,0x79,0x20,0x3d,0x20,0x31,0x2c,0x20,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x73, 206 0x69,0x7a,0x65,0x5f,0x7a,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x3b,0x0a,0x0a, 207 0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x0a, 208 0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x3b,0x0a, 209 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x65,0x6c,0x3b,0x0a,0x7d,0x3b, 210 0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x63,0x73,0x5f,0x70,0x61,0x72,0x61, 211 0x6d,0x73,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x64, 212 0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x74,0x20,0x6e,0x75,0x6d,0x5f,0x70, 213 0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x75,0x6e, 214 0x69,0x66,0x6f,0x72,0x6d,0x20,0x63,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20, 215 0x5f,0x32,0x31,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x62,0x69,0x6e, 216 0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x30,0x2c,0x20,0x73,0x74,0x64,0x34,0x33,0x30, 217 0x29,0x20,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x63,0x73,0x5f,0x73,0x73,0x62,0x6f, 218 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x20, 219 0x70,0x72,0x74,0x5b,0x5d,0x3b,0x0a,0x7d,0x20,0x5f,0x33,0x39,0x3b,0x0a,0x0a,0x76, 220 0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20, 221 0x20,0x69,0x66,0x20,0x28,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e, 222 0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x20,0x3e,0x3d,0x20, 223 0x75,0x69,0x6e,0x74,0x28,0x5f,0x32,0x31,0x2e,0x6e,0x75,0x6d,0x5f,0x70,0x61,0x72, 224 0x74,0x69,0x63,0x6c,0x65,0x73,0x29,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20, 225 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x20, 226 0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x34, 227 0x38,0x20,0x3d,0x20,0x5f,0x33,0x39,0x2e,0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f,0x47, 228 0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49, 229 0x44,0x2e,0x78,0x5d,0x2e,0x76,0x65,0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x34, 230 0x38,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x34,0x38,0x2e,0x79,0x20,0x2d,0x20,0x5f,0x32, 231 0x31,0x2e,0x64,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x76, 232 0x65,0x6c,0x20,0x3d,0x20,0x5f,0x34,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65, 233 0x63,0x34,0x20,0x5f,0x36,0x35,0x20,0x3d,0x20,0x5f,0x33,0x39,0x2e,0x70,0x72,0x74, 234 0x5b,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61, 235 0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x5d,0x2e,0x70,0x6f,0x73,0x20,0x2b,0x20, 236 0x28,0x5f,0x34,0x38,0x20,0x2a,0x20,0x5f,0x32,0x31,0x2e,0x64,0x74,0x29,0x3b,0x0a, 237 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x20,0x3d,0x20,0x5f, 238 0x36,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x36,0x35,0x2e, 239 0x79,0x20,0x3c,0x20,0x28,0x2d,0x32,0x2e,0x30,0x29,0x29,0x0a,0x20,0x20,0x20,0x20, 240 0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f, 241 0x39,0x32,0x20,0x3d,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, 242 0x20,0x20,0x5f,0x39,0x32,0x2e,0x79,0x20,0x3d,0x20,0x2d,0x31,0x2e,0x37,0x39,0x39, 243 0x39,0x39,0x39,0x39,0x35,0x32,0x33,0x31,0x36,0x32,0x38,0x34,0x31,0x37,0x39,0x36, 244 0x38,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x6f,0x73, 245 0x20,0x3d,0x20,0x5f,0x39,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 246 0x76,0x65,0x6c,0x20,0x2a,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x30,0x2e,0x38,0x30, 247 0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35, 248 0x30,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x38,0x30,0x30,0x30,0x30, 249 0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38, 250 0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31, 251 0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x2c, 252 0x20,0x30,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20, 253 0x20,0x5f,0x33,0x39,0x2e,0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62, 254 0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78, 255 0x5d,0x2e,0x70,0x6f,0x73,0x20,0x3d,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20, 256 0x20,0x5f,0x33,0x39,0x2e,0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62, 257 0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78, 258 0x5d,0x2e,0x76,0x65,0x6c,0x20,0x3d,0x20,0x76,0x65,0x6c,0x3b,0x0a,0x7d,0x0a,0x0a, 259 0x00, 260 ]; 261 /* 262 #version 430 263 264 struct particle 265 { 266 vec4 pos; 267 vec4 vel; 268 }; 269 270 layout(binding = 0, std430) readonly buffer vs_ssbo 271 { 272 particle prt[]; 273 } _15; 274 275 uniform vec4 vs_params[4]; 276 layout(location = 0) in vec3 pos; 277 layout(location = 0) out vec4 color; 278 layout(location = 1) in vec4 color0; 279 280 void main() 281 { 282 gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * vec4(pos + _15.prt[gl_InstanceID].pos.xyz, 1.0); 283 color = color0; 284 } 285 286 */ 287 __gshared char[450] VS_SOURCE_GLSL430 = [ 288 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x73,0x74, 289 0x72,0x75,0x63,0x74,0x20,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x0a,0x7b,0x0a, 290 0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20, 291 0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x65,0x6c,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a, 292 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d, 293 0x20,0x30,0x2c,0x20,0x73,0x74,0x64,0x34,0x33,0x30,0x29,0x20,0x72,0x65,0x61,0x64, 294 0x6f,0x6e,0x6c,0x79,0x20,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x76,0x73,0x5f,0x73, 295 0x73,0x62,0x6f,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x70,0x61,0x72,0x74,0x69,0x63, 296 0x6c,0x65,0x20,0x70,0x72,0x74,0x5b,0x5d,0x3b,0x0a,0x7d,0x20,0x5f,0x31,0x35,0x3b, 297 0x0a,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76, 298 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,0x79, 299 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30, 300 0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x6c, 301 0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d, 302 0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c, 303 0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74, 304 0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34, 305 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d, 306 0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50, 307 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76, 308 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f, 309 0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61, 310 0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61, 311 0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x70,0x6f, 312 0x73,0x20,0x2b,0x20,0x5f,0x31,0x35,0x2e,0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f,0x49, 313 0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x44,0x5d,0x2e,0x70,0x6f,0x73,0x2e,0x78, 314 0x79,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f, 315 0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a, 316 0x0a,0x00, 317 ]; 318 /* 319 #version 430 320 321 layout(location = 0) out vec4 frag_color; 322 layout(location = 0) in vec4 color; 323 324 void main() 325 { 326 frag_color = color; 327 } 328 329 */ 330 __gshared char[135] FS_SOURCE_GLSL430 = [ 331 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x6c,0x61, 332 0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, 333 0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67, 334 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c, 335 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20, 336 0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69, 337 0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, 338 0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f, 339 0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 340 ]; 341 /* 342 #version 310 es 343 layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; 344 345 struct particle 346 { 347 vec4 pos; 348 vec4 vel; 349 }; 350 351 layout(binding = 0, std430) buffer cs_ssbo 352 { 353 particle prt[]; 354 } _59; 355 356 uint xorshift32(inout uint x) 357 { 358 x ^= (x << uint(13)); 359 x ^= (x >> uint(17)); 360 x ^= (x << uint(5)); 361 return x; 362 } 363 364 void main() 365 { 366 uint param = 305419896u ^ gl_GlobalInvocationID.x; 367 uint _44 = xorshift32(param); 368 uint param_1 = _44; 369 uint _48 = xorshift32(param_1); 370 uint param_2 = _48; 371 uint _52 = xorshift32(param_2); 372 _59.prt[gl_GlobalInvocationID.x].pos = vec4(0.0); 373 _59.prt[gl_GlobalInvocationID.x].vel = vec4((float(_44 & 32767u) * 3.0518509447574615478515625e-05) - 0.5, (float(_48 & 32767u) * 1.52592547237873077392578125e-05) + 2.0, (float(_52 & 32767u) * 3.0518509447574615478515625e-05) - 0.5, 0.0); 374 } 375 376 */ 377 __gshared char[857] CS_INIT_SOURCE_GLSL310ES = [ 378 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x31,0x30,0x20,0x65,0x73,0x0a, 379 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x73,0x69,0x7a, 380 0x65,0x5f,0x78,0x20,0x3d,0x20,0x36,0x34,0x2c,0x20,0x6c,0x6f,0x63,0x61,0x6c,0x5f, 381 0x73,0x69,0x7a,0x65,0x5f,0x79,0x20,0x3d,0x20,0x31,0x2c,0x20,0x6c,0x6f,0x63,0x61, 382 0x6c,0x5f,0x73,0x69,0x7a,0x65,0x5f,0x7a,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e, 383 0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x70,0x61,0x72,0x74,0x69,0x63, 384 0x6c,0x65,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f, 385 0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x65,0x6c,0x3b, 386 0x0a,0x7d,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x62,0x69,0x6e,0x64, 387 0x69,0x6e,0x67,0x20,0x3d,0x20,0x30,0x2c,0x20,0x73,0x74,0x64,0x34,0x33,0x30,0x29, 388 0x20,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x63,0x73,0x5f,0x73,0x73,0x62,0x6f,0x0a, 389 0x7b,0x0a,0x20,0x20,0x20,0x20,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x20,0x70, 390 0x72,0x74,0x5b,0x5d,0x3b,0x0a,0x7d,0x20,0x5f,0x35,0x39,0x3b,0x0a,0x0a,0x75,0x69, 391 0x6e,0x74,0x20,0x78,0x6f,0x72,0x73,0x68,0x69,0x66,0x74,0x33,0x32,0x28,0x69,0x6e, 392 0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x78,0x29,0x0a,0x7b,0x0a,0x20,0x20, 393 0x20,0x20,0x78,0x20,0x5e,0x3d,0x20,0x28,0x78,0x20,0x3c,0x3c,0x20,0x75,0x69,0x6e, 394 0x74,0x28,0x31,0x33,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x78,0x20,0x5e,0x3d, 395 0x20,0x28,0x78,0x20,0x3e,0x3e,0x20,0x75,0x69,0x6e,0x74,0x28,0x31,0x37,0x29,0x29, 396 0x3b,0x0a,0x20,0x20,0x20,0x20,0x78,0x20,0x5e,0x3d,0x20,0x28,0x78,0x20,0x3c,0x3c, 397 0x20,0x75,0x69,0x6e,0x74,0x28,0x35,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72, 398 0x65,0x74,0x75,0x72,0x6e,0x20,0x78,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64, 399 0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69, 400 0x6e,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x33,0x30,0x35,0x34,0x31, 401 0x39,0x38,0x39,0x36,0x75,0x20,0x5e,0x20,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61, 402 0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x3b, 403 0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x5f,0x34,0x34,0x20,0x3d,0x20, 404 0x78,0x6f,0x72,0x73,0x68,0x69,0x66,0x74,0x33,0x32,0x28,0x70,0x61,0x72,0x61,0x6d, 405 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x70,0x61,0x72,0x61, 406 0x6d,0x5f,0x31,0x20,0x3d,0x20,0x5f,0x34,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75, 407 0x69,0x6e,0x74,0x20,0x5f,0x34,0x38,0x20,0x3d,0x20,0x78,0x6f,0x72,0x73,0x68,0x69, 408 0x66,0x74,0x33,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b,0x0a,0x20, 409 0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20, 410 0x3d,0x20,0x5f,0x34,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20, 411 0x5f,0x35,0x32,0x20,0x3d,0x20,0x78,0x6f,0x72,0x73,0x68,0x69,0x66,0x74,0x33,0x32, 412 0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f, 413 0x35,0x39,0x2e,0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c, 414 0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x5d,0x2e, 415 0x70,0x6f,0x73,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x30,0x2e,0x30,0x29,0x3b, 416 0x0a,0x20,0x20,0x20,0x20,0x5f,0x35,0x39,0x2e,0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f, 417 0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, 418 0x49,0x44,0x2e,0x78,0x5d,0x2e,0x76,0x65,0x6c,0x20,0x3d,0x20,0x76,0x65,0x63,0x34, 419 0x28,0x28,0x66,0x6c,0x6f,0x61,0x74,0x28,0x5f,0x34,0x34,0x20,0x26,0x20,0x33,0x32, 420 0x37,0x36,0x37,0x75,0x29,0x20,0x2a,0x20,0x33,0x2e,0x30,0x35,0x31,0x38,0x35,0x30, 421 0x39,0x34,0x34,0x37,0x35,0x37,0x34,0x36,0x31,0x35,0x34,0x37,0x38,0x35,0x31,0x35, 422 0x36,0x32,0x35,0x65,0x2d,0x30,0x35,0x29,0x20,0x2d,0x20,0x30,0x2e,0x35,0x2c,0x20, 423 0x28,0x66,0x6c,0x6f,0x61,0x74,0x28,0x5f,0x34,0x38,0x20,0x26,0x20,0x33,0x32,0x37, 424 0x36,0x37,0x75,0x29,0x20,0x2a,0x20,0x31,0x2e,0x35,0x32,0x35,0x39,0x32,0x35,0x34, 425 0x37,0x32,0x33,0x37,0x38,0x37,0x33,0x30,0x37,0x37,0x33,0x39,0x32,0x35,0x37,0x38, 426 0x31,0x32,0x35,0x65,0x2d,0x30,0x35,0x29,0x20,0x2b,0x20,0x32,0x2e,0x30,0x2c,0x20, 427 0x28,0x66,0x6c,0x6f,0x61,0x74,0x28,0x5f,0x35,0x32,0x20,0x26,0x20,0x33,0x32,0x37, 428 0x36,0x37,0x75,0x29,0x20,0x2a,0x20,0x33,0x2e,0x30,0x35,0x31,0x38,0x35,0x30,0x39, 429 0x34,0x34,0x37,0x35,0x37,0x34,0x36,0x31,0x35,0x34,0x37,0x38,0x35,0x31,0x35,0x36, 430 0x32,0x35,0x65,0x2d,0x30,0x35,0x29,0x20,0x2d,0x20,0x30,0x2e,0x35,0x2c,0x20,0x30, 431 0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 432 ]; 433 /* 434 #version 310 es 435 layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; 436 437 struct particle 438 { 439 vec4 pos; 440 vec4 vel; 441 }; 442 443 struct cs_params 444 { 445 float dt; 446 int num_particles; 447 }; 448 449 uniform cs_params _21; 450 451 layout(binding = 0, std430) buffer cs_ssbo 452 { 453 particle prt[]; 454 } _39; 455 456 void main() 457 { 458 if (gl_GlobalInvocationID.x >= uint(_21.num_particles)) 459 { 460 return; 461 } 462 vec4 _48 = _39.prt[gl_GlobalInvocationID.x].vel; 463 _48.y = _48.y - _21.dt; 464 vec4 vel = _48; 465 vec4 _65 = _39.prt[gl_GlobalInvocationID.x].pos + (_48 * _21.dt); 466 vec4 pos = _65; 467 if (_65.y < (-2.0)) 468 { 469 vec4 _92 = pos; 470 _92.y = -1.7999999523162841796875; 471 pos = _92; 472 vel *= vec4(0.800000011920928955078125, -0.800000011920928955078125, 0.800000011920928955078125, 0.0); 473 } 474 _39.prt[gl_GlobalInvocationID.x].pos = pos; 475 _39.prt[gl_GlobalInvocationID.x].vel = vel; 476 } 477 478 */ 479 __gshared char[916] CS_UPDATE_SOURCE_GLSL310ES = [ 480 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x31,0x30,0x20,0x65,0x73,0x0a, 481 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x6c,0x5f,0x73,0x69,0x7a, 482 0x65,0x5f,0x78,0x20,0x3d,0x20,0x36,0x34,0x2c,0x20,0x6c,0x6f,0x63,0x61,0x6c,0x5f, 483 0x73,0x69,0x7a,0x65,0x5f,0x79,0x20,0x3d,0x20,0x31,0x2c,0x20,0x6c,0x6f,0x63,0x61, 484 0x6c,0x5f,0x73,0x69,0x7a,0x65,0x5f,0x7a,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e, 485 0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x70,0x61,0x72,0x74,0x69,0x63, 486 0x6c,0x65,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f, 487 0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x65,0x6c,0x3b, 488 0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x63,0x73,0x5f,0x70, 489 0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, 490 0x74,0x20,0x64,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x74,0x20,0x6e,0x75, 491 0x6d,0x5f,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x3b,0x0a,0x7d,0x3b,0x0a, 492 0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x63,0x73,0x5f,0x70,0x61,0x72,0x61, 493 0x6d,0x73,0x20,0x5f,0x32,0x31,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, 494 0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x30,0x2c,0x20,0x73,0x74,0x64, 495 0x34,0x33,0x30,0x29,0x20,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x63,0x73,0x5f,0x73, 496 0x73,0x62,0x6f,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x70,0x61,0x72,0x74,0x69,0x63, 497 0x6c,0x65,0x20,0x70,0x72,0x74,0x5b,0x5d,0x3b,0x0a,0x7d,0x20,0x5f,0x33,0x39,0x3b, 498 0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a, 499 0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61, 500 0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x20, 501 0x3e,0x3d,0x20,0x75,0x69,0x6e,0x74,0x28,0x5f,0x32,0x31,0x2e,0x6e,0x75,0x6d,0x5f, 502 0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x29,0x29,0x0a,0x20,0x20,0x20,0x20, 503 0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e, 504 0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34, 505 0x20,0x5f,0x34,0x38,0x20,0x3d,0x20,0x5f,0x33,0x39,0x2e,0x70,0x72,0x74,0x5b,0x67, 506 0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69, 507 0x6f,0x6e,0x49,0x44,0x2e,0x78,0x5d,0x2e,0x76,0x65,0x6c,0x3b,0x0a,0x20,0x20,0x20, 508 0x20,0x5f,0x34,0x38,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x34,0x38,0x2e,0x79,0x20,0x2d, 509 0x20,0x5f,0x32,0x31,0x2e,0x64,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63, 510 0x34,0x20,0x76,0x65,0x6c,0x20,0x3d,0x20,0x5f,0x34,0x38,0x3b,0x0a,0x20,0x20,0x20, 511 0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x36,0x35,0x20,0x3d,0x20,0x5f,0x33,0x39,0x2e, 512 0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76, 513 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x5d,0x2e,0x70,0x6f,0x73, 514 0x20,0x2b,0x20,0x28,0x5f,0x34,0x38,0x20,0x2a,0x20,0x5f,0x32,0x31,0x2e,0x64,0x74, 515 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x20, 516 0x3d,0x20,0x5f,0x36,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f, 517 0x36,0x35,0x2e,0x79,0x20,0x3c,0x20,0x28,0x2d,0x32,0x2e,0x30,0x29,0x29,0x0a,0x20, 518 0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63, 519 0x34,0x20,0x5f,0x39,0x32,0x20,0x3d,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20, 520 0x20,0x20,0x20,0x20,0x20,0x5f,0x39,0x32,0x2e,0x79,0x20,0x3d,0x20,0x2d,0x31,0x2e, 521 0x37,0x39,0x39,0x39,0x39,0x39,0x39,0x35,0x32,0x33,0x31,0x36,0x32,0x38,0x34,0x31, 522 0x37,0x39,0x36,0x38,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 523 0x70,0x6f,0x73,0x20,0x3d,0x20,0x5f,0x39,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20, 524 0x20,0x20,0x20,0x76,0x65,0x6c,0x20,0x2a,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x30, 525 0x2e,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38, 526 0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x38,0x30, 527 0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35, 528 0x30,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30, 529 0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31, 530 0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a, 531 0x20,0x20,0x20,0x20,0x5f,0x33,0x39,0x2e,0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f,0x47, 532 0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49, 533 0x44,0x2e,0x78,0x5d,0x2e,0x70,0x6f,0x73,0x20,0x3d,0x20,0x70,0x6f,0x73,0x3b,0x0a, 534 0x20,0x20,0x20,0x20,0x5f,0x33,0x39,0x2e,0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f,0x47, 535 0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49, 536 0x44,0x2e,0x78,0x5d,0x2e,0x76,0x65,0x6c,0x20,0x3d,0x20,0x76,0x65,0x6c,0x3b,0x0a, 537 0x7d,0x0a,0x0a,0x00, 538 ]; 539 /* 540 #version 310 es 541 542 struct particle 543 { 544 vec4 pos; 545 vec4 vel; 546 }; 547 548 layout(binding = 0, std430) readonly buffer vs_ssbo 549 { 550 particle prt[]; 551 } _15; 552 553 uniform vec4 vs_params[4]; 554 layout(location = 0) in vec3 pos; 555 layout(location = 0) out vec4 color; 556 layout(location = 1) in vec4 color0; 557 558 void main() 559 { 560 gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * vec4(pos + _15.prt[gl_InstanceID].pos.xyz, 1.0); 561 color = color0; 562 } 563 564 */ 565 __gshared char[453] VS_SOURCE_GLSL310ES = [ 566 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x31,0x30,0x20,0x65,0x73,0x0a, 567 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65, 568 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x3b, 569 0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x65,0x6c,0x3b,0x0a,0x7d, 570 0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x62,0x69,0x6e,0x64,0x69,0x6e, 571 0x67,0x20,0x3d,0x20,0x30,0x2c,0x20,0x73,0x74,0x64,0x34,0x33,0x30,0x29,0x20,0x72, 572 0x65,0x61,0x64,0x6f,0x6e,0x6c,0x79,0x20,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x76, 573 0x73,0x5f,0x73,0x73,0x62,0x6f,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x70,0x61,0x72, 574 0x74,0x69,0x63,0x6c,0x65,0x20,0x70,0x72,0x74,0x5b,0x5d,0x3b,0x0a,0x7d,0x20,0x5f, 575 0x31,0x35,0x3b,0x0a,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63, 576 0x34,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x3b,0x0a, 577 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, 578 0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x6f,0x73, 579 0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, 580 0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20, 581 0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f, 582 0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76, 583 0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x0a,0x76,0x6f,0x69, 584 0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67, 585 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74, 586 0x34,0x28,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20, 587 0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73, 588 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70, 589 0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34, 590 0x28,0x70,0x6f,0x73,0x20,0x2b,0x20,0x5f,0x31,0x35,0x2e,0x70,0x72,0x74,0x5b,0x67, 591 0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x44,0x5d,0x2e,0x70,0x6f, 592 0x73,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20, 593 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b, 594 0x0a,0x7d,0x0a,0x0a,0x00, 595 ]; 596 /* 597 #version 310 es 598 precision mediump float; 599 precision highp int; 600 601 layout(location = 0) out highp vec4 frag_color; 602 layout(location = 0) in highp vec4 color; 603 604 void main() 605 { 606 frag_color = color; 607 } 608 609 */ 610 __gshared char[196] FS_SOURCE_GLSL310ES = [ 611 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x31,0x30,0x20,0x65,0x73,0x0a, 612 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, 613 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, 614 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x6c, 615 0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d, 616 0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65, 617 0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c, 618 0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d, 619 0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63, 620 0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d, 621 0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67, 622 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a, 623 0x7d,0x0a,0x0a,0x00, 624 ]; 625 /* 626 struct particle 627 { 628 float4 pos; 629 float4 vel; 630 }; 631 632 static const uint3 gl_WorkGroupSize = uint3(64u, 1u, 1u); 633 634 RWByteAddressBuffer _59 : register(u0); 635 636 static uint3 gl_GlobalInvocationID; 637 struct SPIRV_Cross_Input 638 { 639 uint3 gl_GlobalInvocationID : SV_DispatchThreadID; 640 }; 641 642 uint xorshift32(inout uint x) 643 { 644 x ^= (x << uint(13)); 645 x ^= (x >> uint(17)); 646 x ^= (x << uint(5)); 647 return x; 648 } 649 650 void comp_main() 651 { 652 uint param = 305419896u ^ gl_GlobalInvocationID.x; 653 uint _44 = xorshift32(param); 654 uint param_1 = _44; 655 uint _48 = xorshift32(param_1); 656 uint param_2 = _48; 657 uint _52 = xorshift32(param_2); 658 _59.Store4(gl_GlobalInvocationID.x * 32 + 0, asuint(0.0f.xxxx)); 659 _59.Store4(gl_GlobalInvocationID.x * 32 + 16, asuint(float4((float(_44 & 32767u) * 3.0518509447574615478515625e-05f) - 0.5f, (float(_48 & 32767u) * 1.52592547237873077392578125e-05f) + 2.0f, (float(_52 & 32767u) * 3.0518509447574615478515625e-05f) - 0.5f, 0.0f))); 660 } 661 662 [numthreads(64, 1, 1)] 663 void main(SPIRV_Cross_Input stage_input) 664 { 665 gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; 666 comp_main(); 667 } 668 */ 669 __gshared char[1120] CS_INIT_SOURCE_HLSL5 = [ 670 0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x0a, 671 0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x6f,0x73, 672 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x65,0x6c, 673 0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x63,0x6f,0x6e, 674 0x73,0x74,0x20,0x75,0x69,0x6e,0x74,0x33,0x20,0x67,0x6c,0x5f,0x57,0x6f,0x72,0x6b, 675 0x47,0x72,0x6f,0x75,0x70,0x53,0x69,0x7a,0x65,0x20,0x3d,0x20,0x75,0x69,0x6e,0x74, 676 0x33,0x28,0x36,0x34,0x75,0x2c,0x20,0x31,0x75,0x2c,0x20,0x31,0x75,0x29,0x3b,0x0a, 677 0x0a,0x52,0x57,0x42,0x79,0x74,0x65,0x41,0x64,0x64,0x72,0x65,0x73,0x73,0x42,0x75, 678 0x66,0x66,0x65,0x72,0x20,0x5f,0x35,0x39,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73, 679 0x74,0x65,0x72,0x28,0x75,0x30,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63, 680 0x20,0x75,0x69,0x6e,0x74,0x33,0x20,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c, 681 0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x3b,0x0a,0x73,0x74, 682 0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73, 683 0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e, 684 0x74,0x33,0x20,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f, 685 0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x20,0x3a,0x20,0x53,0x56,0x5f,0x44,0x69, 686 0x73,0x70,0x61,0x74,0x63,0x68,0x54,0x68,0x72,0x65,0x61,0x64,0x49,0x44,0x3b,0x0a, 687 0x7d,0x3b,0x0a,0x0a,0x75,0x69,0x6e,0x74,0x20,0x78,0x6f,0x72,0x73,0x68,0x69,0x66, 688 0x74,0x33,0x32,0x28,0x69,0x6e,0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x78, 689 0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x78,0x20,0x5e,0x3d,0x20,0x28,0x78,0x20, 690 0x3c,0x3c,0x20,0x75,0x69,0x6e,0x74,0x28,0x31,0x33,0x29,0x29,0x3b,0x0a,0x20,0x20, 691 0x20,0x20,0x78,0x20,0x5e,0x3d,0x20,0x28,0x78,0x20,0x3e,0x3e,0x20,0x75,0x69,0x6e, 692 0x74,0x28,0x31,0x37,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x78,0x20,0x5e,0x3d, 693 0x20,0x28,0x78,0x20,0x3c,0x3c,0x20,0x75,0x69,0x6e,0x74,0x28,0x35,0x29,0x29,0x3b, 694 0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x78,0x3b,0x0a,0x7d, 695 0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x63,0x6f,0x6d,0x70,0x5f,0x6d,0x61,0x69,0x6e, 696 0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x70,0x61, 697 0x72,0x61,0x6d,0x20,0x3d,0x20,0x33,0x30,0x35,0x34,0x31,0x39,0x38,0x39,0x36,0x75, 698 0x20,0x5e,0x20,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f, 699 0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20, 700 0x75,0x69,0x6e,0x74,0x20,0x5f,0x34,0x34,0x20,0x3d,0x20,0x78,0x6f,0x72,0x73,0x68, 701 0x69,0x66,0x74,0x33,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20, 702 0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d, 703 0x20,0x5f,0x34,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x5f, 704 0x34,0x38,0x20,0x3d,0x20,0x78,0x6f,0x72,0x73,0x68,0x69,0x66,0x74,0x33,0x32,0x28, 705 0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69, 706 0x6e,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x5f,0x34,0x38, 707 0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x5f,0x35,0x32,0x20,0x3d, 708 0x20,0x78,0x6f,0x72,0x73,0x68,0x69,0x66,0x74,0x33,0x32,0x28,0x70,0x61,0x72,0x61, 709 0x6d,0x5f,0x32,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x35,0x39,0x2e,0x53,0x74, 710 0x6f,0x72,0x65,0x34,0x28,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e, 711 0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x20,0x2a,0x20,0x33, 712 0x32,0x20,0x2b,0x20,0x30,0x2c,0x20,0x61,0x73,0x75,0x69,0x6e,0x74,0x28,0x30,0x2e, 713 0x30,0x66,0x2e,0x78,0x78,0x78,0x78,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f, 714 0x35,0x39,0x2e,0x53,0x74,0x6f,0x72,0x65,0x34,0x28,0x67,0x6c,0x5f,0x47,0x6c,0x6f, 715 0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e, 716 0x78,0x20,0x2a,0x20,0x33,0x32,0x20,0x2b,0x20,0x31,0x36,0x2c,0x20,0x61,0x73,0x75, 717 0x69,0x6e,0x74,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x28,0x66,0x6c,0x6f,0x61, 718 0x74,0x28,0x5f,0x34,0x34,0x20,0x26,0x20,0x33,0x32,0x37,0x36,0x37,0x75,0x29,0x20, 719 0x2a,0x20,0x33,0x2e,0x30,0x35,0x31,0x38,0x35,0x30,0x39,0x34,0x34,0x37,0x35,0x37, 720 0x34,0x36,0x31,0x35,0x34,0x37,0x38,0x35,0x31,0x35,0x36,0x32,0x35,0x65,0x2d,0x30, 721 0x35,0x66,0x29,0x20,0x2d,0x20,0x30,0x2e,0x35,0x66,0x2c,0x20,0x28,0x66,0x6c,0x6f, 722 0x61,0x74,0x28,0x5f,0x34,0x38,0x20,0x26,0x20,0x33,0x32,0x37,0x36,0x37,0x75,0x29, 723 0x20,0x2a,0x20,0x31,0x2e,0x35,0x32,0x35,0x39,0x32,0x35,0x34,0x37,0x32,0x33,0x37, 724 0x38,0x37,0x33,0x30,0x37,0x37,0x33,0x39,0x32,0x35,0x37,0x38,0x31,0x32,0x35,0x65, 725 0x2d,0x30,0x35,0x66,0x29,0x20,0x2b,0x20,0x32,0x2e,0x30,0x66,0x2c,0x20,0x28,0x66, 726 0x6c,0x6f,0x61,0x74,0x28,0x5f,0x35,0x32,0x20,0x26,0x20,0x33,0x32,0x37,0x36,0x37, 727 0x75,0x29,0x20,0x2a,0x20,0x33,0x2e,0x30,0x35,0x31,0x38,0x35,0x30,0x39,0x34,0x34, 728 0x37,0x35,0x37,0x34,0x36,0x31,0x35,0x34,0x37,0x38,0x35,0x31,0x35,0x36,0x32,0x35, 729 0x65,0x2d,0x30,0x35,0x66,0x29,0x20,0x2d,0x20,0x30,0x2e,0x35,0x66,0x2c,0x20,0x30, 730 0x2e,0x30,0x66,0x29,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x5b,0x6e,0x75,0x6d,0x74, 731 0x68,0x72,0x65,0x61,0x64,0x73,0x28,0x36,0x34,0x2c,0x20,0x31,0x2c,0x20,0x31,0x29, 732 0x5d,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52, 733 0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74, 734 0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20, 735 0x20,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61, 736 0x74,0x69,0x6f,0x6e,0x49,0x44,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69, 737 0x6e,0x70,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e, 738 0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x3b,0x0a,0x20,0x20,0x20,0x20, 739 0x63,0x6f,0x6d,0x70,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x7d,0x0a,0x00, 740 741 ]; 742 /* 743 struct particle 744 { 745 float4 pos; 746 float4 vel; 747 }; 748 749 static const uint3 gl_WorkGroupSize = uint3(64u, 1u, 1u); 750 751 cbuffer cs_params : register(b0) 752 { 753 float _21_dt : packoffset(c0); 754 int _21_num_particles : packoffset(c0.y); 755 }; 756 757 RWByteAddressBuffer _39 : register(u0); 758 759 static uint3 gl_GlobalInvocationID; 760 struct SPIRV_Cross_Input 761 { 762 uint3 gl_GlobalInvocationID : SV_DispatchThreadID; 763 }; 764 765 void comp_main() 766 { 767 if (gl_GlobalInvocationID.x >= uint(_21_num_particles)) 768 { 769 return; 770 } 771 float4 _48 = asfloat(_39.Load4(gl_GlobalInvocationID.x * 32 + 16)); 772 _48.y = _48.y - _21_dt; 773 float4 vel = _48; 774 float4 _65 = asfloat(_39.Load4(gl_GlobalInvocationID.x * 32 + 0)) + (_48 * _21_dt); 775 float4 pos = _65; 776 if (_65.y < (-2.0f)) 777 { 778 float4 _92 = pos; 779 _92.y = -1.7999999523162841796875f; 780 pos = _92; 781 vel *= float4(0.800000011920928955078125f, -0.800000011920928955078125f, 0.800000011920928955078125f, 0.0f); 782 } 783 _39.Store4(gl_GlobalInvocationID.x * 32 + 0, asuint(pos)); 784 _39.Store4(gl_GlobalInvocationID.x * 32 + 16, asuint(vel)); 785 } 786 787 [numthreads(64, 1, 1)] 788 void main(SPIRV_Cross_Input stage_input) 789 { 790 gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; 791 comp_main(); 792 } 793 */ 794 __gshared char[1257] CS_UPDATE_SOURCE_HLSL5 = [ 795 0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x0a, 796 0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x6f,0x73, 797 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x65,0x6c, 798 0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x63,0x6f,0x6e, 799 0x73,0x74,0x20,0x75,0x69,0x6e,0x74,0x33,0x20,0x67,0x6c,0x5f,0x57,0x6f,0x72,0x6b, 800 0x47,0x72,0x6f,0x75,0x70,0x53,0x69,0x7a,0x65,0x20,0x3d,0x20,0x75,0x69,0x6e,0x74, 801 0x33,0x28,0x36,0x34,0x75,0x2c,0x20,0x31,0x75,0x2c,0x20,0x31,0x75,0x29,0x3b,0x0a, 802 0x0a,0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x63,0x73,0x5f,0x70,0x61,0x72,0x61, 803 0x6d,0x73,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30, 804 0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x32, 805 0x31,0x5f,0x64,0x74,0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65, 806 0x74,0x28,0x63,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x74,0x20,0x5f, 807 0x32,0x31,0x5f,0x6e,0x75,0x6d,0x5f,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73, 808 0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x63,0x30, 809 0x2e,0x79,0x29,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x52,0x57,0x42,0x79,0x74,0x65,0x41, 810 0x64,0x64,0x72,0x65,0x73,0x73,0x42,0x75,0x66,0x66,0x65,0x72,0x20,0x5f,0x33,0x39, 811 0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x75,0x30,0x29,0x3b, 812 0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x75,0x69,0x6e,0x74,0x33,0x20,0x67, 813 0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69, 814 0x6f,0x6e,0x49,0x44,0x3b,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49, 815 0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b, 816 0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x33,0x20,0x67,0x6c,0x5f,0x47,0x6c, 817 0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44, 818 0x20,0x3a,0x20,0x53,0x56,0x5f,0x44,0x69,0x73,0x70,0x61,0x74,0x63,0x68,0x54,0x68, 819 0x72,0x65,0x61,0x64,0x49,0x44,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64, 820 0x20,0x63,0x6f,0x6d,0x70,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20, 821 0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c, 822 0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x20,0x3e, 823 0x3d,0x20,0x75,0x69,0x6e,0x74,0x28,0x5f,0x32,0x31,0x5f,0x6e,0x75,0x6d,0x5f,0x70, 824 0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x29,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b, 825 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b, 826 0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, 827 0x34,0x20,0x5f,0x34,0x38,0x20,0x3d,0x20,0x61,0x73,0x66,0x6c,0x6f,0x61,0x74,0x28, 828 0x5f,0x33,0x39,0x2e,0x4c,0x6f,0x61,0x64,0x34,0x28,0x67,0x6c,0x5f,0x47,0x6c,0x6f, 829 0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e, 830 0x78,0x20,0x2a,0x20,0x33,0x32,0x20,0x2b,0x20,0x31,0x36,0x29,0x29,0x3b,0x0a,0x20, 831 0x20,0x20,0x20,0x5f,0x34,0x38,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x34,0x38,0x2e,0x79, 832 0x20,0x2d,0x20,0x5f,0x32,0x31,0x5f,0x64,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, 833 0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x65,0x6c,0x20,0x3d,0x20,0x5f,0x34,0x38,0x3b, 834 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x36,0x35,0x20, 835 0x3d,0x20,0x61,0x73,0x66,0x6c,0x6f,0x61,0x74,0x28,0x5f,0x33,0x39,0x2e,0x4c,0x6f, 836 0x61,0x64,0x34,0x28,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76, 837 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x20,0x2a,0x20,0x33,0x32, 838 0x20,0x2b,0x20,0x30,0x29,0x29,0x20,0x2b,0x20,0x28,0x5f,0x34,0x38,0x20,0x2a,0x20, 839 0x5f,0x32,0x31,0x5f,0x64,0x74,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, 840 0x61,0x74,0x34,0x20,0x70,0x6f,0x73,0x20,0x3d,0x20,0x5f,0x36,0x35,0x3b,0x0a,0x20, 841 0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x36,0x35,0x2e,0x79,0x20,0x3c,0x20,0x28, 842 0x2d,0x32,0x2e,0x30,0x66,0x29,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20, 843 0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x39,0x32, 844 0x20,0x3d,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 845 0x5f,0x39,0x32,0x2e,0x79,0x20,0x3d,0x20,0x2d,0x31,0x2e,0x37,0x39,0x39,0x39,0x39, 846 0x39,0x39,0x35,0x32,0x33,0x31,0x36,0x32,0x38,0x34,0x31,0x37,0x39,0x36,0x38,0x37, 847 0x35,0x66,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x6f,0x73,0x20, 848 0x3d,0x20,0x5f,0x39,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76, 849 0x65,0x6c,0x20,0x2a,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x30,0x2e,0x38, 850 0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35, 851 0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x2d,0x30,0x2e,0x38,0x30,0x30, 852 0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30, 853 0x37,0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30, 854 0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31, 855 0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, 856 0x7d,0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x39,0x2e,0x53,0x74,0x6f,0x72,0x65,0x34, 857 0x28,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61, 858 0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x20,0x2a,0x20,0x33,0x32,0x20,0x2b,0x20, 859 0x30,0x2c,0x20,0x61,0x73,0x75,0x69,0x6e,0x74,0x28,0x70,0x6f,0x73,0x29,0x29,0x3b, 860 0x0a,0x20,0x20,0x20,0x20,0x5f,0x33,0x39,0x2e,0x53,0x74,0x6f,0x72,0x65,0x34,0x28, 861 0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74, 862 0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x20,0x2a,0x20,0x33,0x32,0x20,0x2b,0x20,0x31, 863 0x36,0x2c,0x20,0x61,0x73,0x75,0x69,0x6e,0x74,0x28,0x76,0x65,0x6c,0x29,0x29,0x3b, 864 0x0a,0x7d,0x0a,0x0a,0x5b,0x6e,0x75,0x6d,0x74,0x68,0x72,0x65,0x61,0x64,0x73,0x28, 865 0x36,0x34,0x2c,0x20,0x31,0x2c,0x20,0x31,0x29,0x5d,0x0a,0x76,0x6f,0x69,0x64,0x20, 866 0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73, 867 0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70, 868 0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x47,0x6c,0x6f, 869 0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x20, 870 0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x67,0x6c, 871 0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f, 872 0x6e,0x49,0x44,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6d,0x70,0x5f,0x6d,0x61, 873 0x69,0x6e,0x28,0x29,0x3b,0x0a,0x7d,0x0a,0x00, 874 ]; 875 /* 876 struct particle 877 { 878 float4 pos; 879 float4 vel; 880 }; 881 882 ByteAddressBuffer _15 : register(t16); 883 cbuffer vs_params : register(b0) 884 { 885 row_major float4x4 _46_mvp : packoffset(c0); 886 }; 887 888 889 static float4 gl_Position; 890 static int gl_InstanceIndex; 891 static float3 pos; 892 static float4 color; 893 static float4 color0; 894 895 struct SPIRV_Cross_Input 896 { 897 float3 pos : TEXCOORD0; 898 float4 color0 : TEXCOORD1; 899 uint gl_InstanceIndex : SV_InstanceID; 900 }; 901 902 struct SPIRV_Cross_Output 903 { 904 float4 color : TEXCOORD0; 905 float4 gl_Position : SV_Position; 906 }; 907 908 void vert_main() 909 { 910 gl_Position = mul(float4(pos + asfloat(_15.Load4(gl_InstanceIndex * 32 + 0)).xyz, 1.0f), _46_mvp); 911 color = color0; 912 } 913 914 SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) 915 { 916 gl_InstanceIndex = int(stage_input.gl_InstanceIndex); 917 pos = stage_input.pos; 918 color0 = stage_input.color0; 919 vert_main(); 920 SPIRV_Cross_Output stage_output; 921 stage_output.gl_Position = gl_Position; 922 stage_output.color = color; 923 return stage_output; 924 } 925 */ 926 __gshared char[1012] VS_SOURCE_HLSL5 = [ 927 0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x0a, 928 0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x6f,0x73, 929 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x65,0x6c, 930 0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x42,0x79,0x74,0x65,0x41,0x64,0x64,0x72,0x65,0x73, 931 0x73,0x42,0x75,0x66,0x66,0x65,0x72,0x20,0x5f,0x31,0x35,0x20,0x3a,0x20,0x72,0x65, 932 0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x74,0x31,0x36,0x29,0x3b,0x0a,0x63,0x62,0x75, 933 0x66,0x66,0x65,0x72,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x3a, 934 0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,0x0a, 935 0x20,0x20,0x20,0x20,0x72,0x6f,0x77,0x5f,0x6d,0x61,0x6a,0x6f,0x72,0x20,0x66,0x6c, 936 0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x5f,0x34,0x36,0x5f,0x6d,0x76,0x70,0x20,0x3a, 937 0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x63,0x30,0x29,0x3b, 938 0x0a,0x7d,0x3b,0x0a,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f, 939 0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b, 940 0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,0x49, 941 0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x3b,0x0a,0x73,0x74, 942 0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x6f,0x73,0x3b, 943 0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63, 944 0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f, 945 0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x0a,0x73,0x74,0x72, 946 0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f, 947 0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, 948 0x74,0x33,0x20,0x70,0x6f,0x73,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52, 949 0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63, 950 0x6f,0x6c,0x6f,0x72,0x30,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44, 951 0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,0x49, 952 0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x20,0x3a,0x20,0x53, 953 0x56,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x44,0x3b,0x0a,0x7d,0x3b, 954 0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43, 955 0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20, 956 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a, 957 0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20, 958 0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69, 959 0x6f,0x6e,0x20,0x3a,0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, 960 0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f, 961 0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f, 962 0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x75,0x6c,0x28,0x66, 963 0x6c,0x6f,0x61,0x74,0x34,0x28,0x70,0x6f,0x73,0x20,0x2b,0x20,0x61,0x73,0x66,0x6c, 964 0x6f,0x61,0x74,0x28,0x5f,0x31,0x35,0x2e,0x4c,0x6f,0x61,0x64,0x34,0x28,0x67,0x6c, 965 0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x20,0x2a, 966 0x20,0x33,0x32,0x20,0x2b,0x20,0x30,0x29,0x29,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x31, 967 0x2e,0x30,0x66,0x29,0x2c,0x20,0x5f,0x34,0x36,0x5f,0x6d,0x76,0x70,0x29,0x3b,0x0a, 968 0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f, 969 0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f, 970 0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53, 971 0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74, 972 0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a, 973 0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49, 974 0x6e,0x64,0x65,0x78,0x20,0x3d,0x20,0x69,0x6e,0x74,0x28,0x73,0x74,0x61,0x67,0x65, 975 0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e, 976 0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70,0x6f, 977 0x73,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e, 978 0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20, 979 0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x63,0x6f, 980 0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d, 981 0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56, 982 0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74, 983 0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20, 984 0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x67,0x6c,0x5f, 985 0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c,0x5f,0x50,0x6f, 986 0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67, 987 0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, 988 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75, 989 0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b, 990 0x0a,0x7d,0x0a,0x00, 991 ]; 992 /* 993 static float4 frag_color; 994 static float4 color; 995 996 struct SPIRV_Cross_Input 997 { 998 float4 color : TEXCOORD0; 999 }; 1000 1001 struct SPIRV_Cross_Output 1002 { 1003 float4 frag_color : SV_Target0; 1004 }; 1005 1006 void frag_main() 1007 { 1008 frag_color = color; 1009 } 1010 1011 SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) 1012 { 1013 color = stage_input.color; 1014 frag_main(); 1015 SPIRV_Cross_Output stage_output; 1016 stage_output.frag_color = frag_color; 1017 return stage_output; 1018 } 1019 */ 1020 __gshared char[435] FS_SOURCE_HLSL5 = [ 1021 0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72, 1022 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63, 1023 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a, 1024 0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f, 1025 0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, 1026 0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x54,0x45, 1027 0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72, 1028 0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f, 1029 0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, 1030 0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a, 1031 0x20,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65,0x74,0x30,0x3b,0x0a,0x7d,0x3b,0x0a, 1032 0x0a,0x76,0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28, 1033 0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, 1034 0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x53, 1035 0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75, 1036 0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f, 1037 0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69, 1038 0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f, 1039 0x72,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e, 1040 0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f, 1041 0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52, 1042 0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73, 1043 0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20, 1044 0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x72, 1045 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f, 1046 0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72, 1047 0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a, 1048 0x7d,0x0a,0x00, 1049 ]; 1050 /* 1051 #pragma clang diagnostic ignored "-Wmissing-prototypes" 1052 1053 #include <metal_stdlib> 1054 #include <simd/simd.h> 1055 1056 using namespace metal; 1057 1058 struct particle 1059 { 1060 float4 pos; 1061 float4 vel; 1062 }; 1063 1064 struct cs_ssbo 1065 { 1066 particle prt[1]; 1067 }; 1068 1069 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(64u, 1u, 1u); 1070 1071 static inline __attribute__((always_inline)) 1072 uint xorshift32(thread uint& x) 1073 { 1074 x ^= (x << uint(13)); 1075 x ^= (x >> uint(17)); 1076 x ^= (x << uint(5)); 1077 return x; 1078 } 1079 1080 kernel void main0(device cs_ssbo& _59 [[buffer(8)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) 1081 { 1082 uint param = 305419896u ^ gl_GlobalInvocationID.x; 1083 uint _44 = xorshift32(param); 1084 uint param_1 = _44; 1085 uint _48 = xorshift32(param_1); 1086 uint param_2 = _48; 1087 uint _52 = xorshift32(param_2); 1088 _59.prt[gl_GlobalInvocationID.x].pos = float4(0.0); 1089 _59.prt[gl_GlobalInvocationID.x].vel = float4((float(_44 & 32767u) * 3.0518509447574615478515625e-05) - 0.5, (float(_48 & 32767u) * 1.52592547237873077392578125e-05) + 2.0, (float(_52 & 32767u) * 3.0518509447574615478515625e-05) - 0.5, 0.0); 1090 } 1091 1092 */ 1093 __gshared char[1097] CS_INIT_SOURCE_METAL_MACOS = [ 1094 0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x63,0x6c,0x61,0x6e,0x67,0x20,0x64,0x69, 1095 0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x20,0x69,0x67,0x6e,0x6f,0x72,0x65,0x64, 1096 0x20,0x22,0x2d,0x57,0x6d,0x69,0x73,0x73,0x69,0x6e,0x67,0x2d,0x70,0x72,0x6f,0x74, 1097 0x6f,0x74,0x79,0x70,0x65,0x73,0x22,0x0a,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64, 1098 0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,0x73,0x74,0x64,0x6c,0x69,0x62,0x3e, 1099 0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f, 1100 0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,0x75,0x73,0x69,0x6e,0x67,0x20,0x6e, 1101 0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a, 1102 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65, 1103 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x6f, 1104 0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x65, 1105 0x6c,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x63,0x73, 1106 0x5f,0x73,0x73,0x62,0x6f,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x70,0x61,0x72,0x74, 1107 0x69,0x63,0x6c,0x65,0x20,0x70,0x72,0x74,0x5b,0x31,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a, 1108 0x0a,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x75,0x69,0x6e,0x74,0x33,0x20, 1109 0x67,0x6c,0x5f,0x57,0x6f,0x72,0x6b,0x47,0x72,0x6f,0x75,0x70,0x53,0x69,0x7a,0x65, 1110 0x20,0x5b,0x5b,0x6d,0x61,0x79,0x62,0x65,0x5f,0x75,0x6e,0x75,0x73,0x65,0x64,0x5d, 1111 0x5d,0x20,0x3d,0x20,0x75,0x69,0x6e,0x74,0x33,0x28,0x36,0x34,0x75,0x2c,0x20,0x31, 1112 0x75,0x2c,0x20,0x31,0x75,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20, 1113 0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x5f,0x5f,0x61,0x74,0x74,0x72,0x69,0x62,0x75, 1114 0x74,0x65,0x5f,0x5f,0x28,0x28,0x61,0x6c,0x77,0x61,0x79,0x73,0x5f,0x69,0x6e,0x6c, 1115 0x69,0x6e,0x65,0x29,0x29,0x0a,0x75,0x69,0x6e,0x74,0x20,0x78,0x6f,0x72,0x73,0x68, 1116 0x69,0x66,0x74,0x33,0x32,0x28,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x75,0x69,0x6e, 1117 0x74,0x26,0x20,0x78,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x78,0x20,0x5e,0x3d, 1118 0x20,0x28,0x78,0x20,0x3c,0x3c,0x20,0x75,0x69,0x6e,0x74,0x28,0x31,0x33,0x29,0x29, 1119 0x3b,0x0a,0x20,0x20,0x20,0x20,0x78,0x20,0x5e,0x3d,0x20,0x28,0x78,0x20,0x3e,0x3e, 1120 0x20,0x75,0x69,0x6e,0x74,0x28,0x31,0x37,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, 1121 0x78,0x20,0x5e,0x3d,0x20,0x28,0x78,0x20,0x3c,0x3c,0x20,0x75,0x69,0x6e,0x74,0x28, 1122 0x35,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20, 1123 0x78,0x3b,0x0a,0x7d,0x0a,0x0a,0x6b,0x65,0x72,0x6e,0x65,0x6c,0x20,0x76,0x6f,0x69, 1124 0x64,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x64,0x65,0x76,0x69,0x63,0x65,0x20,0x63, 1125 0x73,0x5f,0x73,0x73,0x62,0x6f,0x26,0x20,0x5f,0x35,0x39,0x20,0x5b,0x5b,0x62,0x75, 1126 0x66,0x66,0x65,0x72,0x28,0x38,0x29,0x5d,0x5d,0x2c,0x20,0x75,0x69,0x6e,0x74,0x33, 1127 0x20,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61, 1128 0x74,0x69,0x6f,0x6e,0x49,0x44,0x20,0x5b,0x5b,0x74,0x68,0x72,0x65,0x61,0x64,0x5f, 1129 0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x69,0x6e,0x5f,0x67,0x72,0x69,0x64, 1130 0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x70, 1131 0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x33,0x30,0x35,0x34,0x31,0x39,0x38,0x39,0x36, 1132 0x75,0x20,0x5e,0x20,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76, 1133 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20, 1134 0x20,0x75,0x69,0x6e,0x74,0x20,0x5f,0x34,0x34,0x20,0x3d,0x20,0x78,0x6f,0x72,0x73, 1135 0x68,0x69,0x66,0x74,0x33,0x32,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20, 1136 0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20, 1137 0x3d,0x20,0x5f,0x34,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20, 1138 0x5f,0x34,0x38,0x20,0x3d,0x20,0x78,0x6f,0x72,0x73,0x68,0x69,0x66,0x74,0x33,0x32, 1139 0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75, 1140 0x69,0x6e,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x5f,0x34, 1141 0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x5f,0x35,0x32,0x20, 1142 0x3d,0x20,0x78,0x6f,0x72,0x73,0x68,0x69,0x66,0x74,0x33,0x32,0x28,0x70,0x61,0x72, 1143 0x61,0x6d,0x5f,0x32,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x35,0x39,0x2e,0x70, 1144 0x72,0x74,0x5b,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f, 1145 0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x5d,0x2e,0x70,0x6f,0x73,0x20, 1146 0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x30,0x2e,0x30,0x29,0x3b,0x0a,0x20, 1147 0x20,0x20,0x20,0x5f,0x35,0x39,0x2e,0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f,0x47,0x6c, 1148 0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44, 1149 0x2e,0x78,0x5d,0x2e,0x76,0x65,0x6c,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34, 1150 0x28,0x28,0x66,0x6c,0x6f,0x61,0x74,0x28,0x5f,0x34,0x34,0x20,0x26,0x20,0x33,0x32, 1151 0x37,0x36,0x37,0x75,0x29,0x20,0x2a,0x20,0x33,0x2e,0x30,0x35,0x31,0x38,0x35,0x30, 1152 0x39,0x34,0x34,0x37,0x35,0x37,0x34,0x36,0x31,0x35,0x34,0x37,0x38,0x35,0x31,0x35, 1153 0x36,0x32,0x35,0x65,0x2d,0x30,0x35,0x29,0x20,0x2d,0x20,0x30,0x2e,0x35,0x2c,0x20, 1154 0x28,0x66,0x6c,0x6f,0x61,0x74,0x28,0x5f,0x34,0x38,0x20,0x26,0x20,0x33,0x32,0x37, 1155 0x36,0x37,0x75,0x29,0x20,0x2a,0x20,0x31,0x2e,0x35,0x32,0x35,0x39,0x32,0x35,0x34, 1156 0x37,0x32,0x33,0x37,0x38,0x37,0x33,0x30,0x37,0x37,0x33,0x39,0x32,0x35,0x37,0x38, 1157 0x31,0x32,0x35,0x65,0x2d,0x30,0x35,0x29,0x20,0x2b,0x20,0x32,0x2e,0x30,0x2c,0x20, 1158 0x28,0x66,0x6c,0x6f,0x61,0x74,0x28,0x5f,0x35,0x32,0x20,0x26,0x20,0x33,0x32,0x37, 1159 0x36,0x37,0x75,0x29,0x20,0x2a,0x20,0x33,0x2e,0x30,0x35,0x31,0x38,0x35,0x30,0x39, 1160 0x34,0x34,0x37,0x35,0x37,0x34,0x36,0x31,0x35,0x34,0x37,0x38,0x35,0x31,0x35,0x36, 1161 0x32,0x35,0x65,0x2d,0x30,0x35,0x29,0x20,0x2d,0x20,0x30,0x2e,0x35,0x2c,0x20,0x30, 1162 0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 1163 ]; 1164 /* 1165 #include <metal_stdlib> 1166 #include <simd/simd.h> 1167 1168 using namespace metal; 1169 1170 struct cs_params 1171 { 1172 float dt; 1173 int num_particles; 1174 }; 1175 1176 struct particle 1177 { 1178 float4 pos; 1179 float4 vel; 1180 }; 1181 1182 struct cs_ssbo 1183 { 1184 particle prt[1]; 1185 }; 1186 1187 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(64u, 1u, 1u); 1188 1189 kernel void main0(constant cs_params& _21 [[buffer(0)]], device cs_ssbo& _39 [[buffer(8)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) 1190 { 1191 if (gl_GlobalInvocationID.x >= uint(_21.num_particles)) 1192 { 1193 return; 1194 } 1195 float4 _48 = _39.prt[gl_GlobalInvocationID.x].vel; 1196 _48.y = _48.y - _21.dt; 1197 float4 vel = _48; 1198 float4 _65 = _39.prt[gl_GlobalInvocationID.x].pos + (_48 * _21.dt); 1199 float4 pos = _65; 1200 if (_65.y < (-2.0)) 1201 { 1202 float4 _92 = pos; 1203 _92.y = -1.7999999523162841796875; 1204 pos = _92; 1205 vel *= float4(0.800000011920928955078125, -0.800000011920928955078125, 0.800000011920928955078125, 0.0); 1206 } 1207 _39.prt[gl_GlobalInvocationID.x].pos = pos; 1208 _39.prt[gl_GlobalInvocationID.x].vel = vel; 1209 } 1210 1211 */ 1212 __gshared char[1075] CS_UPDATE_SOURCE_METAL_MACOS = [ 1213 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 1214 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 1215 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, 1216 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, 1217 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x63, 1218 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, 1219 0x6c,0x6f,0x61,0x74,0x20,0x64,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x74, 1220 0x20,0x6e,0x75,0x6d,0x5f,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x3b,0x0a, 1221 0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x70,0x61,0x72,0x74,0x69, 1222 0x63,0x6c,0x65,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34, 1223 0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34, 1224 0x20,0x76,0x65,0x6c,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74, 1225 0x20,0x63,0x73,0x5f,0x73,0x73,0x62,0x6f,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x70, 1226 0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x20,0x70,0x72,0x74,0x5b,0x31,0x5d,0x3b,0x0a, 1227 0x7d,0x3b,0x0a,0x0a,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x75,0x69,0x6e, 1228 0x74,0x33,0x20,0x67,0x6c,0x5f,0x57,0x6f,0x72,0x6b,0x47,0x72,0x6f,0x75,0x70,0x53, 1229 0x69,0x7a,0x65,0x20,0x5b,0x5b,0x6d,0x61,0x79,0x62,0x65,0x5f,0x75,0x6e,0x75,0x73, 1230 0x65,0x64,0x5d,0x5d,0x20,0x3d,0x20,0x75,0x69,0x6e,0x74,0x33,0x28,0x36,0x34,0x75, 1231 0x2c,0x20,0x31,0x75,0x2c,0x20,0x31,0x75,0x29,0x3b,0x0a,0x0a,0x6b,0x65,0x72,0x6e, 1232 0x65,0x6c,0x20,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x63,0x6f, 1233 0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x63,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, 1234 0x26,0x20,0x5f,0x32,0x31,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30, 1235 0x29,0x5d,0x5d,0x2c,0x20,0x64,0x65,0x76,0x69,0x63,0x65,0x20,0x63,0x73,0x5f,0x73, 1236 0x73,0x62,0x6f,0x26,0x20,0x5f,0x33,0x39,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65, 1237 0x72,0x28,0x38,0x29,0x5d,0x5d,0x2c,0x20,0x75,0x69,0x6e,0x74,0x33,0x20,0x67,0x6c, 1238 0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f, 1239 0x6e,0x49,0x44,0x20,0x5b,0x5b,0x74,0x68,0x72,0x65,0x61,0x64,0x5f,0x70,0x6f,0x73, 1240 0x69,0x74,0x69,0x6f,0x6e,0x5f,0x69,0x6e,0x5f,0x67,0x72,0x69,0x64,0x5d,0x5d,0x29, 1241 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x67,0x6c,0x5f,0x47,0x6c, 1242 0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44, 1243 0x2e,0x78,0x20,0x3e,0x3d,0x20,0x75,0x69,0x6e,0x74,0x28,0x5f,0x32,0x31,0x2e,0x6e, 1244 0x75,0x6d,0x5f,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x29,0x29,0x0a,0x20, 1245 0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74, 1246 0x75,0x72,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66, 1247 0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x34,0x38,0x20,0x3d,0x20,0x5f,0x33,0x39,0x2e, 1248 0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76, 1249 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78,0x5d,0x2e,0x76,0x65,0x6c, 1250 0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x34,0x38,0x2e,0x79,0x20,0x3d,0x20,0x5f,0x34, 1251 0x38,0x2e,0x79,0x20,0x2d,0x20,0x5f,0x32,0x31,0x2e,0x64,0x74,0x3b,0x0a,0x20,0x20, 1252 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x65,0x6c,0x20,0x3d,0x20,0x5f, 1253 0x34,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f, 1254 0x36,0x35,0x20,0x3d,0x20,0x5f,0x33,0x39,0x2e,0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f, 1255 0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, 1256 0x49,0x44,0x2e,0x78,0x5d,0x2e,0x70,0x6f,0x73,0x20,0x2b,0x20,0x28,0x5f,0x34,0x38, 1257 0x20,0x2a,0x20,0x5f,0x32,0x31,0x2e,0x64,0x74,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, 1258 0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x6f,0x73,0x20,0x3d,0x20,0x5f,0x36,0x35, 1259 0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x36,0x35,0x2e,0x79,0x20, 1260 0x3c,0x20,0x28,0x2d,0x32,0x2e,0x30,0x29,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a, 1261 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f, 1262 0x39,0x32,0x20,0x3d,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, 1263 0x20,0x20,0x5f,0x39,0x32,0x2e,0x79,0x20,0x3d,0x20,0x2d,0x31,0x2e,0x37,0x39,0x39, 1264 0x39,0x39,0x39,0x39,0x35,0x32,0x33,0x31,0x36,0x32,0x38,0x34,0x31,0x37,0x39,0x36, 1265 0x38,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x6f,0x73, 1266 0x20,0x3d,0x20,0x5f,0x39,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 1267 0x76,0x65,0x6c,0x20,0x2a,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x30,0x2e, 1268 0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39, 1269 0x35,0x35,0x30,0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x38,0x30,0x30, 1270 0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30, 1271 0x37,0x38,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30,0x30, 1272 0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x37,0x38,0x31,0x32, 1273 0x35,0x2c,0x20,0x30,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20, 1274 0x20,0x20,0x20,0x5f,0x33,0x39,0x2e,0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f,0x47,0x6c, 1275 0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44, 1276 0x2e,0x78,0x5d,0x2e,0x70,0x6f,0x73,0x20,0x3d,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20, 1277 0x20,0x20,0x20,0x5f,0x33,0x39,0x2e,0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f,0x47,0x6c, 1278 0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44, 1279 0x2e,0x78,0x5d,0x2e,0x76,0x65,0x6c,0x20,0x3d,0x20,0x76,0x65,0x6c,0x3b,0x0a,0x7d, 1280 0x0a,0x0a,0x00, 1281 ]; 1282 /* 1283 #include <metal_stdlib> 1284 #include <simd/simd.h> 1285 1286 using namespace metal; 1287 1288 struct particle 1289 { 1290 float4 pos; 1291 float4 vel; 1292 }; 1293 1294 struct vs_ssbo 1295 { 1296 particle prt[1]; 1297 }; 1298 1299 struct vs_params 1300 { 1301 float4x4 mvp; 1302 }; 1303 1304 struct main0_out 1305 { 1306 float4 color [[user(locn0)]]; 1307 float4 gl_Position [[position]]; 1308 }; 1309 1310 struct main0_in 1311 { 1312 float3 pos [[attribute(0)]]; 1313 float4 color0 [[attribute(1)]]; 1314 }; 1315 1316 vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _46 [[buffer(0)]], const device vs_ssbo& _15 [[buffer(8)]], uint gl_InstanceIndex [[instance_id]]) 1317 { 1318 main0_out out = {}; 1319 out.gl_Position = _46.mvp * float4(in.pos + _15.prt[int(gl_InstanceIndex)].pos.xyz, 1.0); 1320 out.color = in.color0; 1321 return out; 1322 } 1323 1324 */ 1325 __gshared char[729] VS_SOURCE_METAL_MACOS = [ 1326 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 1327 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 1328 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, 1329 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, 1330 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x70, 1331 0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, 1332 0x6f,0x61,0x74,0x34,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, 1333 0x6f,0x61,0x74,0x34,0x20,0x76,0x65,0x6c,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74, 1334 0x72,0x75,0x63,0x74,0x20,0x76,0x73,0x5f,0x73,0x73,0x62,0x6f,0x0a,0x7b,0x0a,0x20, 1335 0x20,0x20,0x20,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x20,0x70,0x72,0x74,0x5b, 1336 0x31,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x76, 1337 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, 1338 0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x6d,0x76,0x70,0x3b,0x0a,0x7d,0x3b,0x0a, 1339 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75, 1340 0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63, 1341 0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e, 1342 0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34, 1343 0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x70, 1344 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73, 1345 0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b, 1346 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x6f,0x73,0x20, 1347 0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x30,0x29,0x5d,0x5d, 1348 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c, 1349 0x6f,0x72,0x30,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28, 1350 0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,0x78, 1351 0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30, 1352 0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73, 1353 0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74, 1354 0x61,0x6e,0x74,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f, 1355 0x34,0x36,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d, 1356 0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x64,0x65,0x76,0x69,0x63,0x65,0x20,0x76, 1357 0x73,0x5f,0x73,0x73,0x62,0x6f,0x26,0x20,0x5f,0x31,0x35,0x20,0x5b,0x5b,0x62,0x75, 1358 0x66,0x66,0x65,0x72,0x28,0x38,0x29,0x5d,0x5d,0x2c,0x20,0x75,0x69,0x6e,0x74,0x20, 1359 0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78, 1360 0x20,0x5b,0x5b,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x5f,0x69,0x64,0x5d,0x5d, 1361 0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75, 1362 0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20, 1363 0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20, 1364 0x3d,0x20,0x5f,0x34,0x36,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61, 1365 0x74,0x34,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x20,0x2b,0x20,0x5f,0x31,0x35,0x2e, 1366 0x70,0x72,0x74,0x5b,0x69,0x6e,0x74,0x28,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61, 1367 0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x29,0x5d,0x2e,0x70,0x6f,0x73,0x2e,0x78, 1368 0x79,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75, 1369 0x74,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c, 1370 0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20, 1371 0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 1372 ]; 1373 /* 1374 #include <metal_stdlib> 1375 #include <simd/simd.h> 1376 1377 using namespace metal; 1378 1379 struct main0_out 1380 { 1381 float4 frag_color [[color(0)]]; 1382 }; 1383 1384 struct main0_in 1385 { 1386 float4 color [[user(locn0)]]; 1387 }; 1388 1389 fragment main0_out main0(main0_in in [[stage_in]]) 1390 { 1391 main0_out out = {}; 1392 out.frag_color = in.color; 1393 return out; 1394 } 1395 1396 */ 1397 __gshared char[315] FS_SOURCE_METAL_MACOS = [ 1398 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 1399 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 1400 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, 1401 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, 1402 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d, 1403 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, 1404 0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, 1405 0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d, 1406 0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f, 1407 0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20, 1408 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63, 1409 0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d, 1410 0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61, 1411 0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20, 1412 0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x29,0x0a,0x7b,0x0a, 1413 0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75, 1414 0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e, 1415 0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x69,0x6e,0x2e, 1416 0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72, 1417 0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 1418 ]; 1419 /* 1420 diagnostic(off, derivative_uniformity); 1421 1422 struct particle { 1423 /_ @offset(0) _/ 1424 pos : vec4f, 1425 /_ @offset(16) _/ 1426 vel : vec4f, 1427 } 1428 1429 alias RTArr = array<particle>; 1430 1431 struct cs_ssbo { 1432 /_ @offset(0) _/ 1433 prt : RTArr, 1434 } 1435 1436 var<private> gl_GlobalInvocationID : vec3u; 1437 1438 @binding(32) @group(1) var<storage, read_write> x_59 : cs_ssbo; 1439 1440 fn xorshift32_u1_(x : ptr<function, u32>) -> u32 { 1441 *(x) = (*(x) ^ (*(x) << bitcast<u32>(13i))); 1442 *(x) = (*(x) ^ (*(x) >> bitcast<u32>(17i))); 1443 *(x) = (*(x) ^ (*(x) << bitcast<u32>(5i))); 1444 let x_28 = *(x); 1445 return x_28; 1446 } 1447 1448 fn main_1() { 1449 var idx : u32; 1450 var x_1 : u32; 1451 var param : u32; 1452 var y : u32; 1453 var param_1 : u32; 1454 var z : u32; 1455 var param_2 : u32; 1456 idx = gl_GlobalInvocationID.x; 1457 param = (305419896u ^ idx); 1458 let x_44 = xorshift32_u1_(&(param)); 1459 x_1 = x_44; 1460 param_1 = x_1; 1461 let x_48 = xorshift32_u1_(&(param_1)); 1462 y = x_48; 1463 param_2 = y; 1464 let x_52 = xorshift32_u1_(&(param_2)); 1465 z = x_52; 1466 let x_61 = idx; 1467 x_59.prt[x_61].pos = vec4f(); 1468 let x_66 = idx; 1469 x_59.prt[x_66].vel = vec4f(((f32((x_1 & 32767u)) / 32767.0f) - 0.5f), (((f32((y & 32767u)) / 32767.0f) * 0.5f) + 2.0f), ((f32((z & 32767u)) / 32767.0f) - 0.5f), 0.0f); 1470 return; 1471 } 1472 1473 @compute @workgroup_size(64i, 1i, 1i) 1474 fn main(@builtin(global_invocation_id) gl_GlobalInvocationID_param : vec3u) { 1475 gl_GlobalInvocationID = gl_GlobalInvocationID_param; 1476 main_1(); 1477 } 1478 */ 1479 __gshared char[1385] CS_INIT_SOURCE_WGSL = [ 1480 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, 1481 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, 1482 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, 1483 0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a,0x20, 1484 0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20, 1485 0x70,0x6f,0x73,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x2f, 1486 0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x31,0x36,0x29,0x20,0x2a,0x2f, 1487 0x0a,0x20,0x20,0x76,0x65,0x6c,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a, 1488 0x7d,0x0a,0x0a,0x61,0x6c,0x69,0x61,0x73,0x20,0x52,0x54,0x41,0x72,0x72,0x20,0x3d, 1489 0x20,0x61,0x72,0x72,0x61,0x79,0x3c,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x3e, 1490 0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x63,0x73,0x5f,0x73,0x73,0x62, 1491 0x6f,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74, 1492 0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x70,0x72,0x74,0x20,0x3a,0x20,0x52, 1493 0x54,0x41,0x72,0x72,0x2c,0x0a,0x7d,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, 1494 0x76,0x61,0x74,0x65,0x3e,0x20,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49, 1495 0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x20,0x3a,0x20,0x76,0x65, 1496 0x63,0x33,0x75,0x3b,0x0a,0x0a,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x33, 1497 0x32,0x29,0x20,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x76,0x61,0x72, 1498 0x3c,0x73,0x74,0x6f,0x72,0x61,0x67,0x65,0x2c,0x20,0x72,0x65,0x61,0x64,0x5f,0x77, 1499 0x72,0x69,0x74,0x65,0x3e,0x20,0x78,0x5f,0x35,0x39,0x20,0x3a,0x20,0x63,0x73,0x5f, 1500 0x73,0x73,0x62,0x6f,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x78,0x6f,0x72,0x73,0x68,0x69, 1501 0x66,0x74,0x33,0x32,0x5f,0x75,0x31,0x5f,0x28,0x78,0x20,0x3a,0x20,0x70,0x74,0x72, 1502 0x3c,0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x75,0x33,0x32,0x3e,0x29, 1503 0x20,0x2d,0x3e,0x20,0x75,0x33,0x32,0x20,0x7b,0x0a,0x20,0x20,0x2a,0x28,0x78,0x29, 1504 0x20,0x3d,0x20,0x28,0x2a,0x28,0x78,0x29,0x20,0x5e,0x20,0x28,0x2a,0x28,0x78,0x29, 1505 0x20,0x3c,0x3c,0x20,0x62,0x69,0x74,0x63,0x61,0x73,0x74,0x3c,0x75,0x33,0x32,0x3e, 1506 0x28,0x31,0x33,0x69,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x2a,0x28,0x78,0x29,0x20, 1507 0x3d,0x20,0x28,0x2a,0x28,0x78,0x29,0x20,0x5e,0x20,0x28,0x2a,0x28,0x78,0x29,0x20, 1508 0x3e,0x3e,0x20,0x62,0x69,0x74,0x63,0x61,0x73,0x74,0x3c,0x75,0x33,0x32,0x3e,0x28, 1509 0x31,0x37,0x69,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x2a,0x28,0x78,0x29,0x20,0x3d, 1510 0x20,0x28,0x2a,0x28,0x78,0x29,0x20,0x5e,0x20,0x28,0x2a,0x28,0x78,0x29,0x20,0x3c, 1511 0x3c,0x20,0x62,0x69,0x74,0x63,0x61,0x73,0x74,0x3c,0x75,0x33,0x32,0x3e,0x28,0x35, 1512 0x69,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x38, 1513 0x20,0x3d,0x20,0x2a,0x28,0x78,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72, 1514 0x6e,0x20,0x78,0x5f,0x32,0x38,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61, 1515 0x69,0x6e,0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x69, 1516 0x64,0x78,0x20,0x3a,0x20,0x75,0x33,0x32,0x3b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20, 1517 0x78,0x5f,0x31,0x20,0x3a,0x20,0x75,0x33,0x32,0x3b,0x0a,0x20,0x20,0x76,0x61,0x72, 1518 0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x75,0x33,0x32,0x3b,0x0a,0x20,0x20, 1519 0x76,0x61,0x72,0x20,0x79,0x20,0x3a,0x20,0x75,0x33,0x32,0x3b,0x0a,0x20,0x20,0x76, 1520 0x61,0x72,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3a,0x20,0x75,0x33,0x32, 1521 0x3b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x7a,0x20,0x3a,0x20,0x75,0x33,0x32,0x3b, 1522 0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3a, 1523 0x20,0x75,0x33,0x32,0x3b,0x0a,0x20,0x20,0x69,0x64,0x78,0x20,0x3d,0x20,0x67,0x6c, 1524 0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f, 1525 0x6e,0x49,0x44,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d, 1526 0x20,0x28,0x33,0x30,0x35,0x34,0x31,0x39,0x38,0x39,0x36,0x75,0x20,0x5e,0x20,0x69, 1527 0x64,0x78,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x34,0x20, 1528 0x3d,0x20,0x78,0x6f,0x72,0x73,0x68,0x69,0x66,0x74,0x33,0x32,0x5f,0x75,0x31,0x5f, 1529 0x28,0x26,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x29,0x3b,0x0a,0x20,0x20,0x78,0x5f, 1530 0x31,0x20,0x3d,0x20,0x78,0x5f,0x34,0x34,0x3b,0x0a,0x20,0x20,0x70,0x61,0x72,0x61, 1531 0x6d,0x5f,0x31,0x20,0x3d,0x20,0x78,0x5f,0x31,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74, 1532 0x20,0x78,0x5f,0x34,0x38,0x20,0x3d,0x20,0x78,0x6f,0x72,0x73,0x68,0x69,0x66,0x74, 1533 0x33,0x32,0x5f,0x75,0x31,0x5f,0x28,0x26,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, 1534 0x29,0x29,0x3b,0x0a,0x20,0x20,0x79,0x20,0x3d,0x20,0x78,0x5f,0x34,0x38,0x3b,0x0a, 1535 0x20,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x79,0x3b,0x0a,0x20, 1536 0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x35,0x32,0x20,0x3d,0x20,0x78,0x6f,0x72,0x73, 1537 0x68,0x69,0x66,0x74,0x33,0x32,0x5f,0x75,0x31,0x5f,0x28,0x26,0x28,0x70,0x61,0x72, 1538 0x61,0x6d,0x5f,0x32,0x29,0x29,0x3b,0x0a,0x20,0x20,0x7a,0x20,0x3d,0x20,0x78,0x5f, 1539 0x35,0x32,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x36,0x31,0x20,0x3d, 1540 0x20,0x69,0x64,0x78,0x3b,0x0a,0x20,0x20,0x78,0x5f,0x35,0x39,0x2e,0x70,0x72,0x74, 1541 0x5b,0x78,0x5f,0x36,0x31,0x5d,0x2e,0x70,0x6f,0x73,0x20,0x3d,0x20,0x76,0x65,0x63, 1542 0x34,0x66,0x28,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x36,0x36, 1543 0x20,0x3d,0x20,0x69,0x64,0x78,0x3b,0x0a,0x20,0x20,0x78,0x5f,0x35,0x39,0x2e,0x70, 1544 0x72,0x74,0x5b,0x78,0x5f,0x36,0x36,0x5d,0x2e,0x76,0x65,0x6c,0x20,0x3d,0x20,0x76, 1545 0x65,0x63,0x34,0x66,0x28,0x28,0x28,0x66,0x33,0x32,0x28,0x28,0x78,0x5f,0x31,0x20, 1546 0x26,0x20,0x33,0x32,0x37,0x36,0x37,0x75,0x29,0x29,0x20,0x2f,0x20,0x33,0x32,0x37, 1547 0x36,0x37,0x2e,0x30,0x66,0x29,0x20,0x2d,0x20,0x30,0x2e,0x35,0x66,0x29,0x2c,0x20, 1548 0x28,0x28,0x28,0x66,0x33,0x32,0x28,0x28,0x79,0x20,0x26,0x20,0x33,0x32,0x37,0x36, 1549 0x37,0x75,0x29,0x29,0x20,0x2f,0x20,0x33,0x32,0x37,0x36,0x37,0x2e,0x30,0x66,0x29, 1550 0x20,0x2a,0x20,0x30,0x2e,0x35,0x66,0x29,0x20,0x2b,0x20,0x32,0x2e,0x30,0x66,0x29, 1551 0x2c,0x20,0x28,0x28,0x66,0x33,0x32,0x28,0x28,0x7a,0x20,0x26,0x20,0x33,0x32,0x37, 1552 0x36,0x37,0x75,0x29,0x29,0x20,0x2f,0x20,0x33,0x32,0x37,0x36,0x37,0x2e,0x30,0x66, 1553 0x29,0x20,0x2d,0x20,0x30,0x2e,0x35,0x66,0x29,0x2c,0x20,0x30,0x2e,0x30,0x66,0x29, 1554 0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x40, 1555 0x63,0x6f,0x6d,0x70,0x75,0x74,0x65,0x20,0x40,0x77,0x6f,0x72,0x6b,0x67,0x72,0x6f, 1556 0x75,0x70,0x5f,0x73,0x69,0x7a,0x65,0x28,0x36,0x34,0x69,0x2c,0x20,0x31,0x69,0x2c, 1557 0x20,0x31,0x69,0x29,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x62,0x75, 1558 0x69,0x6c,0x74,0x69,0x6e,0x28,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x5f,0x69,0x6e,0x76, 1559 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x5f,0x69,0x64,0x29,0x20,0x67,0x6c,0x5f,0x47, 1560 0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49, 1561 0x44,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x75,0x29, 1562 0x20,0x7b,0x0a,0x20,0x20,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e, 1563 0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x20,0x3d,0x20,0x67,0x6c,0x5f, 1564 0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, 1565 0x49,0x44,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e, 1566 0x5f,0x31,0x28,0x29,0x3b,0x0a,0x7d,0x0a,0x00, 1567 ]; 1568 /* 1569 diagnostic(off, derivative_uniformity); 1570 1571 struct cs_params { 1572 /_ @offset(0) _/ 1573 dt : f32, 1574 /_ @offset(4) _/ 1575 num_particles : i32, 1576 } 1577 1578 struct particle { 1579 /_ @offset(0) _/ 1580 pos : vec4f, 1581 /_ @offset(16) _/ 1582 vel : vec4f, 1583 } 1584 1585 alias RTArr = array<particle>; 1586 1587 struct cs_ssbo { 1588 /_ @offset(0) _/ 1589 prt : RTArr, 1590 } 1591 1592 var<private> gl_GlobalInvocationID : vec3u; 1593 1594 @binding(8) @group(0) var<uniform> x_21 : cs_params; 1595 1596 @binding(32) @group(1) var<storage, read_write> x_39 : cs_ssbo; 1597 1598 fn main_1() { 1599 var idx : u32; 1600 var pos : vec4f; 1601 var vel : vec4f; 1602 idx = gl_GlobalInvocationID.x; 1603 if ((idx >= bitcast<u32>(x_21.num_particles))) { 1604 return; 1605 } 1606 pos = x_39.prt[idx].pos; 1607 vel = x_39.prt[idx].vel; 1608 vel.y = (vel.y - (1.0f * x_21.dt)); 1609 pos = (pos + (vel * x_21.dt)); 1610 if ((pos.y < -2.0f)) { 1611 pos.y = -1.79999995231628417969f; 1612 vel = (vel * vec4f(0.80000001192092895508f, -0.80000001192092895508f, 0.80000001192092895508f, 0.0f)); 1613 } 1614 let x_80 = idx; 1615 x_39.prt[x_80].pos = pos; 1616 let x_83 = idx; 1617 x_39.prt[x_83].vel = vel; 1618 return; 1619 } 1620 1621 @compute @workgroup_size(64i, 1i, 1i) 1622 fn main(@builtin(global_invocation_id) gl_GlobalInvocationID_param : vec3u) { 1623 gl_GlobalInvocationID = gl_GlobalInvocationID_param; 1624 main_1(); 1625 } 1626 */ 1627 __gshared char[1235] CS_UPDATE_SOURCE_WGSL = [ 1628 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, 1629 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, 1630 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, 1631 0x63,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a, 1632 0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20, 1633 0x20,0x64,0x74,0x20,0x3a,0x20,0x66,0x33,0x32,0x2c,0x0a,0x20,0x20,0x2f,0x2a,0x20, 1634 0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x34,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20, 1635 0x6e,0x75,0x6d,0x5f,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x20,0x3a,0x20, 1636 0x69,0x33,0x32,0x2c,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x70, 1637 0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40, 1638 0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x70, 1639 0x6f,0x73,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x2f,0x2a, 1640 0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x31,0x36,0x29,0x20,0x2a,0x2f,0x0a, 1641 0x20,0x20,0x76,0x65,0x6c,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d, 1642 0x0a,0x0a,0x61,0x6c,0x69,0x61,0x73,0x20,0x52,0x54,0x41,0x72,0x72,0x20,0x3d,0x20, 1643 0x61,0x72,0x72,0x61,0x79,0x3c,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x3e,0x3b, 1644 0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x63,0x73,0x5f,0x73,0x73,0x62,0x6f, 1645 0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28, 1646 0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x70,0x72,0x74,0x20,0x3a,0x20,0x52,0x54, 1647 0x41,0x72,0x72,0x2c,0x0a,0x7d,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76, 1648 0x61,0x74,0x65,0x3e,0x20,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e, 1649 0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x20,0x3a,0x20,0x76,0x65,0x63, 1650 0x33,0x75,0x3b,0x0a,0x0a,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x38,0x29, 1651 0x20,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29,0x20,0x76,0x61,0x72,0x3c,0x75, 1652 0x6e,0x69,0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x32,0x31,0x20,0x3a,0x20,0x63, 1653 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x40,0x62,0x69,0x6e,0x64, 1654 0x69,0x6e,0x67,0x28,0x33,0x32,0x29,0x20,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31, 1655 0x29,0x20,0x76,0x61,0x72,0x3c,0x73,0x74,0x6f,0x72,0x61,0x67,0x65,0x2c,0x20,0x72, 1656 0x65,0x61,0x64,0x5f,0x77,0x72,0x69,0x74,0x65,0x3e,0x20,0x78,0x5f,0x33,0x39,0x20, 1657 0x3a,0x20,0x63,0x73,0x5f,0x73,0x73,0x62,0x6f,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d, 1658 0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20, 1659 0x69,0x64,0x78,0x20,0x3a,0x20,0x75,0x33,0x32,0x3b,0x0a,0x20,0x20,0x76,0x61,0x72, 1660 0x20,0x70,0x6f,0x73,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x20,0x20, 1661 0x76,0x61,0x72,0x20,0x76,0x65,0x6c,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b, 1662 0x0a,0x20,0x20,0x69,0x64,0x78,0x20,0x3d,0x20,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62, 1663 0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x2e,0x78, 1664 0x3b,0x0a,0x20,0x20,0x69,0x66,0x20,0x28,0x28,0x69,0x64,0x78,0x20,0x3e,0x3d,0x20, 1665 0x62,0x69,0x74,0x63,0x61,0x73,0x74,0x3c,0x75,0x33,0x32,0x3e,0x28,0x78,0x5f,0x32, 1666 0x31,0x2e,0x6e,0x75,0x6d,0x5f,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x73,0x29, 1667 0x29,0x29,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b, 1668 0x0a,0x20,0x20,0x7d,0x0a,0x20,0x20,0x70,0x6f,0x73,0x20,0x3d,0x20,0x78,0x5f,0x33, 1669 0x39,0x2e,0x70,0x72,0x74,0x5b,0x69,0x64,0x78,0x5d,0x2e,0x70,0x6f,0x73,0x3b,0x0a, 1670 0x20,0x20,0x76,0x65,0x6c,0x20,0x3d,0x20,0x78,0x5f,0x33,0x39,0x2e,0x70,0x72,0x74, 1671 0x5b,0x69,0x64,0x78,0x5d,0x2e,0x76,0x65,0x6c,0x3b,0x0a,0x20,0x20,0x76,0x65,0x6c, 1672 0x2e,0x79,0x20,0x3d,0x20,0x28,0x76,0x65,0x6c,0x2e,0x79,0x20,0x2d,0x20,0x28,0x31, 1673 0x2e,0x30,0x66,0x20,0x2a,0x20,0x78,0x5f,0x32,0x31,0x2e,0x64,0x74,0x29,0x29,0x3b, 1674 0x0a,0x20,0x20,0x70,0x6f,0x73,0x20,0x3d,0x20,0x28,0x70,0x6f,0x73,0x20,0x2b,0x20, 1675 0x28,0x76,0x65,0x6c,0x20,0x2a,0x20,0x78,0x5f,0x32,0x31,0x2e,0x64,0x74,0x29,0x29, 1676 0x3b,0x0a,0x20,0x20,0x69,0x66,0x20,0x28,0x28,0x70,0x6f,0x73,0x2e,0x79,0x20,0x3c, 1677 0x20,0x2d,0x32,0x2e,0x30,0x66,0x29,0x29,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x70, 1678 0x6f,0x73,0x2e,0x79,0x20,0x3d,0x20,0x2d,0x31,0x2e,0x37,0x39,0x39,0x39,0x39,0x39, 1679 0x39,0x35,0x32,0x33,0x31,0x36,0x32,0x38,0x34,0x31,0x37,0x39,0x36,0x39,0x66,0x3b, 1680 0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x6c,0x20,0x3d,0x20,0x28,0x76,0x65,0x6c,0x20, 1681 0x2a,0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30, 1682 0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x38,0x66,0x2c, 1683 0x20,0x2d,0x30,0x2e,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30, 1684 0x39,0x32,0x38,0x39,0x35,0x35,0x30,0x38,0x66,0x2c,0x20,0x30,0x2e,0x38,0x30,0x30, 1685 0x30,0x30,0x30,0x30,0x31,0x31,0x39,0x32,0x30,0x39,0x32,0x38,0x39,0x35,0x35,0x30, 1686 0x38,0x66,0x2c,0x20,0x30,0x2e,0x30,0x66,0x29,0x29,0x3b,0x0a,0x20,0x20,0x7d,0x0a, 1687 0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x38,0x30,0x20,0x3d,0x20,0x69,0x64,0x78, 1688 0x3b,0x0a,0x20,0x20,0x78,0x5f,0x33,0x39,0x2e,0x70,0x72,0x74,0x5b,0x78,0x5f,0x38, 1689 0x30,0x5d,0x2e,0x70,0x6f,0x73,0x20,0x3d,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20, 1690 0x6c,0x65,0x74,0x20,0x78,0x5f,0x38,0x33,0x20,0x3d,0x20,0x69,0x64,0x78,0x3b,0x0a, 1691 0x20,0x20,0x78,0x5f,0x33,0x39,0x2e,0x70,0x72,0x74,0x5b,0x78,0x5f,0x38,0x33,0x5d, 1692 0x2e,0x76,0x65,0x6c,0x20,0x3d,0x20,0x76,0x65,0x6c,0x3b,0x0a,0x20,0x20,0x72,0x65, 1693 0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x40,0x63,0x6f,0x6d,0x70,0x75,0x74, 1694 0x65,0x20,0x40,0x77,0x6f,0x72,0x6b,0x67,0x72,0x6f,0x75,0x70,0x5f,0x73,0x69,0x7a, 1695 0x65,0x28,0x36,0x34,0x69,0x2c,0x20,0x31,0x69,0x2c,0x20,0x31,0x69,0x29,0x0a,0x66, 1696 0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x62,0x75,0x69,0x6c,0x74,0x69,0x6e,0x28, 1697 0x67,0x6c,0x6f,0x62,0x61,0x6c,0x5f,0x69,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f, 1698 0x6e,0x5f,0x69,0x64,0x29,0x20,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49, 1699 0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x5f,0x70,0x61,0x72,0x61, 1700 0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x75,0x29,0x20,0x7b,0x0a,0x20,0x20,0x67, 1701 0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69, 1702 0x6f,0x6e,0x49,0x44,0x20,0x3d,0x20,0x67,0x6c,0x5f,0x47,0x6c,0x6f,0x62,0x61,0x6c, 1703 0x49,0x6e,0x76,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x44,0x5f,0x70,0x61,0x72, 1704 0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a, 1705 0x7d,0x0a,0x00, 1706 ]; 1707 /* 1708 diagnostic(off, derivative_uniformity); 1709 1710 struct particle { 1711 /_ @offset(0) _/ 1712 pos : vec4f, 1713 /_ @offset(16) _/ 1714 vel : vec4f, 1715 } 1716 1717 alias RTArr = array<particle>; 1718 1719 struct vs_ssbo { 1720 /_ @offset(0) _/ 1721 prt : RTArr, 1722 } 1723 1724 struct vs_params { 1725 /_ @offset(0) _/ 1726 mvp : mat4x4f, 1727 } 1728 1729 @binding(32) @group(1) var<storage, read> x_15 : vs_ssbo; 1730 1731 var<private> gl_InstanceIndex : i32; 1732 1733 var<private> pos_1 : vec3f; 1734 1735 @binding(0) @group(0) var<uniform> x_46 : vs_params; 1736 1737 var<private> color : vec4f; 1738 1739 var<private> color0 : vec4f; 1740 1741 var<private> gl_Position : vec4f; 1742 1743 fn main_1() { 1744 var inst_pos : vec3f; 1745 var pos : vec4f; 1746 inst_pos = x_15.prt[gl_InstanceIndex].pos.xyz; 1747 let x_31 = (pos_1 + inst_pos); 1748 pos = vec4f(x_31.x, x_31.y, x_31.z, 1.0f); 1749 gl_Position = (x_46.mvp * pos); 1750 color = color0; 1751 return; 1752 } 1753 1754 struct main_out { 1755 @builtin(position) 1756 gl_Position : vec4f, 1757 @location(0) 1758 color_1 : vec4f, 1759 } 1760 1761 @vertex 1762 fn main(@builtin(instance_index) gl_InstanceIndex_param : u32, @location(0) pos_1_param : vec3f, @location(1) color0_param : vec4f) -> main_out { 1763 gl_InstanceIndex = bitcast<i32>(gl_InstanceIndex_param); 1764 pos_1 = pos_1_param; 1765 color0 = color0_param; 1766 main_1(); 1767 return main_out(gl_Position, color); 1768 } 1769 */ 1770 __gshared char[1212] VS_SOURCE_WGSL = [ 1771 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, 1772 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, 1773 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, 1774 0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a,0x20, 1775 0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20, 1776 0x70,0x6f,0x73,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x2f, 1777 0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x31,0x36,0x29,0x20,0x2a,0x2f, 1778 0x0a,0x20,0x20,0x76,0x65,0x6c,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a, 1779 0x7d,0x0a,0x0a,0x61,0x6c,0x69,0x61,0x73,0x20,0x52,0x54,0x41,0x72,0x72,0x20,0x3d, 1780 0x20,0x61,0x72,0x72,0x61,0x79,0x3c,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x3e, 1781 0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x76,0x73,0x5f,0x73,0x73,0x62, 1782 0x6f,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74, 1783 0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x70,0x72,0x74,0x20,0x3a,0x20,0x52, 1784 0x54,0x41,0x72,0x72,0x2c,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, 1785 0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a, 1786 0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20, 1787 0x20,0x6d,0x76,0x70,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x2c,0x0a, 1788 0x7d,0x0a,0x0a,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x33,0x32,0x29,0x20, 1789 0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x76,0x61,0x72,0x3c,0x73,0x74, 1790 0x6f,0x72,0x61,0x67,0x65,0x2c,0x20,0x72,0x65,0x61,0x64,0x3e,0x20,0x78,0x5f,0x31, 1791 0x35,0x20,0x3a,0x20,0x76,0x73,0x5f,0x73,0x73,0x62,0x6f,0x3b,0x0a,0x0a,0x76,0x61, 1792 0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x67,0x6c,0x5f,0x49,0x6e, 1793 0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x20,0x3a,0x20,0x69,0x33, 1794 0x32,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e, 1795 0x20,0x70,0x6f,0x73,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a, 1796 0x0a,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x30,0x29,0x20,0x40,0x67,0x72, 1797 0x6f,0x75,0x70,0x28,0x30,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f, 1798 0x72,0x6d,0x3e,0x20,0x78,0x5f,0x34,0x36,0x20,0x3a,0x20,0x76,0x73,0x5f,0x70,0x61, 1799 0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61, 1800 0x74,0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34, 1801 0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e, 1802 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b, 1803 0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x67, 1804 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63, 1805 0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29, 1806 0x20,0x7b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x69,0x6e,0x73,0x74,0x5f,0x70,0x6f, 1807 0x73,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x20,0x20,0x76,0x61,0x72, 1808 0x20,0x70,0x6f,0x73,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x20,0x20, 1809 0x69,0x6e,0x73,0x74,0x5f,0x70,0x6f,0x73,0x20,0x3d,0x20,0x78,0x5f,0x31,0x35,0x2e, 1810 0x70,0x72,0x74,0x5b,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49, 1811 0x6e,0x64,0x65,0x78,0x5d,0x2e,0x70,0x6f,0x73,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20, 1812 0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x33,0x31,0x20,0x3d,0x20,0x28,0x70,0x6f,0x73, 1813 0x5f,0x31,0x20,0x2b,0x20,0x69,0x6e,0x73,0x74,0x5f,0x70,0x6f,0x73,0x29,0x3b,0x0a, 1814 0x20,0x20,0x70,0x6f,0x73,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f, 1815 0x33,0x31,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x33,0x31,0x2e,0x79,0x2c,0x20,0x78,0x5f, 1816 0x33,0x31,0x2e,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20,0x20,0x67, 1817 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x28,0x78,0x5f, 1818 0x34,0x36,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x70,0x6f,0x73,0x29,0x3b,0x0a,0x20, 1819 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b, 1820 0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74, 1821 0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a, 1822 0x20,0x20,0x40,0x62,0x75,0x69,0x6c,0x74,0x69,0x6e,0x28,0x70,0x6f,0x73,0x69,0x74, 1823 0x69,0x6f,0x6e,0x29,0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69, 1824 0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c, 1825 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x63,0x6f,0x6c, 1826 0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a, 1827 0x0a,0x40,0x76,0x65,0x72,0x74,0x65,0x78,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e, 1828 0x28,0x40,0x62,0x75,0x69,0x6c,0x74,0x69,0x6e,0x28,0x69,0x6e,0x73,0x74,0x61,0x6e, 1829 0x63,0x65,0x5f,0x69,0x6e,0x64,0x65,0x78,0x29,0x20,0x67,0x6c,0x5f,0x49,0x6e,0x73, 1830 0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x5f,0x70,0x61,0x72,0x61,0x6d, 1831 0x20,0x3a,0x20,0x75,0x33,0x32,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, 1832 0x6e,0x28,0x30,0x29,0x20,0x70,0x6f,0x73,0x5f,0x31,0x5f,0x70,0x61,0x72,0x61,0x6d, 1833 0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74, 1834 0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x5f,0x70,0x61, 1835 0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x29,0x20,0x2d,0x3e,0x20, 1836 0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x67,0x6c,0x5f, 1837 0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x20,0x3d,0x20, 1838 0x62,0x69,0x74,0x63,0x61,0x73,0x74,0x3c,0x69,0x33,0x32,0x3e,0x28,0x67,0x6c,0x5f, 1839 0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x5f,0x70,0x61, 1840 0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x70,0x6f,0x73,0x5f,0x31,0x20,0x3d,0x20, 1841 0x70,0x6f,0x73,0x5f,0x31,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x63, 1842 0x6f,0x6c,0x6f,0x72,0x30,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x5f,0x70, 1843 0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29, 1844 0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f, 1845 0x6f,0x75,0x74,0x28,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c, 1846 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x00, 1847 ]; 1848 /* 1849 diagnostic(off, derivative_uniformity); 1850 1851 var<private> frag_color : vec4f; 1852 1853 var<private> color : vec4f; 1854 1855 fn main_1() { 1856 frag_color = color; 1857 return; 1858 } 1859 1860 struct main_out { 1861 @location(0) 1862 frag_color_1 : vec4f, 1863 } 1864 1865 @fragment 1866 fn main(@location(0) color_param : vec4f) -> main_out { 1867 color = color_param; 1868 main_1(); 1869 return main_out(frag_color); 1870 } 1871 */ 1872 __gshared char[348] FS_SOURCE_WGSL = [ 1873 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, 1874 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, 1875 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, 1876 0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, 1877 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70, 1878 0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20, 1879 0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f, 1880 0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, 1881 0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x72,0x65, 1882 0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, 1883 0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x6c,0x6f, 1884 0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x66,0x72,0x61,0x67, 1885 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66, 1886 0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x0a,0x66, 1887 0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, 1888 0x28,0x30,0x29,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20, 1889 0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e, 1890 0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, 1891 0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20, 1892 0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75, 1893 0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x66,0x72,0x61,0x67, 1894 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x00, 1895 ]; 1896 sg.ShaderDesc displayShaderDesc(sg.Backend backend) @trusted @nogc nothrow { 1897 sg.ShaderDesc desc; 1898 desc.label = "display_shader"; 1899 switch (backend) { 1900 case sg.Backend.Glcore: 1901 desc.vertex_func.source = &VS_SOURCE_GLSL430[0]; 1902 desc.vertex_func.entry = "main"; 1903 desc.fragment_func.source = &FS_SOURCE_GLSL430[0]; 1904 desc.fragment_func.entry = "main"; 1905 desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float; 1906 desc.attrs[0].glsl_name = "pos"; 1907 desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float; 1908 desc.attrs[1].glsl_name = "color0"; 1909 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 1910 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 1911 desc.uniform_blocks[0].size = 64; 1912 desc.uniform_blocks[0].glsl_uniforms[0].type = sg.UniformType.Float4; 1913 desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4; 1914 desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; 1915 desc.storage_buffers[0].stage = sg.ShaderStage.Vertex; 1916 desc.storage_buffers[0].readonly = true; 1917 desc.storage_buffers[0].glsl_binding_n = 0; 1918 break; 1919 case sg.Backend.Gles3: 1920 desc.vertex_func.source = &VS_SOURCE_GLSL310ES[0]; 1921 desc.vertex_func.entry = "main"; 1922 desc.fragment_func.source = &FS_SOURCE_GLSL310ES[0]; 1923 desc.fragment_func.entry = "main"; 1924 desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float; 1925 desc.attrs[0].glsl_name = "pos"; 1926 desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float; 1927 desc.attrs[1].glsl_name = "color0"; 1928 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 1929 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 1930 desc.uniform_blocks[0].size = 64; 1931 desc.uniform_blocks[0].glsl_uniforms[0].type = sg.UniformType.Float4; 1932 desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4; 1933 desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; 1934 desc.storage_buffers[0].stage = sg.ShaderStage.Vertex; 1935 desc.storage_buffers[0].readonly = true; 1936 desc.storage_buffers[0].glsl_binding_n = 0; 1937 break; 1938 case sg.Backend.D3d11: 1939 desc.vertex_func.source = &VS_SOURCE_HLSL5[0]; 1940 desc.vertex_func.d3d11_target = "vs_5_0"; 1941 desc.vertex_func.entry = "main"; 1942 desc.fragment_func.source = &FS_SOURCE_HLSL5[0]; 1943 desc.fragment_func.d3d11_target = "ps_5_0"; 1944 desc.fragment_func.entry = "main"; 1945 desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float; 1946 desc.attrs[0].hlsl_sem_name = "TEXCOORD"; 1947 desc.attrs[0].hlsl_sem_index = 0; 1948 desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float; 1949 desc.attrs[1].hlsl_sem_name = "TEXCOORD"; 1950 desc.attrs[1].hlsl_sem_index = 1; 1951 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 1952 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 1953 desc.uniform_blocks[0].size = 64; 1954 desc.uniform_blocks[0].hlsl_register_b_n = 0; 1955 desc.storage_buffers[0].stage = sg.ShaderStage.Vertex; 1956 desc.storage_buffers[0].readonly = true; 1957 desc.storage_buffers[0].hlsl_register_t_n = 16; 1958 break; 1959 case sg.Backend.Metal_macos: 1960 desc.vertex_func.source = &VS_SOURCE_METAL_MACOS[0]; 1961 desc.vertex_func.entry = "main0"; 1962 desc.fragment_func.source = &FS_SOURCE_METAL_MACOS[0]; 1963 desc.fragment_func.entry = "main0"; 1964 desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float; 1965 desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float; 1966 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 1967 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 1968 desc.uniform_blocks[0].size = 64; 1969 desc.uniform_blocks[0].msl_buffer_n = 0; 1970 desc.storage_buffers[0].stage = sg.ShaderStage.Vertex; 1971 desc.storage_buffers[0].readonly = true; 1972 desc.storage_buffers[0].msl_buffer_n = 8; 1973 break; 1974 case sg.Backend.Wgpu: 1975 desc.vertex_func.source = &VS_SOURCE_WGSL[0]; 1976 desc.vertex_func.entry = "main"; 1977 desc.fragment_func.source = &FS_SOURCE_WGSL[0]; 1978 desc.fragment_func.entry = "main"; 1979 desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float; 1980 desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float; 1981 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 1982 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 1983 desc.uniform_blocks[0].size = 64; 1984 desc.uniform_blocks[0].wgsl_group0_binding_n = 0; 1985 desc.storage_buffers[0].stage = sg.ShaderStage.Vertex; 1986 desc.storage_buffers[0].readonly = true; 1987 desc.storage_buffers[0].wgsl_group1_binding_n = 32; 1988 break; 1989 default: break; 1990 } 1991 return desc; 1992 } 1993 sg.ShaderDesc initShaderDesc(sg.Backend backend) @trusted @nogc nothrow { 1994 sg.ShaderDesc desc; 1995 desc.label = "init_shader"; 1996 switch (backend) { 1997 case sg.Backend.Glcore: 1998 desc.compute_func.source = &CS_INIT_SOURCE_GLSL430[0]; 1999 desc.compute_func.entry = "main"; 2000 desc.storage_buffers[0].stage = sg.ShaderStage.Compute; 2001 desc.storage_buffers[0].readonly = false; 2002 desc.storage_buffers[0].glsl_binding_n = 0; 2003 break; 2004 case sg.Backend.Gles3: 2005 desc.compute_func.source = &CS_INIT_SOURCE_GLSL310ES[0]; 2006 desc.compute_func.entry = "main"; 2007 desc.storage_buffers[0].stage = sg.ShaderStage.Compute; 2008 desc.storage_buffers[0].readonly = false; 2009 desc.storage_buffers[0].glsl_binding_n = 0; 2010 break; 2011 case sg.Backend.D3d11: 2012 desc.compute_func.source = &CS_INIT_SOURCE_HLSL5[0]; 2013 desc.compute_func.d3d11_target = "cs_5_0"; 2014 desc.compute_func.entry = "main"; 2015 desc.storage_buffers[0].stage = sg.ShaderStage.Compute; 2016 desc.storage_buffers[0].readonly = false; 2017 desc.storage_buffers[0].hlsl_register_u_n = 0; 2018 break; 2019 case sg.Backend.Metal_macos: 2020 desc.compute_func.source = &CS_INIT_SOURCE_METAL_MACOS[0]; 2021 desc.compute_func.entry = "main0"; 2022 desc.mtl_threads_per_threadgroup.x = 64; 2023 desc.mtl_threads_per_threadgroup.y = 1; 2024 desc.mtl_threads_per_threadgroup.z = 1; 2025 desc.storage_buffers[0].stage = sg.ShaderStage.Compute; 2026 desc.storage_buffers[0].readonly = false; 2027 desc.storage_buffers[0].msl_buffer_n = 8; 2028 break; 2029 case sg.Backend.Wgpu: 2030 desc.compute_func.source = &CS_INIT_SOURCE_WGSL[0]; 2031 desc.compute_func.entry = "main"; 2032 desc.storage_buffers[0].stage = sg.ShaderStage.Compute; 2033 desc.storage_buffers[0].readonly = false; 2034 desc.storage_buffers[0].wgsl_group1_binding_n = 32; 2035 break; 2036 default: break; 2037 } 2038 return desc; 2039 } 2040 sg.ShaderDesc updateShaderDesc(sg.Backend backend) @trusted @nogc nothrow { 2041 sg.ShaderDesc desc; 2042 desc.label = "update_shader"; 2043 switch (backend) { 2044 case sg.Backend.Glcore: 2045 desc.compute_func.source = &CS_UPDATE_SOURCE_GLSL430[0]; 2046 desc.compute_func.entry = "main"; 2047 desc.uniform_blocks[0].stage = sg.ShaderStage.Compute; 2048 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 2049 desc.uniform_blocks[0].size = 16; 2050 desc.uniform_blocks[0].glsl_uniforms[0].type = sg.UniformType.Float; 2051 desc.uniform_blocks[0].glsl_uniforms[0].array_count = 0; 2052 desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "_21.dt"; 2053 desc.uniform_blocks[0].glsl_uniforms[1].type = sg.UniformType.Int; 2054 desc.uniform_blocks[0].glsl_uniforms[1].array_count = 0; 2055 desc.uniform_blocks[0].glsl_uniforms[1].glsl_name = "_21.num_particles"; 2056 desc.storage_buffers[0].stage = sg.ShaderStage.Compute; 2057 desc.storage_buffers[0].readonly = false; 2058 desc.storage_buffers[0].glsl_binding_n = 0; 2059 break; 2060 case sg.Backend.Gles3: 2061 desc.compute_func.source = &CS_UPDATE_SOURCE_GLSL310ES[0]; 2062 desc.compute_func.entry = "main"; 2063 desc.uniform_blocks[0].stage = sg.ShaderStage.Compute; 2064 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 2065 desc.uniform_blocks[0].size = 16; 2066 desc.uniform_blocks[0].glsl_uniforms[0].type = sg.UniformType.Float; 2067 desc.uniform_blocks[0].glsl_uniforms[0].array_count = 0; 2068 desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "_21.dt"; 2069 desc.uniform_blocks[0].glsl_uniforms[1].type = sg.UniformType.Int; 2070 desc.uniform_blocks[0].glsl_uniforms[1].array_count = 0; 2071 desc.uniform_blocks[0].glsl_uniforms[1].glsl_name = "_21.num_particles"; 2072 desc.storage_buffers[0].stage = sg.ShaderStage.Compute; 2073 desc.storage_buffers[0].readonly = false; 2074 desc.storage_buffers[0].glsl_binding_n = 0; 2075 break; 2076 case sg.Backend.D3d11: 2077 desc.compute_func.source = &CS_UPDATE_SOURCE_HLSL5[0]; 2078 desc.compute_func.d3d11_target = "cs_5_0"; 2079 desc.compute_func.entry = "main"; 2080 desc.uniform_blocks[0].stage = sg.ShaderStage.Compute; 2081 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 2082 desc.uniform_blocks[0].size = 16; 2083 desc.uniform_blocks[0].hlsl_register_b_n = 0; 2084 desc.storage_buffers[0].stage = sg.ShaderStage.Compute; 2085 desc.storage_buffers[0].readonly = false; 2086 desc.storage_buffers[0].hlsl_register_u_n = 0; 2087 break; 2088 case sg.Backend.Metal_macos: 2089 desc.compute_func.source = &CS_UPDATE_SOURCE_METAL_MACOS[0]; 2090 desc.compute_func.entry = "main0"; 2091 desc.mtl_threads_per_threadgroup.x = 64; 2092 desc.mtl_threads_per_threadgroup.y = 1; 2093 desc.mtl_threads_per_threadgroup.z = 1; 2094 desc.uniform_blocks[0].stage = sg.ShaderStage.Compute; 2095 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 2096 desc.uniform_blocks[0].size = 16; 2097 desc.uniform_blocks[0].msl_buffer_n = 0; 2098 desc.storage_buffers[0].stage = sg.ShaderStage.Compute; 2099 desc.storage_buffers[0].readonly = false; 2100 desc.storage_buffers[0].msl_buffer_n = 8; 2101 break; 2102 case sg.Backend.Wgpu: 2103 desc.compute_func.source = &CS_UPDATE_SOURCE_WGSL[0]; 2104 desc.compute_func.entry = "main"; 2105 desc.uniform_blocks[0].stage = sg.ShaderStage.Compute; 2106 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 2107 desc.uniform_blocks[0].size = 16; 2108 desc.uniform_blocks[0].wgsl_group0_binding_n = 8; 2109 desc.storage_buffers[0].stage = sg.ShaderStage.Compute; 2110 desc.storage_buffers[0].readonly = false; 2111 desc.storage_buffers[0].wgsl_group1_binding_n = 32; 2112 break; 2113 default: break; 2114 } 2115 return desc; 2116 }