Skip to content

Commit

Permalink
Merge pull request #2602 from Gordon-F/naga_update
Browse files Browse the repository at this point in the history
Update to Naga rev 1720725
  • Loading branch information
jimblandy authored Apr 15, 2022
2 parents 759e7ff + eff5043 commit 9743068
Show file tree
Hide file tree
Showing 26 changed files with 54 additions and 57 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cts_runner/examples/hello-compute.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<u32>) {
v_indices[global_id.x] = collatz_iterations(v_indices[global_id.x]);
Expand Down
2 changes: 1 addition & 1 deletion player/tests/data/empty.wgsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@stage(compute)
@compute
@workgroup_size(1)
fn main() {
}
4 changes: 2 additions & 2 deletions player/tests/data/quad.wgsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@stage(vertex)
@vertex
fn vs_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4<f32> {
// hacky way to draw a large triangle
let tmp1 = i32(vertex_index) / 2;
Expand All @@ -10,7 +10,7 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4<
return vec4<f32>(pos, 0.0, 1.0);
}

@stage(fragment)
@fragment
fn fs_main() -> @location(0) vec4<f32> {
return vec4<f32>(1.0, 1.0, 1.0, 1.0);
}
2 changes: 1 addition & 1 deletion player/tests/data/zero-init-buffer-for-binding.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@binding(0)
var<storage, read_write> buffer: array<u32>;

@stage(compute)
@compute
@workgroup_size(1)
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
buffer[global_id.x] = buffer[global_id.x] + global_id.x;
Expand Down
2 changes: 1 addition & 1 deletion player/tests/data/zero-init-texture-binding.wgsl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@group(0) @binding(0) var tex: texture_2d<f32>;
@group(0) @binding(1) var tex_storage: texture_storage_2d<rgba8uint, write>;

@stage(compute)
@compute
@workgroup_size(1)
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
}
2 changes: 1 addition & 1 deletion wgpu-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
5 changes: 1 addition & 4 deletions wgpu-core/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions wgpu-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
4 changes: 2 additions & 2 deletions wgpu-hal/examples/halmark/shader.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct VertexOutput {
@location(1) color: vec4<f32>,
};

