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 #[bindless] in ExtendedMaterial actually enable bindless mode. #16818

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

Conversation

pcwalton
Copy link
Contributor

I forgot to set BINDLESS_SLOT_COUNT in ExtendedMaterial's implementation of AsBindGroup, so it didn't actually become bindless. In fact, it would usually crash with a shader/bind group layout mismatch, because some parts of Bevy's renderer thought that the resulting material was bindless while other parts didn't. This commit corrects the situation.

I had to make BINDLESS_SLOT_COUNT a function instead of a constant because the ExtendedMaterial version needs some logic. Unfortunately, trait methods can't be const fns, so it has to be a runtime function.

I forgot to set `BINDLESS_SLOT_COUNT` in `ExtendedMaterial`'s
implementation of `AsBindGroup`, so it didn't actually become bindless.
In fact, it would usually crash with a shader/bind group layout
mismatch, because some parts of Bevy's renderer thought that the
resulting material was bindless while other parts didn't. This commit
corrects the situation.

I had to make `BINDLESS_SLOT_COUNT` a function instead of a constant
because the `ExtendedMaterial` version needs some logic. Unfortunately,
trait methods can't be `const fn`s, so it has to be a runtime function.
@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 labels Dec 14, 2024
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-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants