bevy/crates/bevy_pbr/src/render
Robert Swain 2c0ff950d1 Fix performance regression with shadow mapping (#7914)
# Objective

- @mockersf identified a performance regression of about 25% longer frame times introduced by #7784 in a complex scene with the Amazon Lumberyard bistro scene with both exterior and interior variants and a number of point lights with shadow mapping enabled
  - The additional time seemed to be spent in the `ShadowPassNode`
  - `ShadowPassNode` encodes the draw commands for the shadow phase. Roughly the same numbers of entities were having draw commands encoded, so something about the way they were being encoded had changed.
  - One thing that definitely changed was that the pipeline used will be different depending on the alpha mode, and the scene has lots entities with opaque and blend materials. This suggested that maybe the pipeline was changing a lot so I tried a quick hack to see if it was the problem.

## Solution

- Sort the shadow phase items by their pipeline id
  - This groups phase items by their pipeline id, which significantly reduces pipeline rebinding required to the point that the performance regression was gone.
2023-03-06 00:00:40 +00:00
..
clustered_forward.wgsl Wgpu 0.15 (#7356) 2023-01-29 20:27:30 +00:00
fog.rs Migrate engine to Schedule v3 (#7267) 2023-02-06 02:04:50 +00:00
fog.wgsl Add Distance and Atmospheric Fog support (#6412) 2023-01-29 15:28:56 +00:00
light.rs Fix performance regression with shadow mapping (#7914) 2023-03-06 00:00:40 +00:00
mesh.rs use blendstate blend for alphamode::blend (#7899) 2023-03-05 00:17:44 +00:00
mesh.wgsl bevy_pbr: Fix incorrect and unnecessary normal-mapping code (#5766) 2022-11-03 20:37:32 +00:00
mesh_bindings.wgsl update wgpu to 0.13 (#5168) 2022-07-14 21:17:16 +00:00
mesh_functions.wgsl bevy_pbr: Fix tangent and normal normalization (#5666) 2022-08-18 21:54:40 +00:00
mesh_types.wgsl Wgpu 0.15 (#7356) 2023-01-29 20:27:30 +00:00
mesh_vertex_output.wgsl update wgpu to 0.13 (#5168) 2022-07-14 21:17:16 +00:00
mesh_view_bindings.wgsl Initial tonemapping options (#7594) 2023-02-19 20:38:13 +00:00
mesh_view_types.wgsl EnvironmentMapLight support for WebGL2 (#7737) 2023-02-20 00:02:40 +00:00
mod.rs Add Distance and Atmospheric Fog support (#6412) 2023-01-29 15:28:56 +00:00
pbr.wgsl Remove dependency on the mesh struct in the pbr function (#7597) 2023-02-20 00:16:46 +00:00
pbr_ambient.wgsl EnvironmentMapLight, BRDF Improvements (#7051) 2023-02-09 16:46:32 +00:00
pbr_bindings.wgsl update wgpu to 0.13 (#5168) 2022-07-14 21:17:16 +00:00
pbr_functions.wgsl use blendstate blend for alphamode::blend (#7899) 2023-03-05 00:17:44 +00:00
pbr_lighting.wgsl EnvironmentMapLight, BRDF Improvements (#7051) 2023-02-09 16:46:32 +00:00
pbr_prepass.wgsl use blendstate blend for alphamode::blend (#7899) 2023-03-05 00:17:44 +00:00
pbr_types.wgsl Wgpu 0.15 (#7356) 2023-01-29 20:27:30 +00:00
shadows.wgsl Better cascades config defaults + builder, tweak example configs (#7456) 2023-02-05 08:06:32 +00:00
skinning.wgsl bevy_pbr: Normalize skinned normals (#6543) 2022-11-11 03:31:57 +00:00
utils.wgsl Wgpu 0.15 (#7356) 2023-01-29 20:27:30 +00:00
wireframe.wgsl update wgpu to 0.13 (#5168) 2022-07-14 21:17:16 +00:00