-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make setup of Opaque3dPrepass and AlphaMask3dPrepass phase items consistent with others #8408
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
Fixing unused imports rn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, apply_normal_mapping
is used in pbr_prepass.wgsl
at line 98, you should update that file to use the new argument list.
The reason it compiles is that the shader_prepass.rs
example doesn't have a normal map, so the #ifdef
removes the code from the file, and there is no opportunity to create a shader compilation error since the code is never compiled.
…viously done in bevy_pbr) consistent with Opaque3d and AlphaMask3d phase items (done in bevy_core_pipeline) to make it easier to use bevy_core_pipeline's render phases without bevy_pbr
I'm not sure what you mean, I've pulled changes just now and the argument list hasn't changed in |
I mistook this PR for #8106 😅 How embarrassing. Everything is good |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, sorry for not reviewing this sooner.
Objective
When browsing the bevy source code to try and learn about
bevy_core_pipeline
, I noticed that theDrawFunctions
resources,sort_phase_system
s and texture preparation for theOpaque3d
andAlphaMask3d
phase items are all set up inbevy_core_pipeline
, while theOpaque3dPrepass
andAlphaMask3dPrepass
phase items are only declared inbevy_core_pipeline
, and actually registered properly with the renderer inbevy_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 thatbevy_pbr
does. Worse, it means that if I try to use thePrepassNode
bevy_core_pipeline
adds without fixing this, the engine will simply crash because theDrawFunctions<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>
, cameraRenderPhase
extraction, and texture preparation for prepass's phase items intobevy_core_pipeline
alongside the equivalent code that sets up theOpaque3d
,AlphaMask3d
andTransparent3d
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.