@stage(vertex)
@vertex
fn vs_main(@builtin(vertex_index) vi: u32) -> VertexOutput {
let tc = vec2<f32>(f32(vi & 1u), 0.5 * f32(vi & 2u));
let offset = vec2<f32>(tc.x * globals.size.x, tc.y * globals.size.y);
Expand All @@ -39,7 +39,7 @@ var texture: texture_2d<f32>;
@binding(2)
var sam: sampler;

@stage(fragment)
@fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
return in.color * textureSampleLevel(texture, sam, in.tex_coords, 0.0);
}
6 changes: 3 additions & 3 deletions wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
2 changes: 1 addition & 1 deletion wgpu/examples/boids/compute.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct SimParams {
@group(0) @binding(2) var<storage, read_write> particlesDst : array<Particle>;

// 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<u32>) {
let total = arrayLength(&particlesSrc);
Expand Down
4 changes: 2 additions & 2 deletions wgpu/examples/boids/draw.wgsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@stage(vertex)
@vertex
fn main_vs(
@location(0) particle_pos: vec2<f32>,
@location(1) particle_vel: vec2<f32>,
Expand All @@ -12,7 +12,7 @@ fn main_vs(
return vec4<f32>(pos + particle_pos, 0.0, 1.0);
}

@stage(fragment)
@fragment
fn main_fs() -> @location(0) vec4<f32> {
return vec4<f32>(1.0, 1.0, 1.0, 1.0);
}
10 changes: 5 additions & 5 deletions wgpu/examples/conservative-raster/triangle_and_lines.wgsl
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
@stage(vertex)
@vertex
fn vs_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4<f32> {
let i: i32 = i32(vertex_index % 3u);
let x: f32 = f32(i - 1) * 0.75;
let y: f32 = f32((i & 1) * 2 - 1) * 0.75 + x * 0.2 + 0.1;
return vec4<f32>(x, y, 0.0, 1.0);
}

@stage(fragment)
@fragment
fn fs_main_red() -> @location(0) vec4<f32> {
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
}

@stage(fragment)
@fragment
fn fs_main_blue() -> @location(0) vec4<f32> {
return vec4<f32>(0.13, 0.31, 0.85, 1.0); // cornflower blue in linear space
}

@stage(fragment)
@fragment
fn fs_main_white() -> @location(0) vec4<f32> {
return vec4<f32>(1.0, 1.0, 1.0, 1.0);
}
}
4 changes: 2 additions & 2 deletions wgpu/examples/conservative-raster/upscale.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ struct VertexOutput {
@location(0) tex_coords: vec2<f32>,
};

@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;
Expand All @@ -20,7 +20,7 @@ var r_color: texture_2d<f32>;
@binding(1)
var r_sampler: sampler;

@stage(fragment)
@fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
return textureSample(r_color, r_sampler, in.tex_coords);
}
6 changes: 3 additions & 3 deletions wgpu/examples/cube/shader.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct Locals {
@binding(0)
var<uniform> r_locals: Locals;

@stage(vertex)
@vertex
fn vs_main(
@location(0) position: vec4<f32>,
@location(1) tex_coord: vec2<f32>,
Expand All @@ -25,14 +25,14 @@ fn vs_main(
@binding(1)
var r_color: texture_2d<u32>;

@stage(fragment)
@fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
let tex = textureLoad(r_color, vec2<i32>(in.tex_coord * 256.0), 0);
let v = f32(tex.x) / 255.0;
return vec4<f32>(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<f32> {
return vec4<f32>(0.0, 0.5, 0.0, 0.5);
}
2 changes: 1 addition & 1 deletion wgpu/examples/hello-compute/shader.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -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<u32>) {
v_indices[global_id.x] = collatz_iterations(v_indices[global_id.x]);
Expand Down
4 changes: 2 additions & 2 deletions wgpu/examples/hello-triangle/shader.wgsl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@stage(vertex)
@vertex
fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) vec4<f32> {
let x = f32(i32(in_vertex_index) - 1);
let y = f32(i32(in_vertex_index & 1u) * 2 - 1);
return vec4<f32>(x, y, 0.0, 1.0);
}

@stage(fragment)
@fragment
fn fs_main() -> @location(0) vec4<f32> {
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
}
4 changes: 2 additions & 2 deletions wgpu/examples/mipmap/blit.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ struct VertexOutput {
@location(0) tex_coords: vec2<f32>,
};

@stage(vertex)
@vertex
fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput {
var out: VertexOutput;
let x = i32(vertex_index) / 2;
Expand All @@ -28,7 +28,7 @@ var r_color: texture_2d<f32>;
@binding(1)
var r_sampler: sampler;

@stage(fragment)
@fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
return textureSample(r_color, r_sampler, in.tex_coords);
}
4 changes: 2 additions & 2 deletions wgpu/examples/mipmap/draw.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct Locals {
@binding(0)
var<uniform> r_data: Locals;

@stage(vertex)
@vertex
fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput {
let pos = vec2<f32>(
100.0 * (1.0 - f32(vertex_index & 2u)),
Expand All @@ -29,7 +29,7 @@ var r_color: texture_2d<f32>;
@binding(2)
var r_sampler: sampler;

@stage(fragment)
@fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
return textureSample(r_color, r_sampler, in.tex_coords);
}
4 changes: 2 additions & 2 deletions wgpu/examples/msaa-line/shader.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ struct VertexOutput {
@builtin(position) position: vec4<f32>,
};

@stage(vertex)
@vertex
fn vs_main(
@location(0) position: vec2<f32>,
@location(1) color: vec4<f32>,
Expand All @@ -14,7 +14,7 @@ fn vs_main(
return out;
}

@stage(fragment)
@fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
return in.color;
}
8 changes: 4 additions & 4 deletions wgpu/examples/shadow/shader.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct Entity {
@binding(0)
var<uniform> u_entity: Entity;

@stage(vertex)
@vertex
fn vs_bake(@location(0) position: vec4<i32>) -> @builtin(position) vec4<f32> {
return u_globals.view_proj * u_entity.world * vec4<f32>(position);
}
Expand All @@ -27,7 +27,7 @@ struct VertexOutput {
@location(1) world_position: vec4<f32>
};

@stage(vertex)
@vertex
fn vs_main(
@location(0) position: vec4<i32>,
@location(1) normal: vec4<i32>,
Expand Down Expand Up @@ -78,7 +78,7 @@ fn fetch_shadow(light_id: u32, homogeneous_coords: vec4<f32>) -> f32 {
let c_ambient: vec3<f32> = vec3<f32>(0.05, 0.05, 0.05);
let c_max_lights: u32 = 10u;

@stage(fragment)
@fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
let normal = normalize(in.world_normal);
// accumulate color
Expand All @@ -98,7 +98,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
}

// 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<f32> {
let normal = normalize(in.world_normal);
var color: vec3<f32> = c_ambient;
Expand Down
8 changes: 4 additions & 4 deletions wgpu/examples/skybox/shader.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct Data {
@binding(0)
var<uniform> 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;
Expand Down Expand Up @@ -45,7 +45,7 @@ struct EntityOutput {
@location(3) view: vec3<f32>,
};

@stage(vertex)
@vertex
fn vs_entity(
@location(0) pos: vec3<f32>,
@location(1) normal: vec3<f32>,
Expand All @@ -64,12 +64,12 @@ var r_texture: texture_cube<f32>;
@binding(2)
var r_sampler: sampler;

@stage(fragment)
@fragment
fn fs_sky(in: SkyOutput) -> @location(0) vec4<f32> {
return textureSample(r_texture, r_sampler, in.uv);
}

@stage(fragment)
@fragment
fn fs_entity(in: EntityOutput) -> @location(0) vec4<f32> {
let incident = normalize(in.view);
let normal = normalize(in.normal);
Expand Down
Loading

0 comments on commit 9743068

Please sign in to comment.