Skip to content

Commit

Permalink
Update wgpu to 0.17
Browse files Browse the repository at this point in the history
  • Loading branch information
redwarp committed Sep 24, 2023
1 parent 91ace1e commit 5fecfb4
Show file tree
Hide file tree
Showing 18 changed files with 101 additions and 94 deletions.
101 changes: 55 additions & 46 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 core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description = "Calculates the average colors in an image for color quantization

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
wgpu = "0.15"
wgpu = "0.17"
bytemuck = { version = "1.14", features = ["derive", "extern_crate_alloc"] }
anyhow = "1.0"
palette = "0.7"
Expand Down
11 changes: 5 additions & 6 deletions core/shaders/choose_centroid.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ const FLAG_NOT_READY = 0u;
const FLAG_AGGREGATE_READY = 1u;
const FLAG_PREFIX_READY = 2u;

fn coords(global_x: u32, dimensions: vec2<i32>) -> vec2<i32> {
return vec2<i32>(vec2<u32>(global_x % u32(dimensions.x), global_x / u32(dimensions.x)));
fn coords(global_x: u32, dimensions: vec2<u32>) -> vec2<u32> {
return vec2<u32>(global_x % dimensions.x, global_x / dimensions.x);
}

fn last_group_idx() -> u32 {
return arrayLength(&flag_buffer) - 1u;
}

fn in_bounds(global_x: u32, dimensions: vec2<i32>) -> bool {
return global_x < u32(dimensions.x) * u32(dimensions.y);
fn in_bounds(global_x: u32, dimensions: vec2<u32>) -> bool {
return global_x < dimensions.x * dimensions.y;
}

fn matches_centroid(k: u32, coords: vec2<i32>) -> bool {
fn matches_centroid(k: u32, coords: vec2<u32>) -> bool {
return k == textureLoad(color_indices, coords, 0).r;
}

Expand Down Expand Up @@ -180,7 +180,6 @@ fn main(
@compute
@workgroup_size(1)
fn pick() {
let dimensions = textureDimensions(pixels);
let sum = atomicLoadAggregator(last_group_idx() * 8u + 0u);
let k = k_index;
if(sum.count > 0u) {
Expand Down
2 changes: 1 addition & 1 deletion core/shaders/converters/lab_to_rgb.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fn main(
@builtin(global_invocation_id) global_id : vec3<u32>,
) {
let dimensions = textureDimensions(output_texture);
let coords = vec2<i32>(global_id.xy);
let coords = global_id.xy;

if(coords.x >= dimensions.x || coords.y >= dimensions.y) {
return;
Expand Down
2 changes: 1 addition & 1 deletion core/shaders/converters/rgb32f_to_rgb8u.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn main(
@builtin(global_invocation_id) global_id : vec3<u32>,
) {
let dimensions = textureDimensions(output_texture);
let coords = vec2<i32>(global_id.xy);
let coords = global_id.xy;

if(coords.x >= dimensions.x || coords.y >= dimensions.y) {
return;
Expand Down
2 changes: 1 addition & 1 deletion core/shaders/converters/rgb8u_to_rgb32f.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn main(
@builtin(global_invocation_id) global_id : vec3<u32>,
) {
let dimensions = textureDimensions(output_texture);
let coords = vec2<i32>(global_id.xy);
let coords = global_id.xy;

if(coords.x >= dimensions.x || coords.y >= dimensions.y) {
return;
Expand Down
2 changes: 1 addition & 1 deletion core/shaders/converters/rgb_to_lab.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn main(
@builtin(global_invocation_id) global_id : vec3<u32>,
) {
let dimensions = textureDimensions(output_texture);
let coords = vec2<i32>(global_id.xy);
let coords = global_id.xy;

if(coords.x >= dimensions.x || coords.y >= dimensions.y) {
return;
Expand Down
2 changes: 1 addition & 1 deletion core/shaders/find_centroid.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn main(
@builtin(global_invocation_id) global_id : vec3<u32>,
) {
let dimensions = textureDimensions(pixels);
let coords = vec2<i32>(global_id.xy);
let coords = global_id.xy;

if(coords.x >= dimensions.x || coords.y >= dimensions.y) {
return;
Expand Down
2 changes: 1 addition & 1 deletion core/shaders/kmeans++_calc_diff.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn main(
@builtin(global_invocation_id) global_id : vec3<u32>,
) {
let dimensions = textureDimensions(pixels);
let coords = vec2<i32>(global_id.xy);
let coords = global_id.xy;

if(coords.x >= dimensions.x || coords.y >= dimensions.y) {
return;
Expand Down
Loading

0 comments on commit 5fecfb4

Please sign in to comment.