-
-
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
[Merged by Bors] - Remove the early exit to make sure the prepass textures are cleared #7891
Conversation
The fix seems to work. I'm somewhat confused on the concept though. Say you have a camera with DepthPrepass, but don't have any meshes with prepass_enabled. What happens both in terms of what depth textures get generated, and how the main pass uses it? |
With this we always begin a RenderPass, which will clear the specified color and depth attachments (the prepass specific textures). If there are no meshes, there are no draw calls so the textures will stay in their cleared state. Previously, because we exited early, no render pass was started so the textures stayed in their old state from the previous frame. |
That much makes sense to me. What confuses me is, what happens in the main pass then? Presumably it has an empty depth texture, which seems like it would cause problems? |
The depth texture is cleared with the value |
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.
After reading up on how depth testing works, this lgtm now :)
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.
I originally had the if there to avoid unnecessary work, but I guess it's not that much code that ends up running when these are empty anyway.
The alternative to this would be to set a flag so that the main pass clears the depth texture itself. I don't think that's worth it, this is an unlikely situation to come up anyways. |
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.
i think this is fine. the node won't get this far if no prepass_enabled materials are used as the query above will not match (no RenderPhase would be added), so there won't be a perf impact for no-prepass use cases.
yes updating the camera's depth load op would be better so we don't need to check for all possible prepass markers in the core_3d node. something to bear in mind for if we move the rendergraph to a pure schedule. |
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.
bors r+
Pull request successfully merged into main. Build succeeded:
|
…evyengine#7891) # Objective - Fixes bevyengine#7888. ## Solution - Remove the early exit to make sure the prepass textures are cleared.
Objective
Solution