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