Skip to content

Commit

Permalink
bevy_render2/bevy_pbr2: Update to wgpu 0.9 / naga 0.5 (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
superdump authored and cart committed Jul 24, 2021
1 parent 3f70f92 commit 7c57725
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pipelined/bevy_pbr2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
7 changes: 6 additions & 1 deletion pipelined/bevy_pbr2/src/render/pbr.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,12 @@ fn fetch_shadow(light_id: i32, homogeneous_coords: vec4<f32>) -> f32 {
// compute texture coordinates for shadow lookup
let light_local = homogeneous_coords.xy * flip_correction * proj_correction + vec2<f32>(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 {
Expand Down
2 changes: 1 addition & 1 deletion pipelined/bevy_render2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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:/gfx-rs/naga", rev = "0cf5484bba530f1134badbd2a1c1a8e9daf2e9c3", features = ["glsl-in", "spv-out", "spv-in", "wgsl-in"] }
serde = { version = "1", features = ["derive"] }
bitflags = "1.2.1"
Expand Down

0 comments on commit 7c57725

Please sign in to comment.