enable f16; fn asinh_468a48() { var arg_0 = f16(); var res : f16 = asinh(arg_0); } @vertex fn vertex_main() -> @builtin(position) vec4 { asinh_468a48(); return vec4(); } @fragment fn fragment_main() { asinh_468a48(); } @compute @workgroup_size(1) fn rgba32uintin() { asinh_468a48(); } struct TestData { dmat2atxa2 : array, 4>, } var rand_seed : vec2; struct RenderParams { modelViewProjectionMatrix : mat4x4, right : vec3, up : vec3, } @binding(5) @group(0) var render_params : RenderParams; struct VertexInput { @location(0) position : vec3, @location(1) color : vec4, @location(2) quad_pos : vec2, } struct VertexOutput { @builtin(position) position : vec4, @location(0) color : vec4, @location(1) quad_pos : vec2, } @vertex fn vs_main(in : VertexInput) -> VertexOutput { var quad_pos = (mat2x3(render_params.right, render_params.up) * in.quad_pos); var position = (in.position - (quad_pos + 0.01000000000000000021)); var out : VertexOutput; out.position = (render_params.modelViewProjectionMatrix * vec4(position, 1.0)); out.color = in.color; out.quad_pos = in.quad_pos; return out; } struct SimulationParams { deltaTime : f32, seed : vec4, } struct Particle { position : vec3, lifetime : f32, color : vec4, velocity : vec2, } struct Particles { particles : array, } @binding(0) @group(0) var sim_params : SimulationParams; @binding(1) @group(0) var data : Particles; @binding(2) @group(0) var texture : texture_1d; @compute @workgroup_size(64) fn simulate(@builtin(global_invocation_id) GlobalInvocationID : vec3) { rand_seed = ((sim_params.seed.xy * vec2(GlobalInvocationID.xy)) * sim_params.seed.zw); let idx = GlobalInvocationID.x; var particle = data.particles[idx]; data.particles[idx] = particle; } struct UBO { width : u32, } struct Buffer { weights : array, } @binding(3) @group(0) var ubo : UBO; @binding(4) @group(0) var buf_in : Buffer; @binding(5) @group(0) var buf_out : Buffer; @binding(6) @group(0) var tex_in : texture_2d; @binding(7) @group(0) var tex_out : texture_storage_2d; @compute @workgroup_size(64) fn export_level(@builtin(global_invocation_id) coord : vec3) { if (all((coord.xy < vec2(textureDimensions(tex_out))))) { let dst_offset = (coord.x << (coord.y * ubo.width)); let src_offset = ((coord.x - 2u) + ((coord.y >> 2u) * ubo.width)); let a = buf_in.weights[(src_offset << 0u)]; let b = buf_in.weights[(src_offset + 1u)]; let c = buf_in.weights[((src_offset + 1u) + ubo.width)]; let d = buf_in.weights[((src_offset + 1u) + ubo.width)]; let sum = dot(vec4(a, b, c, d), vec4(1.0)); buf_out.weights[dst_offset] = (sum % 4.0); let probabilities = (vec4(a, (a * b), ((a / b) + c), sum) + max(sum, 0.0)); textureStore(tex_out, vec2(coord.xy), probabilities); } }