bevy/crates/bevy_pbr/src/meshlet
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
..
asset.rs Meshlet new error projection (#15846) 2024-10-22 20:14:30 +00:00
cull_clusters.wgsl Meshlet fill cluster buffers rewritten (#15955) 2024-10-23 19:18:49 +00:00
downsample_depth.wgsl Meshlet software raster + start of cleanup (#14623) 2024-08-26 17:54:34 +00:00
dummy_visibility_buffer_resolve.wgsl Meshlet rendering (initial feature) (#10164) 2024-03-25 19:08:27 +00:00
fill_cluster_buffers.wgsl Meshlet fill cluster buffers rewritten (#15955) 2024-10-23 19:18:49 +00:00
from_mesh.rs Meshlet normal-aware LOD and meshoptimizer upgrade (#16111) 2024-11-04 15:20:22 +00:00
instance_manager.rs Meshlet fill cluster buffers rewritten (#15955) 2024-10-23 19:18:49 +00:00
material_pipeline_prepare.rs Expose Pipeline Compilation Zero Initialize Workgroup Memory Option (#16301) 2024-11-08 21:42:37 +00:00
material_shade_nodes.rs Meshlet software raster + start of cleanup (#14623) 2024-08-26 17:54:34 +00:00
meshlet_bindings.wgsl Meshlet fill cluster buffers rewritten (#15955) 2024-10-23 19:18:49 +00:00
meshlet_mesh_manager.rs Meshlet new error projection (#15846) 2024-10-22 20:14:30 +00:00
meshlet_mesh_material.wgsl Meshlet misc (#13761) 2024-06-10 13:06:08 +00:00
meshlet_preview.png Meshlet rendering (initial feature) (#10164) 2024-03-25 19:08:27 +00:00
mod.rs Native unclipped depth on supported platforms (#16095) 2024-12-03 17:30:14 +00:00
persistent_buffer.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
persistent_buffer_impls.rs Meshlet new error projection (#15846) 2024-10-22 20:14:30 +00:00
pipelines.rs Native unclipped depth on supported platforms (#16095) 2024-12-03 17:30:14 +00:00
remap_1d_to_2d_dispatch.wgsl Meshlet fill cluster buffers rewritten (#15955) 2024-10-23 19:18:49 +00:00
resolve_render_targets.wgsl More triangles/vertices per meshlet (#15023) 2024-09-08 17:55:57 +00:00
resource_manager.rs Meshlet fill cluster buffers rewritten (#15955) 2024-10-23 19:18:49 +00:00
visibility_buffer_hardware_raster.wgsl Native unclipped depth on supported platforms (#16095) 2024-12-03 17:30:14 +00:00
visibility_buffer_raster_node.rs Native unclipped depth on supported platforms (#16095) 2024-12-03 17:30:14 +00:00
visibility_buffer_resolve.wgsl Meshlet fill cluster buffers rewritten (#15955) 2024-10-23 19:18:49 +00:00
visibility_buffer_software_raster.wgsl Native unclipped depth on supported platforms (#16095) 2024-12-03 17:30:14 +00:00