From 9e2930b412bc35105d55399379f21bad014e8f4c Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Tue, 25 Jul 2023 16:41:49 -0400 Subject: [PATCH 1/8] wgpu 0.17 --- crates/bevy_pbr/Cargo.toml | 3 ++- crates/bevy_pbr/src/ssao/gtao.wgsl | 10 +--------- crates/bevy_pbr/src/ssao/spatial_denoise.wgsl | 18 +++++------------- crates/bevy_render/Cargo.toml | 7 ++++--- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/crates/bevy_pbr/Cargo.toml b/crates/bevy_pbr/Cargo.toml index f35774f038cb8..4f266856158cd 100644 --- a/crates/bevy_pbr/Cargo.toml +++ b/crates/bevy_pbr/Cargo.toml @@ -30,7 +30,8 @@ bitflags = "2.3" fixedbitset = "0.4" # direct dependency required for derive macro bytemuck = { version = "1", features = ["derive"] } -naga_oil = "0.8" radsort = "0.1" +# naga_oil = "0.8" +naga_oil = { git = "https://github.com/VitalyAnkh/naga_oil.git", branch = "update-naga-to-0.13" } smallvec = "1.6" thread_local = "1.0" diff --git a/crates/bevy_pbr/src/ssao/gtao.wgsl b/crates/bevy_pbr/src/ssao/gtao.wgsl index 67c9307663b4b..67f140a98866f 100644 --- a/crates/bevy_pbr/src/ssao/gtao.wgsl +++ b/crates/bevy_pbr/src/ssao/gtao.wgsl @@ -53,20 +53,12 @@ fn calculate_neighboring_depth_differences(pixel_coordinates: vec2) -> f32 edge_info = saturate((1.0 + bias) - edge_info / scale); // Apply the bias and scale, and invert edge_info so that small values become large, and vice versa // Pack the edge info into the texture - let edge_info_packed = vec4(mypack4x8unorm(edge_info), 0u, 0u, 0u); + let edge_info_packed = vec4(pack4x8unorm(edge_info), 0u, 0u, 0u); textureStore(depth_differences, pixel_coordinates, edge_info_packed); return depth_center; } -// TODO: Remove this once https://github.com/gfx-rs/naga/pull/2353 lands -fn mypack4x8unorm(e: vec4) -> u32 { - return u32(clamp(e.x, 0.0, 1.0) * 255.0 + 0.5) | - u32(clamp(e.y, 0.0, 1.0) * 255.0 + 0.5) << 8u | - u32(clamp(e.z, 0.0, 1.0) * 255.0 + 0.5) << 16u | - u32(clamp(e.w, 0.0, 1.0) * 255.0 + 0.5) << 24u; -} - fn load_normal_view_space(uv: vec2) -> vec3 { var world_normal = textureSampleLevel(normals, point_clamp_sampler, uv, 0.0).xyz; world_normal = (world_normal * 2.0) - 1.0; diff --git a/crates/bevy_pbr/src/ssao/spatial_denoise.wgsl b/crates/bevy_pbr/src/ssao/spatial_denoise.wgsl index 22cf2e31b6cdb..4cfe4cd350871 100644 --- a/crates/bevy_pbr/src/ssao/spatial_denoise.wgsl +++ b/crates/bevy_pbr/src/ssao/spatial_denoise.wgsl @@ -31,11 +31,11 @@ fn spatial_denoise(@builtin(global_invocation_id) global_id: vec3) { let visibility2 = textureGather(0, ambient_occlusion_noisy, point_clamp_sampler, uv, vec2(0i, 2i)); let visibility3 = textureGather(0, ambient_occlusion_noisy, point_clamp_sampler, uv, vec2(2i, 2i)); - let left_edges = myunpack4x8unorm(edges0.x); - let right_edges = myunpack4x8unorm(edges1.x); - let top_edges = myunpack4x8unorm(edges0.z); - let bottom_edges = myunpack4x8unorm(edges2.w); - var center_edges = myunpack4x8unorm(edges0.y); + let left_edges = unpack4x8unorm(edges0.x); + let right_edges = unpack4x8unorm(edges1.x); + let top_edges = unpack4x8unorm(edges0.z); + let bottom_edges = unpack4x8unorm(edges2.w); + var center_edges = unpack4x8unorm(edges0.y); center_edges *= vec4(left_edges.y, right_edges.x, top_edges.w, bottom_edges.z); let center_weight = 1.2; @@ -82,11 +82,3 @@ fn spatial_denoise(@builtin(global_invocation_id) global_id: vec3) { textureStore(ambient_occlusion, pixel_coordinates, vec4(denoised_visibility, 0.0, 0.0, 0.0)); } - -// TODO: Remove this once https://github.com/gfx-rs/naga/pull/2353 lands in Bevy -fn myunpack4x8unorm(e: u32) -> vec4 { - return vec4(clamp(f32(e & 0xFFu) / 255.0, 0.0, 1.0), - clamp(f32((e >> 8u) & 0xFFu) / 255.0, 0.0, 1.0), - clamp(f32((e >> 16u) & 0xFFu) / 255.0, 0.0, 1.0), - clamp(f32((e >> 24u) & 0xFFu) / 255.0, 0.0, 1.0)); -} diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml index 3764318ea6224..58fc84c7494eb 100644 --- a/crates/bevy_render/Cargo.toml +++ b/crates/bevy_render/Cargo.toml @@ -57,9 +57,9 @@ bevy_tasks = { path = "../bevy_tasks", version = "0.12.0-dev" } image = { version = "0.24", default-features = false } # misc -wgpu = { version = "0.16.0", features=["naga"] } +wgpu = { version = "0.17.0", features=["naga"] } codespan-reporting = "0.11.0" -naga = { version = "0.12.0", features = ["wgsl-in"] } +naga = { version = "0.13.0", features = ["wgsl-in"] } serde = { version = "1", features = ["derive"] } bitflags = "2.3" bytemuck = { version = "1.5", features = ["derive"] } @@ -71,7 +71,8 @@ futures-lite = "1.4.0" hexasphere = "9.0" ddsfile = { version = "0.5.0", optional = true } ktx2 = { version = "0.3.0", optional = true } -naga_oil = "0.8" +# naga_oil = "0.8" +naga_oil = { git = "https://github.com/VitalyAnkh/naga_oil.git", branch = "update-naga-to-0.13" } # For ktx2 supercompression flate2 = { version = "1.0.22", optional = true } ruzstd = { version = "0.4.0", optional = true } From 926d37badea7e98c9844825d4906011374c61ccf Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Sat, 29 Jul 2023 16:47:29 -0400 Subject: [PATCH 2/8] robtfm naga_oil branch --- crates/bevy_pbr/Cargo.toml | 2 +- crates/bevy_render/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_pbr/Cargo.toml b/crates/bevy_pbr/Cargo.toml index 4f266856158cd..65d0cb40a0cc4 100644 --- a/crates/bevy_pbr/Cargo.toml +++ b/crates/bevy_pbr/Cargo.toml @@ -32,6 +32,6 @@ fixedbitset = "0.4" bytemuck = { version = "1", features = ["derive"] } radsort = "0.1" # naga_oil = "0.8" -naga_oil = { git = "https://github.com/VitalyAnkh/naga_oil.git", branch = "update-naga-to-0.13" } +naga_oil = { git = "https://github.com/robtfm/naga_oil.git", branch = "0.13" } smallvec = "1.6" thread_local = "1.0" diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml index 58fc84c7494eb..3671324867143 100644 --- a/crates/bevy_render/Cargo.toml +++ b/crates/bevy_render/Cargo.toml @@ -72,7 +72,7 @@ hexasphere = "9.0" ddsfile = { version = "0.5.0", optional = true } ktx2 = { version = "0.3.0", optional = true } # naga_oil = "0.8" -naga_oil = { git = "https://github.com/VitalyAnkh/naga_oil.git", branch = "update-naga-to-0.13" } +naga_oil = { git = "https://github.com/robtfm/naga_oil.git", branch = "0.13" } # For ktx2 supercompression flate2 = { version = "1.0.22", optional = true } ruzstd = { version = "0.4.0", optional = true } From ab8d1b2773f3861fdceeb8eb7e3237489481b787 Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Sat, 29 Jul 2023 21:47:10 -0400 Subject: [PATCH 3/8] make wasm work for now --- crates/bevy_render/Cargo.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml index 3671324867143..4c8afd566185d 100644 --- a/crates/bevy_render/Cargo.toml +++ b/crates/bevy_render/Cargo.toml @@ -57,7 +57,9 @@ bevy_tasks = { path = "../bevy_tasks", version = "0.12.0-dev" } image = { version = "0.24", default-features = false } # misc -wgpu = { version = "0.17.0", features=["naga"] } +# `fragile-send-sync-non-atomic-wasm` feature means we can't use WASM threads for rendering +# It is enabled for now to avoid having to do a significant overhaul of the renderer just for wasm +wgpu = { version = "0.17.0", features=["naga", "fragile-send-sync-non-atomic-wasm"] } codespan-reporting = "0.11.0" naga = { version = "0.13.0", features = ["wgsl-in"] } serde = { version = "1", features = ["derive"] } From 819de1112afe8dac52a9937468995c84e4fe3e15 Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Sat, 19 Aug 2023 14:45:06 -0400 Subject: [PATCH 4/8] nits --- crates/bevy_render/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml index 4c8afd566185d..6c8b623824ed9 100644 --- a/crates/bevy_render/Cargo.toml +++ b/crates/bevy_render/Cargo.toml @@ -59,9 +59,11 @@ image = { version = "0.24", default-features = false } # misc # `fragile-send-sync-non-atomic-wasm` feature means we can't use WASM threads for rendering # It is enabled for now to avoid having to do a significant overhaul of the renderer just for wasm -wgpu = { version = "0.17.0", features=["naga", "fragile-send-sync-non-atomic-wasm"] } +wgpu = { version = "0.17.0", features = ["naga", "fragile-send-sync-non-atomic-wasm"] } codespan-reporting = "0.11.0" naga = { version = "0.13.0", features = ["wgsl-in"] } +# naga_oil = "0.8" +naga_oil = { git = "https://github.com/robtfm/naga_oil.git", branch = "0.13" } serde = { version = "1", features = ["derive"] } bitflags = "2.3" bytemuck = { version = "1.5", features = ["derive"] } @@ -73,8 +75,6 @@ futures-lite = "1.4.0" hexasphere = "9.0" ddsfile = { version = "0.5.0", optional = true } ktx2 = { version = "0.3.0", optional = true } -# naga_oil = "0.8" -naga_oil = { git = "https://github.com/robtfm/naga_oil.git", branch = "0.13" } # For ktx2 supercompression flate2 = { version = "1.0.22", optional = true } ruzstd = { version = "0.4.0", optional = true } From e0c8d5c71ab8d10eb65bf372fd47c3dcd999a1cb Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Sat, 26 Aug 2023 22:58:04 -0400 Subject: [PATCH 5/8] naga_oil release --- crates/bevy_pbr/Cargo.toml | 3 +-- crates/bevy_render/Cargo.toml | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/bevy_pbr/Cargo.toml b/crates/bevy_pbr/Cargo.toml index 65d0cb40a0cc4..c60174651dd41 100644 --- a/crates/bevy_pbr/Cargo.toml +++ b/crates/bevy_pbr/Cargo.toml @@ -31,7 +31,6 @@ fixedbitset = "0.4" # direct dependency required for derive macro bytemuck = { version = "1", features = ["derive"] } radsort = "0.1" -# naga_oil = "0.8" -naga_oil = { git = "https://github.com/robtfm/naga_oil.git", branch = "0.13" } +naga_oil = "0.9" smallvec = "1.6" thread_local = "1.0" diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml index 6c8b623824ed9..925f4d2c9bf38 100644 --- a/crates/bevy_render/Cargo.toml +++ b/crates/bevy_render/Cargo.toml @@ -57,13 +57,12 @@ bevy_tasks = { path = "../bevy_tasks", version = "0.12.0-dev" } image = { version = "0.24", default-features = false } # misc +codespan-reporting = "0.11.0" # `fragile-send-sync-non-atomic-wasm` feature means we can't use WASM threads for rendering # It is enabled for now to avoid having to do a significant overhaul of the renderer just for wasm wgpu = { version = "0.17.0", features = ["naga", "fragile-send-sync-non-atomic-wasm"] } -codespan-reporting = "0.11.0" naga = { version = "0.13.0", features = ["wgsl-in"] } -# naga_oil = "0.8" -naga_oil = { git = "https://github.com/robtfm/naga_oil.git", branch = "0.13" } +naga_oil = "0.9" serde = { version = "1", features = ["derive"] } bitflags = "2.3" bytemuck = { version = "1.5", features = ["derive"] } From b3f91cbe885dcdd5519bef832f480a364dd31eb8 Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Wed, 27 Sep 2023 15:12:21 -0400 Subject: [PATCH 6/8] wgpu 0.17.1 as minimum --- crates/bevy_render/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml index 925f4d2c9bf38..28622d0f8ada5 100644 --- a/crates/bevy_render/Cargo.toml +++ b/crates/bevy_render/Cargo.toml @@ -60,7 +60,7 @@ image = { version = "0.24", default-features = false } codespan-reporting = "0.11.0" # `fragile-send-sync-non-atomic-wasm` feature means we can't use WASM threads for rendering # It is enabled for now to avoid having to do a significant overhaul of the renderer just for wasm -wgpu = { version = "0.17.0", features = ["naga", "fragile-send-sync-non-atomic-wasm"] } +wgpu = { version = "0.17.1", features = ["naga", "fragile-send-sync-non-atomic-wasm"] } naga = { version = "0.13.0", features = ["wgsl-in"] } naga_oil = "0.9" serde = { version = "1", features = ["derive"] } From 3b946a65f18e3292114fc266a0b5f50cdabb0117 Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Tue, 3 Oct 2023 20:41:35 -0400 Subject: [PATCH 7/8] don't run the minimising example in CI --- .github/example-run/minimising.ron | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .github/example-run/minimising.ron diff --git a/.github/example-run/minimising.ron b/.github/example-run/minimising.ron deleted file mode 100644 index e8577916525db..0000000000000 --- a/.github/example-run/minimising.ron +++ /dev/null @@ -1,3 +0,0 @@ -( - exit_after: Some(90) -) From 4a1e206ecb94e7ddef8fab5c27a5d449391755ff Mon Sep 17 00:00:00 2001 From: Elabajaba Date: Mon, 9 Oct 2023 15:52:40 -0400 Subject: [PATCH 8/8] disable resizing example in ci for now --- .github/example-run/resizing.ron | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 .github/example-run/resizing.ron diff --git a/.github/example-run/resizing.ron b/.github/example-run/resizing.ron deleted file mode 100644 index f4914e281bcd6..0000000000000 --- a/.github/example-run/resizing.ron +++ /dev/null @@ -1,4 +0,0 @@ -( - // Ensures that the full cycle will run - exit_after: Some(410) -)