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

Reduce number of unused pipeline bindings reserved for argument buffers. #2417

Merged
merged 2 commits into from
Jan 23, 2025

Conversation

squidbus
Copy link
Contributor

@squidbus squidbus commented Jan 6, 2025

  • Checks if any descriptor set layouts bound to a pipeline layout are actually using argument buffers before reserving any indices to bind them.
  • Reduces the number of reserved indices for argument buffers to only the number of descriptor sets.

I was hitting limits on number of bind indices available because a fixed 8 are always reserved for argument buffers, even with only a single descriptor set using push descriptors (which do not use argument buffers). Mainly when tessellation is involved, it was unable to reserve indices for the output buffer.

Please let me know if there's anything I'm missing with this approach, I tested it in my application both as-is and with push descriptors disabled, and it seems to work fine.

Side note: It may be worth modifying the maxPushDescriptors property based on the number of potential reserved bindings needed, as it's what I use to determine whether to use push descriptors or not for a pipeline descriptor set layout. Advertising with the max possible number when in reality some may be taken away for argument buffers and other internal bindings can cause problems that could be avoided if the application knew to avoid using as many push descriptors. But I didn't delve into that in this PR.

Copy link
Contributor

@billhollings billhollings 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 submitting this! Makes a lot of sense.

And I'm an impressed at how simple the change was (ie. not triggering side-effects elsewhere).

I've made some inline recommendations about simplifying the change even more.

MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm Outdated Show resolved Hide resolved
MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm Show resolved Hide resolved
MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm Show resolved Hide resolved
Copy link
Contributor

@billhollings billhollings 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 the explanation. LGTM now.

MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm Show resolved Hide resolved
@billhollings billhollings merged commit 2473ce6 into KhronosGroup:main Jan 23, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants