bevy/crates/bevy_render/src
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
..
camera Camera Output Modes, MSAA Writeback, and BlitPipeline (#7671) 2023-03-01 20:35:13 +00:00
color Add 'Color::as_lcha' function (#7757) (#7766) 2023-03-05 12:26:14 +00:00
mesh Fix some typos (#7763) 2023-02-20 22:56:57 +00:00
primitives Derive Copy for Aabb (#7401) 2023-01-30 18:27:58 +00:00
render_graph Use position in code when possible (#7621) 2023-02-11 08:28:14 +00:00
render_phase implement TypeUuid for primitives and fix multiple-parameter generics having the same TypeUuid (#6633) 2023-02-16 17:09:44 +00:00
render_resource Fix performance regression with shadow mapping (#7914) 2023-03-06 00:00:40 +00:00
renderer Wgpu 0.15 (#7356) 2023-01-29 20:27:30 +00:00
texture Use Image::default for 1 pixel white texture directly (#7884) 2023-03-04 12:29:10 +00:00
view Change the glTF loader to use Camera3dBundle (#7890) 2023-03-04 12:05:27 +00:00
extract_component.rs Support system.in_schedule() and system.on_startup() (#7790) 2023-02-24 18:33:55 +00:00
extract_param.rs Migrate engine to Schedule v3 (#7267) 2023-02-06 02:04:50 +00:00
extract_resource.rs Support system.in_schedule() and system.on_startup() (#7790) 2023-02-24 18:33:55 +00:00
globals.rs Support system.in_schedule() and system.on_startup() (#7790) 2023-02-24 18:33:55 +00:00
globals.wgsl Refactor Globals and View structs into separate shaders (#7512) 2023-02-11 17:55:18 +00:00
lib.rs Fix some typos (#7763) 2023-02-20 22:56:57 +00:00
pipelined_rendering.rs Rename schedule v3 to schedule (#7519) 2023-02-06 18:44:40 +00:00
render_asset.rs Support system.in_schedule() and system.on_startup() (#7790) 2023-02-24 18:33:55 +00:00
settings.rs add OpenGL and DX11 backends (#7481) 2023-02-04 23:20:20 +00:00
spatial_bundle.rs