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

Make indirect drawing opt-out instead of opt-in, enabling multidraw by default. #16757

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

pcwalton
Copy link
Contributor

This patch replaces the undocumented NoGpuCulling component with a new component, NoIndirectDrawing, effectively turning indirect drawing on by default. Indirect mode is needed for the recently-landed multidraw feature (#16427). Since multidraw is such a win for performance, when that feature is supported the small performance tax that indirect mode incurs is virtually always worth paying.

To ensure that custom drawing code such as that in the custom_shader_instancing example continues to function, this commit additionally makes GPU culling take the NoFrustumCulling component into account.

This PR is an alternative to #16670 that doesn't break the custom_shader_instancing example. PR #16755 should land first in order to avoid breaking deferred rendering, as multidraw currently breaks it.

Migration Guide

  • Indirect drawing (GPU culling) is now enabled by default, so the GpuCulling component is no longer available. To disable indirect mode, which may be useful with custom render nodes, add the new NoIndirectDrawing component to your camera.

default.

This patch replaces the undocumented `NoGpuCulling` component with a new
component, `NoIndirectDrawing`, effectively turning indirect drawing on
by default. Indirect mode is needed for the recently-landed multidraw
feature (bevyengine#16427). Since multidraw is such a win for performance, when
that feature is supported the small performance tax that indirect mode
incurs is virtually always worth paying.

To ensure that custom drawing code such as that in the
`custom_shader_instancing` example continues to function, this commit
additionally makes GPU culling take the `NoFrustumCulling` component
into account.

This PR is an alternative to bevyengine#16670 that doesn't break the
`custom_shader_instancing` example. **PR bevyengine#16755 should land first in
order to avoid breaking deferred rendering, as multidraw currently
breaks it**.
@pcwalton pcwalton 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 M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide C-Performance A change motivated by improving speed, memory usage or compile times labels Dec 10, 2024
@alice-i-cecile alice-i-cecile added the S-Blocked This cannot move forward until something else changes label Dec 11, 2024
@JMS55
Copy link
Contributor

JMS55 commented Dec 11, 2024

Did you mean to add the new component to custom_shader_instancing?

@pcwalton
Copy link
Contributor Author

@JMS55 Good catch, fixed.

Copy link
Contributor

@bushrat011899 bushrat011899 left a comment

Choose a reason for hiding this comment

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

Code looks good, and it works on my i5-1240P iGPU with Windows 10 and DX12.

@pcwalton pcwalton removed S-Blocked This cannot move forward until something else changes C-Bug An unexpected or incorrect behavior labels Dec 12, 2024
@pcwalton pcwalton requested a review from Elabajaba December 12, 2024 04:51
@pcwalton
Copy link
Contributor Author

Looks like the tests all passed except for some timeouts on Android that look like test flakiness rather than actual failures.

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-Performance A change motivated by improving speed, memory usage or compile times M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants