mirror of
https://github.com/bevyengine/bevy
synced 2024-12-20 01:53:12 +00:00
d221665386
# Objective - Fixes #16078 ## Solution - Rename things to clarify that we _want_ unclipped depth for directional light shadow views, and need some way of disabling the GPU's builtin depth clipping - Use DEPTH_CLIP_CONTROL instead of the fragment shader emulation on supported platforms - Pass only the clip position depth instead of the whole clip position between vertex->fragment shader (no idea if this helps performance or not, compiler might optimize it anyways) - Meshlets - HW raster always uses DEPTH_CLIP_CONTROL since it targets a more limited set of platforms - SW raster was not handling DEPTH_CLAMP_ORTHO correctly, it ended up pretty much doing nothing. - This PR made me realize that SW raster technically should have depth clipping for all views that are not directional light shadows, but I decided not to bother writing it. I'm not sure that it ever matters in practice. If proven otherwise, I can add it. ## Testing - Did you test these changes? If so, how? - Lighting example. Both opaque (no fragment shader) and alpha masked geometry (fragment shader emulation) are working with depth_clip_control, and both work when it's turned off. Also tested meshlet example. - Are there any parts that need more testing? - Performance. I can't figure out a good test scene. - How can other people (reviewers) test your changes? Is there anything specific they need to know? - Toggle depth_clip_control_supported in prepass/mod.rs line 323 to turn this PR on or off. - If relevant, what platforms did you test these changes on, and are there any important ones you can't test? - Native --- ## Migration Guide - `MeshPipelineKey::DEPTH_CLAMP_ORTHO` is now `MeshPipelineKey::UNCLIPPED_DEPTH_ORTHO` - The `DEPTH_CLAMP_ORTHO` shaderdef has been renamed to `UNCLIPPED_DEPTH_ORTHO_EMULATION` - `clip_position_unclamped: vec4<f32>` is now `unclipped_depth: f32` |
||
---|---|---|
.. | ||
clustered_forward.wgsl | ||
fog.rs | ||
fog.wgsl | ||
forward_io.wgsl | ||
gpu_preprocess.rs | ||
light.rs | ||
mesh.rs | ||
mesh.wgsl | ||
mesh_bindings.rs | ||
mesh_bindings.wgsl | ||
mesh_functions.wgsl | ||
mesh_preprocess.wgsl | ||
mesh_types.wgsl | ||
mesh_view_bindings.rs | ||
mesh_view_bindings.wgsl | ||
mesh_view_types.wgsl | ||
mod.rs | ||
morph.rs | ||
morph.wgsl | ||
parallax_mapping.wgsl | ||
pbr.wgsl | ||
pbr_ambient.wgsl | ||
pbr_bindings.wgsl | ||
pbr_fragment.wgsl | ||
pbr_functions.wgsl | ||
pbr_lighting.wgsl | ||
pbr_prepass.wgsl | ||
pbr_prepass_functions.wgsl | ||
pbr_transmission.wgsl | ||
pbr_types.wgsl | ||
rgb9e5.wgsl | ||
shadow_sampling.wgsl | ||
shadows.wgsl | ||
skin.rs | ||
skinning.wgsl | ||
utils.wgsl | ||
view_transformations.wgsl | ||
wireframe.wgsl |