Skip to content
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

Remove components if not extracted #15948

Merged
merged 15 commits into from
Oct 19, 2024
Merged

Conversation

akimakinai
Copy link
Contributor

@akimakinai akimakinai commented Oct 16, 2024

Objective

Solution

Testing

Modified example locally to add toggles if not exist.

  • DOF - toggling DOF component and perspective in depth_of_field example
  • TAA - toggling Camera.is_active and TAA component
  • clusters - not entirely sure, toggling Camera.is_active in many_lights example (no crash/glitch even without this PR)
  • previous_view - toggling Camera.is_active in skybox (no crash/glitch even without this PR)
  • lights - toggling Visibility of DirectionalLight in lighting example
  • SSAO - toggling Camera.is_active and SSAO component in ssao example
  • default UI camera view - toggling Camera.is_active (nop without Fix deactivated camera still being used in render world #15946 because UI defaults to some camera even if DefaultCameraView is not there)
  • volumetric fog - toggling existence of volumetric light. Looks like optimization, no change in behavior/visuals

@akimakinai
Copy link
Contributor Author

Hm, in some cases, we also need to remove components inserted from prepare systems, as rendering systems only picks these components and still runs even if not extracted.

@akimakinai
Copy link
Contributor Author

Instead, I went ahead to add the config component (DepthOfField in this case) to ViewQuery. Is this okay? I confirmed toggling Perspective between orthographic/perspective won't crash anymore.

@akimakinai akimakinai marked this pull request as draft October 16, 2024 12:51
@akimakinai akimakinai marked this pull request as ready for review October 16, 2024 14:16
@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 16, 2024
@alice-i-cecile
Copy link
Member

@rafalh are you able to review this PR for me in turn? :) This is closely related to #15946.

@alice-i-cecile alice-i-cecile added this to the 0.15 milestone Oct 16, 2024
Copy link
Contributor

@rafalh rafalh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rafalh are you able to review this PR for me in turn? :) This is closely related to #15946.

@alice-i-cecile I tried but I don't think I understand enough about the render graph to fully review this. I left some comments through. Most of changes looks okay to me.

.remove::<(
ExtractedDirectionalLight,
RenderCascadesVisibleEntities,
LightViewEntities,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LightViewEntities is added in an observer and not in this system, so it's not clear at the first glance why we remove it here. Maybe we should remove it in an observer too to be consistent? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added OnRemove version of the observer that removes LightViewEntities.

@@ -342,6 +346,7 @@ impl ViewNode for DepthOfFieldNode {
_: &mut RenderGraphContext,
render_context: &mut RenderContext<'w>,
(
_depth_of_field,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why do we need this and it seems like a hack to me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, changed to remove components in view query too.

Copy link
Contributor

@tychedelia tychedelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for leaving the breadcrumbs to improve this later.

@tychedelia tychedelia added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 19, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Oct 19, 2024
Merged via the queue into bevyengine:main with commit 61350cd Oct 19, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Conditional extraction to render world can cause desync
4 participants