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

Support destroying a VkBuffer or VkImageView while it is retained by a descriptor, but not used dynamically in a shader #2359

Open
billhollings opened this issue Sep 30, 2024 · 0 comments

Comments

@billhollings
Copy link
Contributor

From @mbechard in issue #2206, which was resolved with PR #2320:

Sorry, this fell through the cracks. Honestly I feel like the cure is worse than the symptom on this one. I think in both cases you are stuck doing non-Vulkan spec behavior. With this new change, GPU resources aren't freed until descriptor sets stop referencing them. So the choices are;
(1). Workaround for old behavior: Keep track of all entries in the array that are bound, and whenever you use that descriptor, ensure that those entries are valid (you can ignore entries that were never used).
(2). Required new management for new behavior: All resources now need to keep track of every descriptor that references them, and when they want to be freed, go through all of those descriptors and do an update to cause the descriptor to no longer reference them.

Dealing with (2) seems much more difficult than (1), and I worry that for people that aren't running into (1), they are going to be getting hit by (2) without realizing it.

(Sorry about the errant references to issues 1 and 2 from this repo in my original post in this message)

The spec also states:

VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT indicates that descriptors in this binding that are not dynamically used need not contain valid descriptors at the time the descriptors are consumed. A descriptor is dynamically used if any shader invocation executes an instruction that performs any memory access using the descriptor. If a descriptor is not dynamically used, any resource referenced by the descriptor is not considered to be referenced during command execution.

This clarification was only added recently, in spec v1.3.210.

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

No branches or pull requests

1 participant