diff --git a/Cargo.lock b/Cargo.lock index 47698f71f..9676b3615 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -655,9 +655,9 @@ dependencies = [ [[package]] name = "glam" -version = "0.20.2" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4fa84eead97d5412b2a20aed4d66612a97a9e41e08eababdb9ae2bf88667490" +checksum = "f43e957e744be03f5801a55472f593d43fabdebf25a4585db250f04d86b1675f" [[package]] name = "glow" @@ -1032,7 +1032,7 @@ dependencies = [ [[package]] name = "naga" version = "0.8.0" -source = "git+https://github.com/gfx-rs/naga?rev=7aaac25f#7aaac25fbf64c0f77f0e2deba2963293f3632dad" +source = "git+https://github.com/gfx-rs/naga?rev=1720725#172072501490c877d1efddeb653e0a74107b900c" dependencies = [ "bit-set", "bitflags", diff --git a/cts_runner/examples/hello-compute.js b/cts_runner/examples/hello-compute.js index fc3cff60f..bcd7505d9 100644 --- a/cts_runner/examples/hello-compute.js +++ b/cts_runner/examples/hello-compute.js @@ -35,7 +35,7 @@ fn collatz_iterations(n_base: u32) -> u32{ } return i; } -@stage(compute) +@compute @workgroup_size(1) fn main(@builtin(global_invocation_id) global_id: vec3) { v_indices[global_id.x] = collatz_iterations(v_indices[global_id.x]); diff --git a/player/tests/data/empty.wgsl b/player/tests/data/empty.wgsl index b328193f5..ee8034559 100644 --- a/player/tests/data/empty.wgsl +++ b/player/tests/data/empty.wgsl @@ -1,4 +1,4 @@ -@stage(compute) +@compute @workgroup_size(1) fn main() { } diff --git a/player/tests/data/quad.wgsl b/player/tests/data/quad.wgsl index a73538988..73982024b 100644 --- a/player/tests/data/quad.wgsl +++ b/player/tests/data/quad.wgsl @@ -1,4 +1,4 @@ -@stage(vertex) +@vertex fn vs_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4 { // hacky way to draw a large triangle let tmp1 = i32(vertex_index) / 2; @@ -10,7 +10,7 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4< return vec4(pos, 0.0, 1.0); } -@stage(fragment) +@fragment fn fs_main() -> @location(0) vec4 { return vec4(1.0, 1.0, 1.0, 1.0); } diff --git a/player/tests/data/zero-init-buffer-for-binding.wgsl b/player/tests/data/zero-init-buffer-for-binding.wgsl index 884cf8afb..0dae384f0 100644 --- a/player/tests/data/zero-init-buffer-for-binding.wgsl +++ b/player/tests/data/zero-init-buffer-for-binding.wgsl @@ -2,7 +2,7 @@ @binding(0) var buffer: array; -@stage(compute) +@compute @workgroup_size(1) fn main(@builtin(global_invocation_id) global_id: vec3) { buffer[global_id.x] = buffer[global_id.x] + global_id.x; diff --git a/player/tests/data/zero-init-texture-binding.wgsl b/player/tests/data/zero-init-texture-binding.wgsl index 5ddd6473c..729c20ba4 100644 --- a/player/tests/data/zero-init-texture-binding.wgsl +++ b/player/tests/data/zero-init-texture-binding.wgsl @@ -1,7 +1,7 @@ @group(0) @binding(0) var tex: texture_2d; @group(0) @binding(1) var tex_storage: texture_storage_2d; -@stage(compute) +@compute @workgroup_size(1) fn main(@builtin(global_invocation_id) global_id: vec3) { } diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index 822f750c2..7186d2220 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -40,7 +40,7 @@ thiserror = "1" [dependencies.naga] git = "https://github.com/gfx-rs/naga" -rev = "7aaac25f" +rev = "1720725" #version = "0.8" features = ["span", "validate", "wgsl-in"] diff --git a/wgpu-core/src/validation.rs b/wgpu-core/src/validation.rs index e46451028..ad76f0523 100644 --- a/wgpu-core/src/validation.rs +++ b/wgpu-core/src/validation.rs @@ -845,10 +845,7 @@ impl Interface { sampling, }, }, - Some(&naga::Binding::BuiltIn { - built_in, - invariant: _, - }) => Varying::BuiltIn(built_in), + Some(&naga::Binding::BuiltIn(built_in)) => Varying::BuiltIn(built_in), None => { log::error!("Missing binding for a varying"); return; diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index 178f43825..5ed3a22e6 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -91,14 +91,14 @@ js-sys = { version = "0.3" } [dependencies.naga] git = "https://github.com/gfx-rs/naga" -rev = "7aaac25f" +rev = "1720725" #version = "0.8" # DEV dependencies [dev-dependencies.naga] git = "https://github.com/gfx-rs/naga" -rev = "7aaac25f" +rev = "1720725" #version = "0.8" features = ["wgsl-in"] diff --git a/wgpu-hal/examples/halmark/shader.wgsl b/wgpu-hal/examples/halmark/shader.wgsl index 960424bb7..70385cbf2 100644 --- a/wgpu-hal/examples/halmark/shader.wgsl +++ b/wgpu-hal/examples/halmark/shader.wgsl @@ -23,7 +23,7 @@ struct VertexOutput { @location(1) color: vec4, }; -@stage(vertex) +@vertex fn vs_main(@builtin(vertex_index) vi: u32) -> VertexOutput { let tc = vec2(f32(vi & 1u), 0.5 * f32(vi & 2u)); let offset = vec2(tc.x * globals.size.x, tc.y * globals.size.y); @@ -39,7 +39,7 @@ var texture: texture_2d; @binding(2) var sam: sampler; -@stage(fragment) +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { return in.color * textureSampleLevel(texture, sam, in.tex_coords, 0.0); } diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index 3d33d049b..7a954e76f 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -139,20 +139,20 @@ env_logger = "0.9" [dependencies.naga] git = "https://github.com/gfx-rs/naga" -rev = "7aaac25f" +rev = "1720725" #version = "0.8" optional = true # used to test all the example shaders [dev-dependencies.naga] git = "https://github.com/gfx-rs/naga" -rev = "7aaac25f" +rev = "1720725" #version = "0.8" features = ["wgsl-in"] [target.'cfg(target_arch = "wasm32")'.dependencies.naga] git = "https://github.com/gfx-rs/naga" -rev = "7aaac25f" +rev = "1720725" #version = "0.8" features = ["wgsl-out"] diff --git a/wgpu/examples/boids/compute.wgsl b/wgpu/examples/boids/compute.wgsl index 95c9f1719..6000cff30 100644 --- a/wgpu/examples/boids/compute.wgsl +++ b/wgpu/examples/boids/compute.wgsl @@ -18,7 +18,7 @@ struct SimParams { @group(0) @binding(2) var particlesDst : array; // https://github.com/austinEng/Project6-Vulkan-Flocking/blob/master/data/shaders/computeparticles/particle.comp -@stage(compute) +@compute @workgroup_size(64) fn main(@builtin(global_invocation_id) global_invocation_id: vec3) { let total = arrayLength(&particlesSrc); diff --git a/wgpu/examples/boids/draw.wgsl b/wgpu/examples/boids/draw.wgsl index 72056df83..fe050d056 100644 --- a/wgpu/examples/boids/draw.wgsl +++ b/wgpu/examples/boids/draw.wgsl @@ -1,4 +1,4 @@ -@stage(vertex) +@vertex fn main_vs( @location(0) particle_pos: vec2, @location(1) particle_vel: vec2, @@ -12,7 +12,7 @@ fn main_vs( return vec4(pos + particle_pos, 0.0, 1.0); } -@stage(fragment) +@fragment fn main_fs() -> @location(0) vec4 { return vec4(1.0, 1.0, 1.0, 1.0); } diff --git a/wgpu/examples/conservative-raster/triangle_and_lines.wgsl b/wgpu/examples/conservative-raster/triangle_and_lines.wgsl index 5593cee43..354add0c7 100644 --- a/wgpu/examples/conservative-raster/triangle_and_lines.wgsl +++ b/wgpu/examples/conservative-raster/triangle_and_lines.wgsl @@ -1,4 +1,4 @@ -@stage(vertex) +@vertex fn vs_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4 { let i: i32 = i32(vertex_index % 3u); let x: f32 = f32(i - 1) * 0.75; @@ -6,17 +6,17 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4< return vec4(x, y, 0.0, 1.0); } -@stage(fragment) +@fragment fn fs_main_red() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } -@stage(fragment) +@fragment fn fs_main_blue() -> @location(0) vec4 { return vec4(0.13, 0.31, 0.85, 1.0); // cornflower blue in linear space } -@stage(fragment) +@fragment fn fs_main_white() -> @location(0) vec4 { return vec4(1.0, 1.0, 1.0, 1.0); -} \ No newline at end of file +} diff --git a/wgpu/examples/conservative-raster/upscale.wgsl b/wgpu/examples/conservative-raster/upscale.wgsl index cbad67e33..93390ed7b 100644 --- a/wgpu/examples/conservative-raster/upscale.wgsl +++ b/wgpu/examples/conservative-raster/upscale.wgsl @@ -3,7 +3,7 @@ struct VertexOutput { @location(0) tex_coords: vec2, }; -@stage(vertex) +@vertex fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput { let x: f32 = f32(i32(vertex_index & 1u) << 2u) - 1.0; let y: f32 = f32(i32(vertex_index & 2u) << 1u) - 1.0; @@ -20,7 +20,7 @@ var r_color: texture_2d; @binding(1) var r_sampler: sampler; -@stage(fragment) +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { return textureSample(r_color, r_sampler, in.tex_coords); } diff --git a/wgpu/examples/cube/shader.wgsl b/wgpu/examples/cube/shader.wgsl index 98ee4dfdf..d345f8093 100644 --- a/wgpu/examples/cube/shader.wgsl +++ b/wgpu/examples/cube/shader.wgsl @@ -10,7 +10,7 @@ struct Locals { @binding(0) var r_locals: Locals; -@stage(vertex) +@vertex fn vs_main( @location(0) position: vec4, @location(1) tex_coord: vec2, @@ -25,14 +25,14 @@ fn vs_main( @binding(1) var r_color: texture_2d; -@stage(fragment) +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { let tex = textureLoad(r_color, vec2(in.tex_coord * 256.0), 0); let v = f32(tex.x) / 255.0; return vec4(1.0 - (v * 5.0), 1.0 - (v * 15.0), 1.0 - (v * 50.0), 1.0); } -@stage(fragment) +@fragment fn fs_wire() -> @location(0) vec4 { return vec4(0.0, 0.5, 0.0, 0.5); } diff --git a/wgpu/examples/hello-compute/shader.wgsl b/wgpu/examples/hello-compute/shader.wgsl index 7421e3cf4..41af4363a 100644 --- a/wgpu/examples/hello-compute/shader.wgsl +++ b/wgpu/examples/hello-compute/shader.wgsl @@ -31,7 +31,7 @@ fn collatz_iterations(n_base: u32) -> u32{ return i; } -@stage(compute) +@compute @workgroup_size(1) fn main(@builtin(global_invocation_id) global_id: vec3) { v_indices[global_id.x] = collatz_iterations(v_indices[global_id.x]); diff --git a/wgpu/examples/hello-triangle/shader.wgsl b/wgpu/examples/hello-triangle/shader.wgsl index 54d05914a..f84ccfe94 100644 --- a/wgpu/examples/hello-triangle/shader.wgsl +++ b/wgpu/examples/hello-triangle/shader.wgsl @@ -1,11 +1,11 @@ -@stage(vertex) +@vertex fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) vec4 { let x = f32(i32(in_vertex_index) - 1); let y = f32(i32(in_vertex_index & 1u) * 2 - 1); return vec4(x, y, 0.0, 1.0); } -@stage(fragment) +@fragment fn fs_main() -> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); } diff --git a/wgpu/examples/mipmap/blit.wgsl b/wgpu/examples/mipmap/blit.wgsl index 3f7db594f..76e5f4493 100644 --- a/wgpu/examples/mipmap/blit.wgsl +++ b/wgpu/examples/mipmap/blit.wgsl @@ -3,7 +3,7 @@ struct VertexOutput { @location(0) tex_coords: vec2, }; -@stage(vertex) +@vertex fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput { var out: VertexOutput; let x = i32(vertex_index) / 2; @@ -28,7 +28,7 @@ var r_color: texture_2d; @binding(1) var r_sampler: sampler; -@stage(fragment) +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { return textureSample(r_color, r_sampler, in.tex_coords); } diff --git a/wgpu/examples/mipmap/draw.wgsl b/wgpu/examples/mipmap/draw.wgsl index e3c6340d3..804e43d1b 100644 --- a/wgpu/examples/mipmap/draw.wgsl +++ b/wgpu/examples/mipmap/draw.wgsl @@ -10,7 +10,7 @@ struct Locals { @binding(0) var r_data: Locals; -@stage(vertex) +@vertex fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput { let pos = vec2( 100.0 * (1.0 - f32(vertex_index & 2u)), @@ -29,7 +29,7 @@ var r_color: texture_2d; @binding(2) var r_sampler: sampler; -@stage(fragment) +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { return textureSample(r_color, r_sampler, in.tex_coords); } diff --git a/wgpu/examples/msaa-line/shader.wgsl b/wgpu/examples/msaa-line/shader.wgsl index 4c713fd57..4a6023cdf 100644 --- a/wgpu/examples/msaa-line/shader.wgsl +++ b/wgpu/examples/msaa-line/shader.wgsl @@ -3,7 +3,7 @@ struct VertexOutput { @builtin(position) position: vec4, }; -@stage(vertex) +@vertex fn vs_main( @location(0) position: vec2, @location(1) color: vec4, @@ -14,7 +14,7 @@ fn vs_main( return out; } -@stage(fragment) +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { return in.color; } diff --git a/wgpu/examples/shadow/shader.wgsl b/wgpu/examples/shadow/shader.wgsl index 040c9c870..6a8d607df 100644 --- a/wgpu/examples/shadow/shader.wgsl +++ b/wgpu/examples/shadow/shader.wgsl @@ -16,7 +16,7 @@ struct Entity { @binding(0) var u_entity: Entity; -@stage(vertex) +@vertex fn vs_bake(@location(0) position: vec4) -> @builtin(position) vec4 { return u_globals.view_proj * u_entity.world * vec4(position); } @@ -27,7 +27,7 @@ struct VertexOutput { @location(1) world_position: vec4 }; -@stage(vertex) +@vertex fn vs_main( @location(0) position: vec4, @location(1) normal: vec4, @@ -78,7 +78,7 @@ fn fetch_shadow(light_id: u32, homogeneous_coords: vec4) -> f32 { let c_ambient: vec3 = vec3(0.05, 0.05, 0.05); let c_max_lights: u32 = 10u; -@stage(fragment) +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { let normal = normalize(in.world_normal); // accumulate color @@ -98,7 +98,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4 { } // The fragment entrypoint used when storage buffers are not available for the lights -@stage(fragment) +@fragment fn fs_main_without_storage(in: VertexOutput) -> @location(0) vec4 { let normal = normalize(in.world_normal); var color: vec3 = c_ambient; diff --git a/wgpu/examples/skybox/shader.wgsl b/wgpu/examples/skybox/shader.wgsl index ff8d0dd2d..b441c2eaa 100644 --- a/wgpu/examples/skybox/shader.wgsl +++ b/wgpu/examples/skybox/shader.wgsl @@ -17,7 +17,7 @@ struct Data { @binding(0) var r_data: Data; -@stage(vertex) +@vertex fn vs_sky(@builtin(vertex_index) vertex_index: u32) -> SkyOutput { // hacky way to draw a large triangle let tmp1 = i32(vertex_index) / 2; @@ -45,7 +45,7 @@ struct EntityOutput { @location(3) view: vec3, }; -@stage(vertex) +@vertex fn vs_entity( @location(0) pos: vec3, @location(1) normal: vec3, @@ -64,12 +64,12 @@ var r_texture: texture_cube; @binding(2) var r_sampler: sampler; -@stage(fragment) +@fragment fn fs_sky(in: SkyOutput) -> @location(0) vec4 { return textureSample(r_texture, r_sampler, in.uv); } -@stage(fragment) +@fragment fn fs_entity(in: EntityOutput) -> @location(0) vec4 { let incident = normalize(in.view); let normal = normalize(in.normal); diff --git a/wgpu/examples/water/terrain.wgsl b/wgpu/examples/water/terrain.wgsl index a5d3a0a42..f1c2a6eb5 100644 --- a/wgpu/examples/water/terrain.wgsl +++ b/wgpu/examples/water/terrain.wgsl @@ -18,7 +18,7 @@ struct VertexOutput { @location(1) clip_dist: f32, }; -@stage(vertex) +@vertex fn vs_main( @location(0) position: vec3, @location(1) normal: vec3, @@ -36,7 +36,7 @@ fn vs_main( return out; } -@stage(fragment) +@fragment @early_depth_test fn fs_main( in: VertexOutput, diff --git a/wgpu/examples/water/water.wgsl b/wgpu/examples/water/water.wgsl index ea4633b69..61653dd02 100644 --- a/wgpu/examples/water/water.wgsl +++ b/wgpu/examples/water/water.wgsl @@ -187,7 +187,7 @@ struct VertexOutput { @location(2) f_Light: vec3, }; -@stage(vertex) +@vertex fn vs_main( @location(0) position: vec2, @location(1) offsets: vec4, @@ -233,7 +233,7 @@ fn to_linear_depth(depth: f32) -> f32 { return z_e; } -@stage(fragment) +@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { let reflection_colour = textureSample(reflection, colour_sampler, in.f_WaterScreenPos.xy).xyz; diff --git a/wgpu/tests/vertex_indices/draw.vert.wgsl b/wgpu/tests/vertex_indices/draw.vert.wgsl index 26e07e425..6fc8e3746 100644 --- a/wgpu/tests/vertex_indices/draw.vert.wgsl +++ b/wgpu/tests/vertex_indices/draw.vert.wgsl @@ -1,14 +1,14 @@ @group(0) @binding(0) var indices: array; // this is used as both input and output for convenience -@stage(vertex) +@vertex fn vs_main(@builtin(instance_index) instance: u32, @builtin(vertex_index) index: u32) -> @builtin(position) vec4 { let idx = instance * 3u + index; indices[idx] = idx; return vec4(0.0, 0.0, 0.0, 1.0); } -@stage(fragment) +@fragment fn fs_main() -> @location(0) vec4 { return vec4(0.0); }