bevy/crates/bevy_pbr/src/render
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
..
clustered_forward.wgsl Use en-us locale for typos (#16037) 2024-10-20 18:55:17 +00:00
fog.rs Rename rendering components for improved consistency and clarity (#15035) 2024-09-10 01:11:46 +00:00
fog.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
forward_io.wgsl Add UV channel selection to StandardMaterial (#13200) 2024-05-13 18:23:09 +00:00
gpu_preprocess.rs Expose Pipeline Compilation Zero Initialize Workgroup Memory Option (#16301) 2024-11-08 21:42:37 +00:00
light.rs Native unclipped depth on supported platforms (#16095) 2024-12-03 17:30:14 +00:00
mesh.rs Native unclipped depth on supported platforms (#16095) 2024-12-03 17:30:14 +00:00
mesh.wgsl Fix the example regressions from packed growable buffers. (#14375) 2024-07-22 18:55:51 +00:00
mesh_bindings.rs simplify std::mem references (#15315) 2024-09-19 21:28:16 +00:00
mesh_bindings.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
mesh_functions.wgsl Fix meshlet vertex attribute interpolation (#13775) 2024-06-10 20:18:43 +00:00
mesh_preprocess.wgsl Fix the example regressions from packed growable buffers. (#14375) 2024-07-22 18:55:51 +00:00
mesh_types.wgsl Fix the example regressions from packed growable buffers. (#14375) 2024-07-22 18:55:51 +00:00
mesh_view_bindings.rs Make PCSS experimental (#16382) 2024-11-14 07:39:26 +00:00
mesh_view_bindings.wgsl Fix WGSL formatting inconsistency on mesh_view_binding (#16202) 2024-11-04 15:32:38 +00:00
mesh_view_types.wgsl Adding alpha_threshold to OrderIndependentTransparencySettings for user-level optimization (#16090) 2024-10-27 19:08:34 +00:00
mod.rs Implement motion vectors and TAA for skinned meshes and meshes with morph targets. (#13572) 2024-05-31 17:02:28 +00:00
morph.rs Type safe retained render world (#15756) 2024-10-10 18:47:04 +00:00
morph.wgsl Implement motion vectors and TAA for skinned meshes and meshes with morph targets. (#13572) 2024-05-31 17:02:28 +00:00
parallax_mapping.wgsl Fix a few "repeated word" typos (#13955) 2024-06-20 21:35:20 +00:00
pbr.wgsl Fix OIT shaders error with DX12 backend (#15782) 2024-10-10 14:17:09 +00:00
pbr_ambient.wgsl Use “specular occlusion” term to consistently extinguish fresnel on Ambient and Environment Map lights (#10182) 2023-10-23 03:26:20 +00:00
pbr_bindings.wgsl Added feature switch to default Standard Material's new anisotropy texture to off (#14048) 2024-07-02 18:02:05 +00:00
pbr_fragment.wgsl Added visibility bitmask as an alternative SSAO method (#13454) 2024-10-02 13:43:35 +00:00
pbr_functions.wgsl Meshlet screenspace-derived tangents (#15084) 2024-09-29 18:39:25 +00:00
pbr_lighting.wgsl Rename "point light" to "clusterable object" in cluster contexts. (#13654) 2024-06-04 11:01:13 +00:00
pbr_prepass.wgsl Native unclipped depth on supported platforms (#16095) 2024-12-03 17:30:14 +00:00
pbr_prepass_functions.wgsl Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
pbr_transmission.wgsl Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
pbr_types.wgsl Revert "Make FOG_ENABLED a shader_def instead of material flag (#13783)" (#13803) 2024-06-10 23:25:16 +00:00
rgb9e5.wgsl Deferred Renderer (#9258) 2023-10-12 22:10:38 +00:00
shadow_sampling.wgsl Place percentage-closer soft shadows behind a feature gate to save on samplers. (#16068) 2024-10-24 21:16:00 +00:00
shadows.wgsl Implement percentage-closer soft shadows (PCSS). (#13497) 2024-09-18 18:07:17 +00:00
skin.rs Type safe retained render world (#15756) 2024-10-10 18:47:04 +00:00
skinning.wgsl Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
utils.wgsl Per-meshlet compressed vertex data (#15643) 2024-10-08 18:42:55 +00:00
view_transformations.wgsl Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
wireframe.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00