Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gate depth reads on !WEBGL2 #10365

Merged
merged 1 commit into from
Nov 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/bevy_pbr/src/render/pbr_transmission.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ fn fetch_transmissive_background_non_rough(offset_position: vec2<f32>, 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<f32>(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);
Expand Down Expand Up @@ -157,10 +159,12 @@ fn fetch_transmissive_background(offset_position: vec2<f32>, frag_coord: vec3<f3
);

#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<f32>(modified_offset_position * view_bindings::view.viewport.zw, 0.0, 0.0), 0u) > frag_coord.z {
sample = vec4<f32>(0.0);
}
#endif
#endif

// As blur intensity grows higher, gradually limit *very bright* color RGB values towards a
Expand Down