mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
gate depth reads on !WEBGL2 (#10365)
# Objective fix #10364 ## Solution gate depth prepass reads in pbr_transmission.wgsl by `#ifndef WEBGL2`
This commit is contained in:
parent
1e35a06e29
commit
cd594221cf
1 changed files with 4 additions and 0 deletions
|
@ -60,11 +60,13 @@ fn fetch_transmissive_background_non_rough(offset_position: vec2<f32>, frag_coor
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef DEPTH_PREPASS
|
#ifdef DEPTH_PREPASS
|
||||||
|
#ifndef WEBGL2
|
||||||
// Use depth prepass data to reject values that are in front of the current fragment
|
// 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 {
|
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;
|
background_color.a = 0.0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef TONEMAP_IN_SHADER
|
#ifdef TONEMAP_IN_SHADER
|
||||||
background_color = approximate_inverse_tone_mapping(background_color, view_bindings::view.color_grading);
|
background_color = approximate_inverse_tone_mapping(background_color, view_bindings::view.color_grading);
|
||||||
|
@ -157,10 +159,12 @@ fn fetch_transmissive_background(offset_position: vec2<f32>, frag_coord: vec3<f3
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef DEPTH_PREPASS
|
#ifdef DEPTH_PREPASS
|
||||||
|
#ifndef WEBGL2
|
||||||
// Use depth prepass data to reject values that are in front of the current fragment
|
// 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 {
|
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);
|
sample = vec4<f32>(0.0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// As blur intensity grows higher, gradually limit *very bright* color RGB values towards a
|
// As blur intensity grows higher, gradually limit *very bright* color RGB values towards a
|
||||||
|
|
Loading…
Reference in a new issue