From cd594221cf528dc6cdea234002679b73098ef42a Mon Sep 17 00:00:00 2001 From: robtfm <50659922+robtfm@users.noreply.github.com> Date: Sat, 4 Nov 2023 02:02:49 +0000 Subject: [PATCH] gate depth reads on !WEBGL2 (#10365) # Objective fix #10364 ## Solution gate depth prepass reads in pbr_transmission.wgsl by `#ifndef WEBGL2` --- crates/bevy_pbr/src/render/pbr_transmission.wgsl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/bevy_pbr/src/render/pbr_transmission.wgsl b/crates/bevy_pbr/src/render/pbr_transmission.wgsl index 61720ba93e..14b1e67d0d 100644 --- a/crates/bevy_pbr/src/render/pbr_transmission.wgsl +++ b/crates/bevy_pbr/src/render/pbr_transmission.wgsl @@ -60,11 +60,13 @@ fn fetch_transmissive_background_non_rough(offset_position: vec2, frag_coor ); #ifdef DEPTH_PREPASS +#ifndef WEBGL2 // Use depth prepass data to reject values that are in front of the current fragment if prepass_utils::prepass_depth(vec4(offset_position * view_bindings::view.viewport.zw, 0.0, 0.0), 0u) > frag_coord.z { background_color.a = 0.0; } #endif +#endif #ifdef TONEMAP_IN_SHADER background_color = approximate_inverse_tone_mapping(background_color, view_bindings::view.color_grading); @@ -157,10 +159,12 @@ fn fetch_transmissive_background(offset_position: vec2, frag_coord: vec3(modified_offset_position * view_bindings::view.viewport.zw, 0.0, 0.0), 0u) > frag_coord.z { sample = vec4(0.0); } +#endif #endif // As blur intensity grows higher, gradually limit *very bright* color RGB values towards a