bevy/crates/bevy_pbr/src
JMS55 d221665386
Native unclipped depth on supported platforms (#16095)
# 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`
2024-12-03 17:30:14 +00:00
..
cluster Reduce the clusterable object UBO size below 16384 for WebGL 2. (#16069) 2024-10-24 21:00:11 +00:00
deferred Don't reëxport bevy_image from bevy_render (#16163) 2024-11-10 06:54:38 +00:00
light Make PCSS experimental (#16382) 2024-11-14 07:39:26 +00:00
light_probe Don't reëxport bevy_image from bevy_render (#16163) 2024-11-10 06:54:38 +00:00
lightmap Don't reëxport bevy_image from bevy_render (#16163) 2024-11-10 06:54:38 +00:00
meshlet Native unclipped depth on supported platforms (#16095) 2024-12-03 17:30:14 +00:00
prepass Native unclipped depth on supported platforms (#16095) 2024-12-03 17:30:14 +00:00
render Native unclipped depth on supported platforms (#16095) 2024-12-03 17:30:14 +00:00
ssao Expose Pipeline Compilation Zero Initialize Workgroup Memory Option (#16301) 2024-11-08 21:42:37 +00:00
ssr Don't reëxport bevy_image from bevy_render (#16163) 2024-11-10 06:54:38 +00:00
volumetric_fog Don't reëxport bevy_image from bevy_render (#16163) 2024-11-10 06:54:38 +00:00
bundle.rs Type safe retained render world (#15756) 2024-10-10 18:47:04 +00:00
extended_material.rs Simpler lint fixes: makes ci lints work but disables a lint for now (#15376) 2024-09-24 11:42:59 +00:00
fog.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
lib.rs Don't reëxport bevy_image from bevy_render (#16163) 2024-11-10 06:54:38 +00:00
material.rs Don't reëxport bevy_image from bevy_render (#16163) 2024-11-10 06:54:38 +00:00
mesh_material.rs Revert default mesh materials (#15930) 2024-10-15 19:47:40 +00:00
parallax.rs bevy_reflect: FromReflect Ergonomics Implementation (#6056) 2023-06-29 01:31:34 +00:00
pbr_material.rs Use en-us locale for typos (#16037) 2024-10-20 18:55:17 +00:00
wireframe.rs Revert "Have EntityCommands methods consume self for easier chaining" (#15523) 2024-10-02 12:47:26 +00:00