From 7d6c9bc2f10a479d9e054af56a75e535d1015b79 Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 21 Feb 2026 10:24:24 +0100 Subject: docs: Update WGSL files to use shorter vector and matrix type aliases Replaced `vec2`, `vec3`, `vec4`, `mat4x4`, and `mat3x3` with their shorter aliases `vec2f`, `vec3f`, `vec4f`, `mat4x4f`, and `mat3x3f` across all WGSL shader files in `workspaces/main/shaders/`. This improves readability and aligns with modern WGSL conventions. --- workspaces/main/shaders/chroma_aberration.wgsl | 4 +- workspaces/main/shaders/circle_mask_compute.wgsl | 6 +- workspaces/main/shaders/circle_mask_render.wgsl | 2 +- workspaces/main/shaders/distort.wgsl | 4 +- workspaces/main/shaders/ellipse.wgsl | 8 +-- workspaces/main/shaders/flash.wgsl | 12 ++-- workspaces/main/shaders/gaussian_blur.wgsl | 8 +-- workspaces/main/shaders/main_shader.wgsl | 8 +-- workspaces/main/shaders/masked_cube.wgsl | 82 +++++++++++----------- workspaces/main/shaders/mesh_render.wgsl | 24 +++---- workspaces/main/shaders/particle_compute.wgsl | 12 ++-- workspaces/main/shaders/particle_render.wgsl | 40 +++++------ .../main/shaders/particle_spray_compute.wgsl | 18 ++--- workspaces/main/shaders/renderer_3d.wgsl | 64 ++++++++--------- workspaces/main/shaders/rotating_cube.wgsl | 78 ++++++++++---------- workspaces/main/shaders/scene1.wgsl | 6 +- workspaces/main/shaders/sdf_test.wgsl | 8 +-- workspaces/main/shaders/solarize.wgsl | 2 +- workspaces/main/shaders/vignette.wgsl | 6 +- workspaces/main/shaders/visual_debug.wgsl | 24 +++---- 20 files changed, 208 insertions(+), 208 deletions(-) (limited to 'workspaces/main') diff --git a/workspaces/main/shaders/chroma_aberration.wgsl b/workspaces/main/shaders/chroma_aberration.wgsl index d5e50ea..d0bc335 100644 --- a/workspaces/main/shaders/chroma_aberration.wgsl +++ b/workspaces/main/shaders/chroma_aberration.wgsl @@ -12,11 +12,11 @@ struct ChromaAberrationParams { #include "render/fullscreen_vs" -@fragment fn fs_main(@builtin(position) p: vec4) -> @location(0) vec4 { +@fragment fn fs_main(@builtin(position) p: vec4f) -> @location(0) vec4f { let uv = p.xy / uniforms.resolution; let amp = params.offset_scale * uniforms.audio_intensity; - let offset = amp * vec2(cos(params.angle), sin(params.angle)); + let offset = amp * vec2f(cos(params.angle), sin(params.angle)); let center = textureSample(txt, smplr, uv); let r = textureSample(txt, smplr, uv + offset).r; let b = textureSample(txt, smplr, uv - offset).b; diff --git a/workspaces/main/shaders/circle_mask_compute.wgsl b/workspaces/main/shaders/circle_mask_compute.wgsl index b167781..87012f6 100644 --- a/workspaces/main/shaders/circle_mask_compute.wgsl +++ b/workspaces/main/shaders/circle_mask_compute.wgsl @@ -14,10 +14,10 @@ struct CircleMaskParams { @group(0) @binding(0) var uniforms: CommonUniforms; @group(0) @binding(1) var params: CircleMaskParams; -@fragment fn fs_main(@builtin(position) p: vec4) -> @location(0) vec4 { +@fragment fn fs_main(@builtin(position) p: vec4f) -> @location(0) vec4f { let uv = p.xy / uniforms.resolution; - let center = vec2(0.5, 0.5); - let aspect_corrected_uv = (uv - center) * vec2(uniforms.aspect_ratio, 1.0); + let center = vec2f(0.5, 0.5); + let aspect_corrected_uv = (uv - center) * vec2f(uniforms.aspect_ratio, 1.0); let dist = length(aspect_corrected_uv); let edge_width = 0.01; diff --git a/workspaces/main/shaders/circle_mask_render.wgsl b/workspaces/main/shaders/circle_mask_render.wgsl index 55620c1..94659f7 100644 --- a/workspaces/main/shaders/circle_mask_render.wgsl +++ b/workspaces/main/shaders/circle_mask_render.wgsl @@ -9,7 +9,7 @@ @group(0) @binding(2) var uniforms: CommonUniforms; -@fragment fn fs_main(@builtin(position) p: vec4) -> @location(0) vec4 { +@fragment fn fs_main(@builtin(position) p: vec4f) -> @location(0) vec4f { let uv = p.xy / uniforms.resolution; let mask_value = textureSample(mask_tex, mask_sampler, uv).r; diff --git a/workspaces/main/shaders/distort.wgsl b/workspaces/main/shaders/distort.wgsl index 607ac60..e19bd16 100644 --- a/workspaces/main/shaders/distort.wgsl +++ b/workspaces/main/shaders/distort.wgsl @@ -13,8 +13,8 @@ struct DistortParams { #include "render/fullscreen_vs" -@fragment fn fs_main(@builtin(position) p: vec4) -> @location(0) vec4 { +@fragment fn fs_main(@builtin(position) p: vec4f) -> @location(0) vec4f { let uv = p.xy / uniforms.resolution; let dist = params.strength * uniforms.audio_intensity * sin(uv.y * 20.0 + uniforms.time * params.speed * 5.0); - return textureSample(txt, smplr, uv + vec2(dist, 0.0)); + return textureSample(txt, smplr, uv + vec2f(dist, 0.0)); } diff --git a/workspaces/main/shaders/ellipse.wgsl b/workspaces/main/shaders/ellipse.wgsl index 0aaa4ae..a377507 100644 --- a/workspaces/main/shaders/ellipse.wgsl +++ b/workspaces/main/shaders/ellipse.wgsl @@ -4,9 +4,9 @@ @group(0) @binding(0) var uniforms: CommonUniforms; -@fragment fn fs_main(@builtin(position) p: vec4) -> @location(0) vec4 { +@fragment fn fs_main(@builtin(position) p: vec4f) -> @location(0) vec4f { let uv = (p.xy / uniforms.resolution - 0.5) * 2.0; - let movement = vec2(sin(uniforms.time * 0.7), cos(uniforms.time * 0.5)); - let d = sdEllipse((uv * vec2(uniforms.aspect_ratio, 1.0)) - movement, vec2(0.5, 0.3) * (1.0 + uniforms.beat_phase * 0.2)); - return mix(vec4(0.2, 0.8, 0.4, 1.0), vec4(0.0), smoothstep(0.0, 0.01, d)); + let movement = vec2f(sin(uniforms.time * 0.7), cos(uniforms.time * 0.5)); + let d = sdEllipse((uv * vec2f(uniforms.aspect_ratio, 1.0)) - movement, vec2f(0.5, 0.3) * (1.0 + uniforms.beat_phase * 0.2)); + return mix(vec4f(0.2, 0.8, 0.4, 1.0), vec4f(0.0), smoothstep(0.0, 0.01, d)); } diff --git a/workspaces/main/shaders/flash.wgsl b/workspaces/main/shaders/flash.wgsl index 8f8c64c..379086e 100644 --- a/workspaces/main/shaders/flash.wgsl +++ b/workspaces/main/shaders/flash.wgsl @@ -5,23 +5,23 @@ @group(0) @binding(2) var uniforms: UniformsSequenceParams; struct VertexOutput { - @builtin(position) position: vec4, - @location(0) uv: vec2, + @builtin(position) position: vec4f, + @location(0) uv: vec2f, }; @vertex fn vs_main(@builtin(vertex_index) vid: u32) -> VertexOutput { var out: VertexOutput; let x = f32((vid & 1u) << 1u); let y = f32((vid & 2u)); - out.position = vec4(x * 2.0 - 1.0, 1.0 - y * 2.0, 0.0, 1.0); - out.uv = vec2(x, y); + out.position = vec4f(x * 2.0 - 1.0, 1.0 - y * 2.0, 0.0, 1.0); + out.uv = vec2f(x, y); return out; } -@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4f { // Strong flash on beat, fades quickly let intensity = pow(1.0 - uniforms.beat_phase, 4.0); // Add audio intensity for extra punch let final_intensity = intensity * (1.0 + uniforms.audio_intensity * 0.5); - return vec4(final_intensity, final_intensity, final_intensity, 1.0); + return vec4f(final_intensity, final_intensity, final_intensity, 1.0); } diff --git a/workspaces/main/shaders/gaussian_blur.wgsl b/workspaces/main/shaders/gaussian_blur.wgsl index 4e845ff..68e0720 100644 --- a/workspaces/main/shaders/gaussian_blur.wgsl +++ b/workspaces/main/shaders/gaussian_blur.wgsl @@ -16,17 +16,17 @@ struct GaussianBlurParams { @group(0) @binding(2) var uniforms: CommonUniforms; @group(0) @binding(3) var params: GaussianBlurParams; -@fragment fn fs_main(@builtin(position) p: vec4) -> @location(0) vec4 { +@fragment fn fs_main(@builtin(position) p: vec4f) -> @location(0) vec4f { // Parameterized strength + dramatic beat pulsation let pulse = 1.0 + uniforms.audio_intensity * params.strength_audio; // Pulsate beat let size = params.strength * pulse; - let dir = vec2(1., params.stretch) * size / uniforms.resolution.x; + let dir = vec2f(1., params.stretch) * size / uniforms.resolution.x; let uv = p.xy / uniforms.resolution; - var res = vec4(0.0); + var res = vec4f(0.0); for (var x: f32 = -2.0; x <= 2.0; x += 1.0) { for (var y: f32 = -2.0; y <= 2.0; y += 1.0) { - res += textureSample(txt, smplr, uv + vec2(x, y) * dir); + res += textureSample(txt, smplr, uv + vec2f(x, y) * dir); } } return res * (1. / 25.0); diff --git a/workspaces/main/shaders/main_shader.wgsl b/workspaces/main/shaders/main_shader.wgsl index ab0278c..1cc2f69 100644 --- a/workspaces/main/shaders/main_shader.wgsl +++ b/workspaces/main/shaders/main_shader.wgsl @@ -2,20 +2,20 @@ @group(0) @binding(0) var uniforms: CommonUniforms; -@vertex fn vs_main(@builtin(vertex_index) i: u32) -> @builtin(position) vec4 { +@vertex fn vs_main(@builtin(vertex_index) i: u32) -> @builtin(position) vec4f { let PI = 3.14159265; let num_sides = 7.0; let scale = 0.5 + 0.3 * uniforms.audio_intensity; let tri_idx = f32(i / 3u); let sub_idx = i % 3u; if (sub_idx == 0u) { - return vec4(0.0, 0.0, 0.0, 1.0); + return vec4f(0.0, 0.0, 0.0, 1.0); } let angle = (tri_idx + f32(sub_idx - 1u)) * 2.0 * PI / num_sides + uniforms.time * 0.5; - return vec4(scale * cos(angle) / uniforms.aspect_ratio, scale * sin(angle), 0.0, 1.0); + return vec4f(scale * cos(angle) / uniforms.aspect_ratio, scale * sin(angle), 0.0, 1.0); } -@fragment fn fs_main() -> @location(0) vec4 { +@fragment fn fs_main() -> @location(0) vec4f { let h = uniforms.time * 2.0 + uniforms.audio_intensity * 3.0; let r = sin(h) * 0.5 + 0.5; let g = sin(h + 2.0) * 0.9 + 0.3; diff --git a/workspaces/main/shaders/masked_cube.wgsl b/workspaces/main/shaders/masked_cube.wgsl index 5e673a3..8e3fa26 100644 --- a/workspaces/main/shaders/masked_cube.wgsl +++ b/workspaces/main/shaders/masked_cube.wgsl @@ -12,35 +12,35 @@ @group(1) @binding(1) var mask_sampler: sampler; struct VertexOutput { - @builtin(position) position: vec4, - @location(0) local_pos: vec3, - @location(1) color: vec4, + @builtin(position) position: vec4f, + @location(0) local_pos: vec3f, + @location(1) color: vec4f, @location(2) @interpolate(flat) instance_index: u32, - @location(3) world_pos: vec3, - @location(4) transformed_normal: vec3, + @location(3) world_pos: vec3f, + @location(4) transformed_normal: vec3f, }; @vertex fn vs_main(@builtin(vertex_index) vertex_index: u32, @builtin(instance_index) instance_index: u32) -> VertexOutput { - var pos = array, 36>( - vec3(-1.0, -1.0, 1.0), vec3( 1.0, -1.0, 1.0), vec3( 1.0, 1.0, 1.0), - vec3(-1.0, -1.0, 1.0), vec3( 1.0, 1.0, 1.0), vec3(-1.0, 1.0, 1.0), - vec3(-1.0, -1.0, -1.0), vec3(-1.0, 1.0, -1.0), vec3( 1.0, 1.0, -1.0), - vec3(-1.0, -1.0, -1.0), vec3( 1.0, 1.0, -1.0), vec3( 1.0, -1.0, -1.0), - vec3(-1.0, 1.0, -1.0), vec3(-1.0, 1.0, 1.0), vec3( 1.0, 1.0, 1.0), - vec3(-1.0, 1.0, -1.0), vec3( 1.0, 1.0, 1.0), vec3( 1.0, 1.0, -1.0), - vec3(-1.0, -1.0, -1.0), vec3( 1.0, -1.0, -1.0), vec3( 1.0, -1.0, 1.0), - vec3(-1.0, -1.0, -1.0), vec3( 1.0, -1.0, 1.0), vec3(-1.0, -1.0, 1.0), - vec3( 1.0, -1.0, -1.0), vec3( 1.0, 1.0, -1.0), vec3( 1.0, 1.0, 1.0), - vec3( 1.0, -1.0, -1.0), vec3( 1.0, 1.0, 1.0), vec3( 1.0, -1.0, 1.0), - vec3(-1.0, -1.0, -1.0), vec3(-1.0, -1.0, 1.0), vec3(-1.0, 1.0, 1.0), - vec3(-1.0, -1.0, -1.0), vec3(-1.0, 1.0, 1.0), vec3(-1.0, 1.0, -1.0) + var pos = array( + vec3f(-1.0, -1.0, 1.0), vec3f( 1.0, -1.0, 1.0), vec3f( 1.0, 1.0, 1.0), + vec3f(-1.0, -1.0, 1.0), vec3f( 1.0, 1.0, 1.0), vec3f(-1.0, 1.0, 1.0), + vec3f(-1.0, -1.0, -1.0), vec3f(-1.0, 1.0, -1.0), vec3f( 1.0, 1.0, -1.0), + vec3f(-1.0, -1.0, -1.0), vec3f( 1.0, 1.0, -1.0), vec3f( 1.0, -1.0, -1.0), + vec3f(-1.0, 1.0, -1.0), vec3f(-1.0, 1.0, 1.0), vec3f( 1.0, 1.0, 1.0), + vec3f(-1.0, 1.0, -1.0), vec3f( 1.0, 1.0, 1.0), vec3f( 1.0, 1.0, -1.0), + vec3f(-1.0, -1.0, -1.0), vec3f( 1.0, -1.0, -1.0), vec3f( 1.0, -1.0, 1.0), + vec3f(-1.0, -1.0, -1.0), vec3f( 1.0, -1.0, 1.0), vec3f(-1.0, -1.0, 1.0), + vec3f( 1.0, -1.0, -1.0), vec3f( 1.0, 1.0, -1.0), vec3f( 1.0, 1.0, 1.0), + vec3f( 1.0, -1.0, -1.0), vec3f( 1.0, 1.0, 1.0), vec3f( 1.0, -1.0, 1.0), + vec3f(-1.0, -1.0, -1.0), vec3f(-1.0, -1.0, 1.0), vec3f(-1.0, 1.0, 1.0), + vec3f(-1.0, -1.0, -1.0), vec3f(-1.0, 1.0, 1.0), vec3f(-1.0, 1.0, -1.0) ); var p = pos[vertex_index]; let obj = object_data.objects[instance_index]; - let world_pos = obj.model * vec4(p, 1.0); + let world_pos = obj.model * vec4f(p, 1.0); let clip_pos = globals.view_proj * world_pos; var out: VertexOutput; @@ -49,7 +49,7 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32, out.color = obj.color; out.instance_index = instance_index; out.world_pos = world_pos.xyz; - out.transformed_normal = normalize(vec3(0.0, 1.0, 0.0)); + out.transformed_normal = normalize(vec3f(0.0, 1.0, 0.0)); return out; } @@ -60,7 +60,7 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32, #include "ray_box" struct FragmentOutput { - @location(0) color: vec4, + @location(0) color: vec4f, @builtin(frag_depth) depth: f32, }; @@ -76,19 +76,19 @@ fn fs_main(in: VertexOutput) -> FragmentOutput { let obj = object_data.objects[in.instance_index]; let obj_type = obj.params.x; - var p: vec3; - var normal: vec3; + var p: vec3f; + var normal: vec3f; var base_color = in.color.rgb; - let light_dir = normalize(vec3(1.0, 1.0, 1.0)); + let light_dir = normalize(vec3f(1.0, 1.0, 1.0)); let ray_origin = globals.camera_pos_time.xyz; let ray_dir = normalize(in.world_pos - ray_origin); let inv_model = obj.inv_model; - let local_origin = (inv_model * vec4(ray_origin, 1.0)).xyz; - let local_dir = normalize((inv_model * vec4(ray_dir, 0.0)).xyz); + let local_origin = (inv_model * vec4f(ray_origin, 1.0)).xyz; + let local_dir = normalize((inv_model * vec4f(ray_dir, 0.0)).xyz); - let bounds = ray_box_intersection(local_origin, local_dir, vec3(1.0)); + let bounds = ray_box_intersection(local_origin, local_dir, vec3f(1.0)); if (!bounds.hit) { discard; } @@ -99,11 +99,11 @@ fn fs_main(in: VertexOutput) -> FragmentOutput { var t_march = t_start; let max_steps = 128; var hit = false; - var local_p = vec3(0.0); + var local_p = vec3f(0.0); for (var step = 0; step < max_steps; step++) { local_p = local_origin + t_march * local_dir; - let d = sdBox(local_p, vec3(1.0)); + let d = sdBox(local_p, vec3f(1.0)); if (d < 0.001) { hit = true; @@ -122,17 +122,17 @@ fn fs_main(in: VertexOutput) -> FragmentOutput { p = local_p; let eps = 0.001; - normal = normalize(vec3( - sdBox(p + vec3(eps, 0.0, 0.0), vec3(1.0)) - - sdBox(p - vec3(eps, 0.0, 0.0), vec3(1.0)), - sdBox(p + vec3(0.0, eps, 0.0), vec3(1.0)) - - sdBox(p - vec3(0.0, eps, 0.0), vec3(1.0)), - sdBox(p + vec3(0.0, 0.0, eps), vec3(1.0)) - - sdBox(p - vec3(0.0, 0.0, eps), vec3(1.0)) + normal = normalize(vec3f( + sdBox(p + vec3f(eps, 0.0, 0.0), vec3f(1.0)) - + sdBox(p - vec3f(eps, 0.0, 0.0), vec3f(1.0)), + sdBox(p + vec3f(0.0, eps, 0.0), vec3f(1.0)) - + sdBox(p - vec3f(0.0, eps, 0.0), vec3f(1.0)), + sdBox(p + vec3f(0.0, 0.0, eps), vec3f(1.0)) - + sdBox(p - vec3f(0.0, 0.0, eps), vec3f(1.0)) )); - let world_p = (obj.model * vec4(p, 1.0)).xyz; - let world_normal = normalize((obj.model * vec4(normal, 0.0)).xyz); + let world_p = (obj.model * vec4f(p, 1.0)).xyz; + let world_normal = normalize((obj.model * vec4f(normal, 0.0)).xyz); let bump_strength = 0.3; let bump_scale = 4.0; @@ -140,7 +140,7 @@ fn fs_main(in: VertexOutput) -> FragmentOutput { let noise_val = textureSample(noise_tex, noise_sampler, noise_uv).r; let bump_offset = (noise_val - 0.5) * bump_strength; - let bumped_normal = normalize(world_normal + vec3(bump_offset)); + let bumped_normal = normalize(world_normal + vec3f(bump_offset)); let diffuse = max(dot(bumped_normal, light_dir), 0.0); let ambient = 0.3; @@ -148,11 +148,11 @@ fn fs_main(in: VertexOutput) -> FragmentOutput { let final_color = base_color * lighting; - let clip_p = globals.view_proj * vec4(world_p, 1.0); + let clip_p = globals.view_proj * vec4f(world_p, 1.0); let depth = clip_p.z / clip_p.w; var out: FragmentOutput; - out.color = vec4(final_color, 1.0); + out.color = vec4f(final_color, 1.0); out.depth = depth; return out; diff --git a/workspaces/main/shaders/mesh_render.wgsl b/workspaces/main/shaders/mesh_render.wgsl index 7390b06..d17a1e2 100644 --- a/workspaces/main/shaders/mesh_render.wgsl +++ b/workspaces/main/shaders/mesh_render.wgsl @@ -11,24 +11,24 @@ @group(0) @binding(5) var sky_tex: texture_2d; struct VertexInput { - @location(0) position: vec3, - @location(1) normal: vec3, - @location(2) uv: vec2, + @location(0) position: vec3f, + @location(1) normal: vec3f, + @location(2) uv: vec2f, }; struct VertexOutput { - @builtin(position) clip_pos: vec4, - @location(0) world_pos: vec3, - @location(1) normal: vec3, - @location(2) uv: vec2, - @location(3) color: vec4, + @builtin(position) clip_pos: vec4f, + @location(0) world_pos: vec3f, + @location(1) normal: vec3f, + @location(2) uv: vec2f, + @location(3) color: vec4f, @location(4) @interpolate(flat) instance_index: u32, }; @vertex fn vs_main(in: VertexInput, @builtin(instance_index) instance_index: u32) -> VertexOutput { let obj = object_data.objects[instance_index]; - let world_pos = obj.model * vec4(in.position, 1.0); + let world_pos = obj.model * vec4f(in.position, 1.0); var out: VertexOutput; out.clip_pos = globals.view_proj * world_pos; @@ -48,11 +48,11 @@ fn vs_main(in: VertexInput, @builtin(instance_index) instance_index: u32) -> Ver #include "render/lighting_utils" @fragment -fn fs_main(in: VertexOutput) -> @location(0) vec4 { - let light_dir = normalize(vec3(1.0, 1.0, 1.0)); +fn fs_main(in: VertexOutput) -> @location(0) vec4f { + let light_dir = normalize(vec3f(1.0, 1.0, 1.0)); let shadow = calc_shadow(in.world_pos, light_dir, 0.05, 20.0, in.instance_index); let lit_color = calculate_lighting(in.color.rgb, in.normal, in.world_pos, shadow); - return vec4(lit_color, in.color.a); + return vec4f(lit_color, in.color.a); } \ No newline at end of file diff --git a/workspaces/main/shaders/particle_compute.wgsl b/workspaces/main/shaders/particle_compute.wgsl index d7a24b6..2960cc4 100644 --- a/workspaces/main/shaders/particle_compute.wgsl +++ b/workspaces/main/shaders/particle_compute.wgsl @@ -1,9 +1,9 @@ // Particle simulation (compute shader) - V2 struct Particle { - pos: vec4, - vel: vec4, - rot: vec4, - color: vec4, + pos: vec4f, + vel: vec4f, + rot: vec4f, + color: vec4f, }; #include "sequence_uniforms" @@ -12,14 +12,14 @@ struct Particle { @group(0) @binding(1) var uniforms: UniformsSequenceParams; @compute @workgroup_size(64) -fn main(@builtin(global_invocation_id) id: vec3) { +fn main(@builtin(global_invocation_id) id: vec3u) { let i = id.x; if (i >= arrayLength(&particles)) { return; } var p = particles[i]; let new_pos = p.pos.xyz + p.vel.xyz * 0.016; - p.pos = vec4(new_pos, p.pos.w); + p.pos = vec4f(new_pos, p.pos.w); p.vel.y = p.vel.y - 0.01 * (1.0 + uniforms.audio_intensity * 5.0); p.rot.x = p.rot.x + p.rot.y * 0.016; if (p.pos.y < -1.5) { diff --git a/workspaces/main/shaders/particle_render.wgsl b/workspaces/main/shaders/particle_render.wgsl index dd83220..ef0db42 100644 --- a/workspaces/main/shaders/particle_render.wgsl +++ b/workspaces/main/shaders/particle_render.wgsl @@ -1,9 +1,9 @@ // Particle rendering (vertex + fragment) - V2 struct Particle { - pos: vec4, - vel: vec4, - rot: vec4, - color: vec4, + pos: vec4f, + vel: vec4f, + rot: vec4f, + color: vec4f, }; #include "sequence_uniforms" @@ -12,36 +12,36 @@ struct Particle { @group(0) @binding(1) var uniforms: UniformsSequenceParams; struct VSOut { - @builtin(position) pos: vec4, - @location(0) color: vec4, - @location(1) uv: vec2, + @builtin(position) pos: vec4f, + @location(0) color: vec4f, + @location(1) uv: vec2f, }; @vertex fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VSOut { let p = particles[ii]; let size = 0.02 + p.pos.z * 0.01 + uniforms.audio_intensity * 0.02; - var offsets = array, 6>( - vec2(-1, -1), - vec2(1, -1), - vec2(-1, 1), - vec2(-1, 1), - vec2(1, -1), - vec2(1, 1) + var offsets = array( + vec2f(-1, -1), + vec2f(1, -1), + vec2f(-1, 1), + vec2f(-1, 1), + vec2f(1, -1), + vec2f(1, 1) ); let offset = offsets[vi]; let c = cos(p.rot.x); let s = sin(p.rot.x); - let rotated_offset = vec2(offset.x * c - offset.y * s, offset.x * s + offset.y * c); - let pos = vec2(p.pos.x + rotated_offset.x * size / uniforms.aspect_ratio, p.pos.y + rotated_offset.y * size); + let rotated_offset = vec2f(offset.x * c - offset.y * s, offset.x * s + offset.y * c); + let pos = vec2f(p.pos.x + rotated_offset.x * size / uniforms.aspect_ratio, p.pos.y + rotated_offset.y * size); // Fade based on lifetime (p.pos.w goes from 1.0 to 0.0) let lifetime_fade = p.pos.w; - let color_with_fade = vec4(p.color.rgb * (0.5 + 0.5 * uniforms.audio_intensity), p.color.a * lifetime_fade); + let color_with_fade = vec4f(p.color.rgb * (0.5 + 0.5 * uniforms.audio_intensity), p.color.a * lifetime_fade); - return VSOut(vec4(pos, 0.0, 1.0), color_with_fade, offset); + return VSOut(vec4f(pos, 0.0, 1.0), color_with_fade, offset); } -@fragment fn fs_main(@location(0) color: vec4, @location(1) uv: vec2) -> @location(0) vec4 { +@fragment fn fs_main(@location(0) color: vec4f, @location(1) uv: vec2f) -> @location(0) vec4f { // Calculate distance from center for circular shape let dist = length(uv); @@ -49,5 +49,5 @@ struct VSOut { let circle_alpha = smoothstep(1.0, 0.5, dist); // Apply circular fade to alpha channel - return vec4(color.rgb, color.a * circle_alpha); + return vec4f(color.rgb, color.a * circle_alpha); } diff --git a/workspaces/main/shaders/particle_spray_compute.wgsl b/workspaces/main/shaders/particle_spray_compute.wgsl index 4b6e48f..7bdae88 100644 --- a/workspaces/main/shaders/particle_spray_compute.wgsl +++ b/workspaces/main/shaders/particle_spray_compute.wgsl @@ -1,8 +1,8 @@ struct Particle { - pos: vec4, - vel: vec4, - rot: vec4, - color: vec4, + pos: vec4f, + vel: vec4f, + rot: vec4f, + color: vec4f, }; #include "common_uniforms" @@ -15,7 +15,7 @@ fn hash(p: f32) -> f32 { } @compute @workgroup_size(64) -fn main(@builtin(global_invocation_id) id: vec3) { +fn main(@builtin(global_invocation_id) id: vec3u) { let i = id.x; if (i >= arrayLength(&particles)) { return; @@ -24,12 +24,12 @@ fn main(@builtin(global_invocation_id) id: vec3) { if (p.pos.w <= 0.0) { let r = hash(f32(i) + uniforms.time); let angle = r * 6.28318; - p.pos = vec4(0.0, 0.0, 0.0, 1.0); - p.vel = vec4(cos(angle), sin(angle), 0.0, 0.0) * (0.5 + hash(r) * 0.5) * (1.0 + uniforms.audio_intensity * 2.0); - p.color = vec4(hash(r + 0.1), hash(r + 0.2), 1.0, 1.0); + p.pos = vec4f(0.0, 0.0, 0.0, 1.0); + p.vel = vec4f(cos(angle), sin(angle), 0.0, 0.0) * (0.5 + hash(r) * 0.5) * (1.0 + uniforms.audio_intensity * 2.0); + p.color = vec4f(hash(r + 0.1), hash(r + 0.2), 1.0, 1.0); } let new_pos = p.pos.xyz + p.vel.xyz * 0.016; - p.pos = vec4(new_pos, p.pos.w - 0.01 * (1.0 + uniforms.beat_phase)); + p.pos = vec4f(new_pos, p.pos.w - 0.01 * (1.0 + uniforms.beat_phase)); p.vel.y = p.vel.y - 0.01; particles[i] = p; } diff --git a/workspaces/main/shaders/renderer_3d.wgsl b/workspaces/main/shaders/renderer_3d.wgsl index d3b0bae..824be2f 100644 --- a/workspaces/main/shaders/renderer_3d.wgsl +++ b/workspaces/main/shaders/renderer_3d.wgsl @@ -12,31 +12,31 @@ @group(0) @binding(5) var sky_tex: texture_2d; struct VertexOutput { - @builtin(position) position: vec4, - @location(0) local_pos: vec3, - @location(1) color: vec4, + @builtin(position) position: vec4f, + @location(0) local_pos: vec3f, + @location(1) color: vec4f, @location(2) @interpolate(flat) instance_index: u32, - @location(3) world_pos: vec3, - @location(4) transformed_normal: vec3, + @location(3) world_pos: vec3f, + @location(4) transformed_normal: vec3f, }; @vertex fn vs_main(@builtin(vertex_index) vertex_index: u32, @builtin(instance_index) instance_index: u32) -> VertexOutput { - var pos = array, 36>( - vec3(-1.0, -1.0, 1.0), vec3( 1.0, -1.0, 1.0), vec3( 1.0, 1.0, 1.0), - vec3(-1.0, -1.0, 1.0), vec3( 1.0, 1.0, 1.0), vec3(-1.0, 1.0, 1.0), - vec3(-1.0, -1.0, -1.0), vec3(-1.0, 1.0, -1.0), vec3( 1.0, 1.0, -1.0), - vec3(-1.0, -1.0, -1.0), vec3( 1.0, 1.0, -1.0), vec3( 1.0, -1.0, -1.0), - vec3(-1.0, 1.0, -1.0), vec3(-1.0, 1.0, 1.0), vec3( 1.0, 1.0, 1.0), - vec3(-1.0, 1.0, -1.0), vec3( 1.0, 1.0, 1.0), vec3( 1.0, 1.0, -1.0), - vec3(-1.0, -1.0, -1.0), vec3( 1.0, -1.0, -1.0), vec3( 1.0, -1.0, 1.0), - vec3(-1.0, -1.0, -1.0), vec3( 1.0, -1.0, 1.0), vec3(-1.0, -1.0, 1.0), - vec3( 1.0, -1.0, -1.0), vec3( 1.0, 1.0, -1.0), vec3( 1.0, 1.0, 1.0), - vec3( 1.0, -1.0, -1.0), vec3( 1.0, 1.0, 1.0), vec3( 1.0, -1.0, 1.0), - vec3(-1.0, -1.0, -1.0), vec3(-1.0, -1.0, 1.0), vec3(-1.0, 1.0, 1.0), - vec3(-1.0, -1.0, -1.0), vec3(-1.0, 1.0, 1.0), vec3(-1.0, 1.0, -1.0) + var pos = array( + vec3f(-1.0, -1.0, 1.0), vec3f( 1.0, -1.0, 1.0), vec3f( 1.0, 1.0, 1.0), + vec3f(-1.0, -1.0, 1.0), vec3f( 1.0, 1.0, 1.0), vec3f(-1.0, 1.0, 1.0), + vec3f(-1.0, -1.0, -1.0), vec3f(-1.0, 1.0, -1.0), vec3f( 1.0, 1.0, -1.0), + vec3f(-1.0, -1.0, -1.0), vec3f( 1.0, 1.0, -1.0), vec3f( 1.0, -1.0, -1.0), + vec3f(-1.0, 1.0, -1.0), vec3f(-1.0, 1.0, 1.0), vec3f( 1.0, 1.0, 1.0), + vec3f(-1.0, 1.0, -1.0), vec3f( 1.0, 1.0, 1.0), vec3f( 1.0, 1.0, -1.0), + vec3f(-1.0, -1.0, -1.0), vec3f( 1.0, -1.0, -1.0), vec3f( 1.0, -1.0, 1.0), + vec3f(-1.0, -1.0, -1.0), vec3f( 1.0, -1.0, 1.0), vec3f(-1.0, -1.0, 1.0), + vec3f( 1.0, -1.0, -1.0), vec3f( 1.0, 1.0, -1.0), vec3f( 1.0, 1.0, 1.0), + vec3f( 1.0, -1.0, -1.0), vec3f( 1.0, 1.0, 1.0), vec3f( 1.0, -1.0, 1.0), + vec3f(-1.0, -1.0, -1.0), vec3f(-1.0, -1.0, 1.0), vec3f(-1.0, 1.0, 1.0), + vec3f(-1.0, -1.0, -1.0), vec3f(-1.0, 1.0, 1.0), vec3f(-1.0, 1.0, -1.0) ); var p = pos[vertex_index]; @@ -47,7 +47,7 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32, // For meshes, we use the actual vertex data, not proxy geometry. // The position here is a placeholder, the real mesh data is handled by mesh_pipeline_. var out: VertexOutput; - out.position = vec4(0.0, 0.0, 2.0, 1.0); // Outside far plane, so it's not rendered by this pipeline. + out.position = vec4f(0.0, 0.0, 2.0, 1.0); // Outside far plane, so it's not rendered by this pipeline. return out; } @@ -58,7 +58,7 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32, p.y = p.y * 0.5; } - let world_pos = obj.model * vec4(p, 1.0); + let world_pos = obj.model * vec4f(p, 1.0); let clip_pos = globals.view_proj * world_pos; var out: VertexOutput; @@ -70,7 +70,7 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32, // For SDF primitives, we don't use vertex normals - they are computed analytically in the fragment shader. // This field is only used by the mesh pipeline (mesh_render.wgsl), not this SDF pipeline. - out.transformed_normal = normalize(vec3(0.0, 1.0, 0.0)); // Placeholder + out.transformed_normal = normalize(vec3f(0.0, 1.0, 0.0)); // Placeholder return out; } @@ -81,7 +81,7 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32, #include "ray_box" struct FragmentOutput { - @location(0) color: vec4, + @location(0) color: vec4f, @builtin(frag_depth) depth: f32, }; @@ -90,10 +90,10 @@ fn fs_main(in: VertexOutput) -> FragmentOutput { let obj = object_data.objects[in.instance_index]; let obj_type = obj.params.x; - var p: vec3; - var normal: vec3; + var p: vec3f; + var normal: vec3f; var base_color = in.color.rgb; - let light_dir = normalize(vec3(1.0, 1.0, 1.0)); + let light_dir = normalize(vec3f(1.0, 1.0, 1.0)); if (obj_type <= 0.0) { // Raster path (legacy or generic) p = in.world_pos; @@ -109,13 +109,13 @@ fn fs_main(in: VertexOutput) -> FragmentOutput { let rd_world = normalize(in.world_pos - ro_world); // Ray-Box Intersection in local space to find tight bounds - let ro_local = (obj.inv_model * vec4(ro_world, 1.0)).xyz; - let rd_local = normalize((obj.inv_model * vec4(rd_world, 0.0)).xyz); + let ro_local = (obj.inv_model * vec4f(ro_world, 1.0)).xyz; + let rd_local = normalize((obj.inv_model * vec4f(rd_world, 0.0)).xyz); // Proxy box extent (matches vs_main) // MESHES use obj.params.yzw for extent - var extent = vec3(1.0); - if (obj.params.x == 3.0) { extent = vec3(1.5, 0.5, 1.5); } // Torus + var extent = vec3f(1.0); + if (obj.params.x == 3.0) { extent = vec3f(1.5, 0.5, 1.5); } // Torus else if (obj.params.x == 5.0) { extent = obj.params.yzw; } // MESH extent let bounds = ray_box_intersection(ro_local, rd_local, extent); @@ -134,7 +134,7 @@ fn fs_main(in: VertexOutput) -> FragmentOutput { if (!hit) { discard; } let q_hit = ro_local + rd_local * t; - p = (obj.model * vec4(q_hit, 1.0)).xyz; // Correct world position + p = (obj.model * vec4f(q_hit, 1.0)).xyz; // Correct world position // Calculate normal with bump mapping (using utility function) let disp_strength = 0.05; @@ -157,10 +157,10 @@ fn fs_main(in: VertexOutput) -> FragmentOutput { let lit_color = calculate_lighting(base_color, normal, p, shadow); var out: FragmentOutput; - out.color = vec4(lit_color, 1.0); + out.color = vec4f(lit_color, 1.0); // Calculate and write correct depth - let clip_pos = globals.view_proj * vec4(p, 1.0); + let clip_pos = globals.view_proj * vec4f(p, 1.0); out.depth = clip_pos.z / clip_pos.w; return out; diff --git a/workspaces/main/shaders/rotating_cube.wgsl b/workspaces/main/shaders/rotating_cube.wgsl index d7e4cae..0c75a13 100644 --- a/workspaces/main/shaders/rotating_cube.wgsl +++ b/workspaces/main/shaders/rotating_cube.wgsl @@ -1,65 +1,65 @@ // Rotating cube shader v2 (simplified, no masking) struct Uniforms { - view_proj: mat4x4, - inv_view_proj: mat4x4, - camera_pos_time: vec4, - params: vec4, - resolution: vec2, + view_proj: mat4x4f, + inv_view_proj: mat4x4f, + camera_pos_time: vec4f, + params: vec4f, + resolution: vec2f, aspect_ratio: f32, _pad: f32, }; struct ObjectData { - model: mat4x4, - inv_model: mat4x4, - color: vec4, - params: vec4, + model: mat4x4f, + inv_model: mat4x4f, + color: vec4f, + params: vec4f, }; @group(0) @binding(0) var uniforms: Uniforms; @group(0) @binding(1) var object: ObjectData; struct VSOut { - @builtin(position) pos: vec4, - @location(0) world_pos: vec3, - @location(1) normal: vec3, + @builtin(position) pos: vec4f, + @location(0) world_pos: vec3f, + @location(1) normal: vec3f, }; // Cube vertices (hardcoded) -fn get_cube_vertex(vid: u32) -> vec3 { - let positions = array, 36>( +fn get_cube_vertex(vid: u32) -> vec3f { + let positions = array( // Front face - vec3(-1, -1, 1), vec3( 1, -1, 1), vec3( 1, 1, 1), - vec3(-1, -1, 1), vec3( 1, 1, 1), vec3(-1, 1, 1), + vec3f(-1, -1, 1), vec3f( 1, -1, 1), vec3f( 1, 1, 1), + vec3f(-1, -1, 1), vec3f( 1, 1, 1), vec3f(-1, 1, 1), // Back face - vec3( 1, -1, -1), vec3(-1, -1, -1), vec3(-1, 1, -1), - vec3( 1, -1, -1), vec3(-1, 1, -1), vec3( 1, 1, -1), + vec3f( 1, -1, -1), vec3f(-1, -1, -1), vec3f(-1, 1, -1), + vec3f( 1, -1, -1), vec3f(-1, 1, -1), vec3f( 1, 1, -1), // Right face - vec3( 1, -1, 1), vec3( 1, -1, -1), vec3( 1, 1, -1), - vec3( 1, -1, 1), vec3( 1, 1, -1), vec3( 1, 1, 1), + vec3f( 1, -1, 1), vec3f( 1, -1, -1), vec3f( 1, 1, -1), + vec3f( 1, -1, 1), vec3f( 1, 1, -1), vec3f( 1, 1, 1), // Left face - vec3(-1, -1, -1), vec3(-1, -1, 1), vec3(-1, 1, 1), - vec3(-1, -1, -1), vec3(-1, 1, 1), vec3(-1, 1, -1), + vec3f(-1, -1, -1), vec3f(-1, -1, 1), vec3f(-1, 1, 1), + vec3f(-1, -1, -1), vec3f(-1, 1, 1), vec3f(-1, 1, -1), // Top face - vec3(-1, 1, 1), vec3( 1, 1, 1), vec3( 1, 1, -1), - vec3(-1, 1, 1), vec3( 1, 1, -1), vec3(-1, 1, -1), + vec3f(-1, 1, 1), vec3f( 1, 1, 1), vec3f( 1, 1, -1), + vec3f(-1, 1, 1), vec3f( 1, 1, -1), vec3f(-1, 1, -1), // Bottom face - vec3(-1, -1, -1), vec3( 1, -1, -1), vec3( 1, -1, 1), - vec3(-1, -1, -1), vec3( 1, -1, 1), vec3(-1, -1, 1) + vec3f(-1, -1, -1), vec3f( 1, -1, -1), vec3f( 1, -1, 1), + vec3f(-1, -1, -1), vec3f( 1, -1, 1), vec3f(-1, -1, 1) ); return positions[vid]; } -fn get_cube_normal(vid: u32) -> vec3 { +fn get_cube_normal(vid: u32) -> vec3f { let face_id = vid / 6u; - let normals = array, 6>( - vec3( 0, 0, 1), // Front - vec3( 0, 0, -1), // Back - vec3( 1, 0, 0), // Right - vec3(-1, 0, 0), // Left - vec3( 0, 1, 0), // Top - vec3( 0, -1, 0) // Bottom + let normals = array( + vec3f( 0, 0, 1), // Front + vec3f( 0, 0, -1), // Back + vec3f( 1, 0, 0), // Right + vec3f(-1, 0, 0), // Left + vec3f( 0, 1, 0), // Top + vec3f( 0, -1, 0) // Bottom ); return normals[face_id]; } @@ -68,22 +68,22 @@ fn get_cube_normal(vid: u32) -> vec3 { let local_pos = get_cube_vertex(vid); let local_normal = get_cube_normal(vid); - let world_pos = object.model * vec4(local_pos, 1.0); - let world_normal = normalize((object.model * vec4(local_normal, 0.0)).xyz); + let world_pos = object.model * vec4f(local_pos, 1.0); + let world_normal = normalize((object.model * vec4f(local_normal, 0.0)).xyz); let clip_pos = uniforms.view_proj * world_pos; return VSOut(clip_pos, world_pos.xyz, world_normal); } -@fragment fn fs_main(@location(0) world_pos: vec3, @location(1) normal: vec3) -> @location(0) vec4 { +@fragment fn fs_main(@location(0) world_pos: vec3f, @location(1) normal: vec3f) -> @location(0) vec4f { let N = normalize(normal); - let light_dir = normalize(vec3(1.0, 1.0, 1.0)); + let light_dir = normalize(vec3f(1.0, 1.0, 1.0)); let diffuse = max(dot(N, light_dir), 0.0); let ambient = 0.3; let lighting = ambient + diffuse * 0.7; let color = object.color.rgb * lighting; - return vec4(color, 1.0); + return vec4f(color, 1.0); } diff --git a/workspaces/main/shaders/scene1.wgsl b/workspaces/main/shaders/scene1.wgsl index 8cc36cd..035f2e9 100644 --- a/workspaces/main/shaders/scene1.wgsl +++ b/workspaces/main/shaders/scene1.wgsl @@ -23,7 +23,7 @@ const sunDir1 = vec3f(0.0, 0.04997, -0.99875); // normalize(0, 0.05, -1) const lightPos1 = vec3f(10.0, 10.0, 10.0); const lightPos2 = vec3f(-10.0, 10.0, -10.0); -fn rayPlane(ray: Ray, plane: vec4) -> f32 { +fn rayPlane(ray: Ray, plane: vec4f) -> f32 { return (dot(ray.origin, plane.xyz) - plane.w) / dot(ray.direction, plane.xyz); } @@ -40,7 +40,7 @@ fn render0(ray: Ray) -> vec3f { if (tp1 > 0.0) { let pos = ray.origin + tp1 * ray.direction; let pp = pos.xz; - let db = sdBox2D(pp, vec2(5.0, 9.0)) - 3.0; + let db = sdBox2D(pp, vec2f(5.0, 9.0)) - 3.0; col += vec3f(4.0) * skyCol * y * y * smoothstep(0.25, 0.0, db); col += vec3f(0.8) * skyCol * exp(-0.5 * max(db, 0.0)); } @@ -155,7 +155,7 @@ fn render1(ray: Ray) -> vec3f { #include "render/fullscreen_vs" -@fragment fn fs_main(@builtin(position) p: vec4) -> @location(0) vec4 { +@fragment fn fs_main(@builtin(position) p: vec4f) -> @location(0) vec4f { let coord = getScreenCoord(p, uniforms.resolution); let ray = getCameraRay(camera, coord); var col = render1(ray); diff --git a/workspaces/main/shaders/sdf_test.wgsl b/workspaces/main/shaders/sdf_test.wgsl index 3b63fef..941481e 100644 --- a/workspaces/main/shaders/sdf_test.wgsl +++ b/workspaces/main/shaders/sdf_test.wgsl @@ -37,15 +37,15 @@ fn shade(pos: vec3f, rd: vec3f) -> vec3f { } @vertex -fn vs_main(@builtin(vertex_index) vid: u32) -> @builtin(position) vec4 { +fn vs_main(@builtin(vertex_index) vid: u32) -> @builtin(position) vec4f { // Fullscreen triangle let x = f32((vid & 1u) << 2u) - 1.0; let y = f32((vid & 2u) << 1u) - 1.0; - return vec4(x, y, 0.0, 1.0); + return vec4f(x, y, 0.0, 1.0); } @fragment -fn fs_main(@builtin(position) pos: vec4) -> @location(0) vec4 { +fn fs_main(@builtin(position) pos: vec4f) -> @location(0) vec4f { // UV coordinates (-1 to 1) let uv = (pos.xy / uniforms.resolution - 0.5) * 2.0; @@ -64,5 +64,5 @@ fn fs_main(@builtin(position) pos: vec4) -> @location(0) vec4 { col = shade(hit_pos, ray.direction); } - return vec4(col, 1.0); + return vec4f(col, 1.0); } diff --git a/workspaces/main/shaders/solarize.wgsl b/workspaces/main/shaders/solarize.wgsl index 0a69b83..02065de 100644 --- a/workspaces/main/shaders/solarize.wgsl +++ b/workspaces/main/shaders/solarize.wgsl @@ -7,7 +7,7 @@ #include "render/fullscreen_vs" -@fragment fn fs_main(@builtin(position) p: vec4) -> @location(0) vec4 { +@fragment fn fs_main(@builtin(position) p: vec4f) -> @location(0) vec4f { let uv = p.xy / uniforms.resolution; var col = textureSample(txt, smplr, uv); diff --git a/workspaces/main/shaders/vignette.wgsl b/workspaces/main/shaders/vignette.wgsl index c4d0389..9b98ec9 100644 --- a/workspaces/main/shaders/vignette.wgsl +++ b/workspaces/main/shaders/vignette.wgsl @@ -13,12 +13,12 @@ struct VignetteParams { #include "render/fullscreen_vs" @fragment -fn fs_main(@builtin(position) pos: vec4) -> @location(0) vec4 { +fn fs_main(@builtin(position) pos: vec4f) -> @location(0) vec4f { let uv = pos.xy / common_uniforms.resolution; let color = textureSample(input_tex, input_sampler, uv); - let d = distance(uv, vec2(0.5, 0.5)); + let d = distance(uv, vec2f(0.5, 0.5)); let vignette = smoothstep(params.radius, params.radius - params.softness, d); - return vec4(color.rgb * mix(1.0, vignette, common_uniforms.audio_intensity), color.a); + return vec4f(color.rgb * mix(1.0, vignette, common_uniforms.audio_intensity), color.a); } \ No newline at end of file diff --git a/workspaces/main/shaders/visual_debug.wgsl b/workspaces/main/shaders/visual_debug.wgsl index 63e1f13..3a382ca 100644 --- a/workspaces/main/shaders/visual_debug.wgsl +++ b/workspaces/main/shaders/visual_debug.wgsl @@ -1,31 +1,31 @@ struct GlobalUniforms { - view_proj: mat4x4, - inv_view_proj: mat4x4, - camera_pos_time: vec4, - params: vec4, - resolution: vec2, + view_proj: mat4x4f, + inv_view_proj: mat4x4f, + camera_pos_time: vec4f, + params: vec4f, + resolution: vec2f, }; @group(0) @binding(0) var uniforms : GlobalUniforms; struct VertexInput { - @location(0) position : vec3, - @location(1) color : vec3, + @location(0) position : vec3f, + @location(1) color : vec3f, } struct VertexOutput { - @builtin(position) position : vec4, - @location(0) color : vec3, + @builtin(position) position : vec4f, + @location(0) color : vec3f, } @vertex fn vs_main(in : VertexInput) -> VertexOutput { var out : VertexOutput; - out.position = uniforms.view_proj * vec4(in.position, 1.0); + out.position = uniforms.view_proj * vec4f(in.position, 1.0); out.color = in.color; return out; } @fragment -fn fs_main(in : VertexOutput) -> @location(0) vec4 { - return vec4(in.color, 1.0); +fn fs_main(in : VertexOutput) -> @location(0) vec4f { + return vec4f(in.color, 1.0); } -- cgit v1.2.3