bevy/crates/bevy_core_pipeline/src
Chris Sixsmith a78c4d78d5
Make setup of Opaque3dPrepass and AlphaMask3dPrepass phase items consistent with others (#8408)
# Objective

When browsing the bevy source code to try and learn about
`bevy_core_pipeline`, I noticed that the `DrawFunctions` resources,
`sort_phase_system`s and texture preparation for the `Opaque3d` and
`AlphaMask3d` phase items are all set up in `bevy_core_pipeline`, while
the `Opaque3dPrepass` and `AlphaMask3dPrepass` phase items are only
*declared* in `bevy_core_pipeline`, and actually registered properly
with the renderer in `bevy_pbr`.

This means that, if I am trying to make crate that replaces `bevy_pbr`,
I need to make sure I manually fix this unfinished setup the same way
that `bevy_pbr` does. Worse, it means that if I try to use the
`PrepassNode` `bevy_core_pipeline` adds *without* fixing this, the
engine will simply crash because the `DrawFunctions<T>` resources cannot
be accessed.

The only advantage I can think of for bevy doing it this way is an
ambiguous performance save due to the prepass render phases not being
present unless you are using prepass materials with PBR.

## Solution

I have moved the registration of `DrawFunctions<T>`,
`sort_phase_system::<T>`, camera `RenderPhase` extraction, and texture
preparation for prepass's phase items into `bevy_core_pipeline`
alongside the equivalent code that sets up the `Opaque3d`, `AlphaMask3d`
and `Transparent3d` phase items.

Am open to tweaking this to improve the performance impact of prepass
things being around if the app doesn't use them if needed.

I've tested that the `shader_prepass` example still works with this
change.
2023-06-12 19:15:28 +00:00
..
blit Webgpu support (#8336) 2023-05-04 22:07:57 +00:00
bloom Apply codebase changes in preparation for StandardMaterial transmission (#8704) 2023-05-30 14:21:53 +00:00
contrast_adaptive_sharpening Webgpu support (#8336) 2023-05-04 22:07:57 +00:00
core_2d Add ViewNode to simplify render node management (#8118) 2023-05-08 19:42:23 +00:00
core_3d Make setup of Opaque3dPrepass and AlphaMask3dPrepass phase items consistent with others (#8408) 2023-06-12 19:15:28 +00:00
fullscreen_vertex_shader Built-in skybox (#8275) 2023-04-02 10:57:12 +00:00
fxaa Register a few missed reflect components (#8807) 2023-06-10 23:19:39 +00:00
prepass Apply codebase changes in preparation for StandardMaterial transmission (#8704) 2023-05-30 14:21:53 +00:00
skybox Webgpu support (#8336) 2023-05-04 22:07:57 +00:00
taa Use ViewNode for TAA (#8732) 2023-06-01 04:42:41 +00:00
tonemapping Change default tonemapping method (#8685) 2023-05-29 15:36:21 +00:00
upscaling Apply codebase changes in preparation for StandardMaterial transmission (#8704) 2023-05-30 14:21:53 +00:00
clear_color.rs Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
lib.rs Suppress the clippy::type_complexity lint (#8313) 2023-04-06 21:27:36 +00:00
msaa_writeback.rs Use RenderGraphApp in more places (#8298) 2023-04-05 20:57:56 +00:00