mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Update to Naga rev 1720725
This commit is contained in:
parent
759e7ff8c5
commit
eff50436f5
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -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",
|
||||
|
||||
@ -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]);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
@stage(compute)
|
||||
@compute
|
||||
@workgroup_size(1)
|
||||
fn main() {
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -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,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;
|
||||
|
||||
@ -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>) {
|
||||
}
|
||||
|
||||
@ -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"]
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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"]
|
||||
|
||||
|
||||
@ -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);
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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"]
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
@stage(vertex)
|
||||
@vertex
|
||||
fn main_vs(
|
||||
@location(0) particle_pos: vec2<f32>,
|
||||
@location(1) particle_vel: vec2<f32>,
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
@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;
|
||||
@ -6,17 +6,17 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4<
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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>,
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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]);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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)),
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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>,
|
||||
@ -14,7 +14,7 @@ fn vs_main(
|
||||
return out;
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
@fragment
|
||||
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
return in.color;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
@ -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>,
|
||||
@ -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
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
@ -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>,
|
||||
@ -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);
|
||||
|
||||
@ -18,7 +18,7 @@ struct VertexOutput {
|
||||
@location(1) clip_dist: f32,
|
||||
};
|
||||
|
||||
@stage(vertex)
|
||||
@vertex
|
||||
fn vs_main(
|
||||
@location(0) position: vec3<f32>,
|
||||
@location(1) normal: vec3<f32>,
|
||||
@ -36,7 +36,7 @@ fn vs_main(
|
||||
return out;
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
@fragment
|
||||
@early_depth_test
|
||||
fn fs_main(
|
||||
in: VertexOutput,
|
||||
|
||||
@ -187,7 +187,7 @@ struct VertexOutput {
|
||||
@location(2) f_Light: vec3<f32>,
|
||||
};
|
||||
|
||||
@stage(vertex)
|
||||
@vertex
|
||||
fn vs_main(
|
||||
@location(0) position: vec2<i32>,
|
||||
@location(1) offsets: vec4<i32>,
|
||||
@ -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<f32> {
|
||||
let reflection_colour = textureSample(reflection, colour_sampler, in.f_WaterScreenPos.xy).xyz;
|
||||
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
@group(0) @binding(0)
|
||||
var<storage, read_write> indices: array<u32>; // 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<f32> {
|
||||
let idx = instance * 3u + index;
|
||||
indices[idx] = idx;
|
||||
return vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
@fragment
|
||||
fn fs_main() -> @location(0) vec4<f32> {
|
||||
return vec4<f32>(0.0);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user