diff --git a/pipelined/bevy_pbr2/Cargo.toml b/pipelined/bevy_pbr2/Cargo.toml index e59352a998a6f..613b36a298b2e 100644 --- a/pipelined/bevy_pbr2/Cargo.toml +++ b/pipelined/bevy_pbr2/Cargo.toml @@ -29,4 +29,4 @@ bitflags = "1.2" # direct dependency required for derive macro bytemuck = { version = "1", features = ["derive"] } crevice = { path = "../../crates/crevice" } -wgpu = "0.8" +wgpu = "0.9" diff --git a/pipelined/bevy_pbr2/src/render/pbr.wgsl b/pipelined/bevy_pbr2/src/render/pbr.wgsl index ac76008202837..5c5a34da085e4 100644 --- a/pipelined/bevy_pbr2/src/render/pbr.wgsl +++ b/pipelined/bevy_pbr2/src/render/pbr.wgsl @@ -356,7 +356,12 @@ fn fetch_shadow(light_id: i32, homogeneous_coords: vec4) -> f32 { // compute texture coordinates for shadow lookup let light_local = homogeneous_coords.xy * flip_correction * proj_correction + vec2(0.5, 0.5); // do the lookup, using HW PCF and comparison - return textureSampleCompare(shadow_textures, shadow_textures_sampler, light_local, i32(light_id), homogeneous_coords.z * proj_correction); + // NOTE: Due to the non-uniform control flow above, we must use the Level variant of + // textureSampleCompare to avoid undefined behaviour due to some of the fragments in + // a quad (2x2 fragments) being processed not being sampled, and this messing with + // mip-mapping functionality. The shadow maps have no mipmaps so Level just samples + // from LOD 0. + return textureSampleCompareLevel(shadow_textures, shadow_textures_sampler, light_local, i32(light_id), homogeneous_coords.z * proj_correction); } struct FragmentInput { diff --git a/pipelined/bevy_render2/Cargo.toml b/pipelined/bevy_render2/Cargo.toml index b8366c3100701..00d17d27c945f 100644 --- a/pipelined/bevy_render2/Cargo.toml +++ b/pipelined/bevy_render2/Cargo.toml @@ -29,7 +29,7 @@ bevy_utils = { path = "../../crates/bevy_utils", version = "0.5.0" } image = { version = "0.23.12", default-features = false } # misc -wgpu = "0.8" +wgpu = "0.9" naga = { git = "https://github.com/gfx-rs/naga", rev = "0cf5484bba530f1134badbd2a1c1a8e9daf2e9c3", features = ["glsl-in", "spv-out", "spv-in", "wgsl-in"] } serde = { version = "1", features = ["derive"] } bitflags = "1.2.1"