Skip to content

Commit

Permalink
Update to latest wgpu-core (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
almarklein authored Apr 6, 2022
1 parent 41a0f84 commit 0ff888a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 32 deletions.
38 changes: 22 additions & 16 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ default = []
[dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "ec1d022"
rev = "988990c"
# path = "../wgpu/wgpu-core"
#version = "0.11"
features = ["raw-window-handle", "trace"]

[dependencies.wgt]
package = "wgpu-types"
git = "https://github.com/gfx-rs/wgpu"
rev = "ec1d022"
rev = "988990c"
# path = "../wgpu/wgpu-types"
#version = "0.11"

Expand All @@ -46,7 +46,7 @@ thiserror = "1"

[dependencies.naga]
git = "https://github.com/gfx-rs/naga"
rev = "8ffd6ba"
rev = "f90e563"
features = ["spv-in"]

[build-dependencies]
Expand Down
16 changes: 7 additions & 9 deletions examples/compute/shader.wgsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
struct PrimeIndices {
data: [[stride(4)]] array<u32>;
}; // this is used as both input and output for convenience

[[group(0), binding(0)]]
var<storage, read_write> v_indices: PrimeIndices;
@group(0)
@binding(0)
var<storage, read_write> v_indices: array<u32>; // this is used as both input and output for convenience

// The Collatz Conjecture states that for any integer n:
// If n is even, n = n/2
Expand Down Expand Up @@ -34,7 +31,8 @@ fn collatz_iterations(n_base: u32) -> u32{
return i;
}

[[stage(compute), workgroup_size(1)]]
fn main([[builtin(global_invocation_id)]] global_id: vec3<u32>) {
v_indices.data[global_id.x] = collatz_iterations(v_indices.data[global_id.x]);
@stage(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]);
}
8 changes: 4 additions & 4 deletions examples/triangle/shader.wgsl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[[stage(vertex)]]
fn vs_main([[builtin(vertex_index)]] in_vertex_index: u32) -> [[builtin(position)]] vec4<f32> {
@stage(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)]]
fn fs_main() -> [[location(0)]] vec4<f32> {
@stage(fragment)
fn fs_main() -> @location(0) vec4<f32> {
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
}

0 comments on commit 0ff888a

Please sign in to comment.