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

Use value equality to determine uniform buffer equivalence #6414

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LumpBloom7
Copy link
Contributor

@LumpBloom7 LumpBloom7 commented Nov 9, 2024

The previous reference-equality guaranteed that DrawNodes that bind uniform blocks will break batches, even if the uniform block data is identical to an adjacent DrawNode for the same shader.

Value equality allows adjacent DrawNodes with the same uniform data to share the same uniform block, and therefore the same batch.

A possible problem with this solution is that it depends on the uniform data being set before binding, where the check occurs. Failure to do so will result in incorrect uniform data being used during drawing. However, all code in osu/framework binds after setting uniform data, so I don't feel like it is a problem in general.

Uniform uploads still happen even with this change.

Allows multiple consecutive drawables to share the same batch when all
of them binds the same uniform data.
@smoogipoo
Copy link
Contributor

depends on the uniform data being set before binding, where the check occurs. Failure to do so will result in incorrect uniform data being used during drawing

I'm not sure I can get past the hidden breakage aspect of this, even if there are no usages...

@LumpBloom7
Copy link
Contributor Author

LumpBloom7 commented Nov 23, 2024

I agree, which is the reason I brought it up. If this quick fix is used, we likely should enforce the order of uniform uploads. (Cannot set data while bound?)

Or maybe trigger a rebind if data is changed while bound.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants