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

Vulkan Descriptor buffers custom offsets #2381

Open
Agrael1 opened this issue Jun 7, 2024 · 3 comments
Open

Vulkan Descriptor buffers custom offsets #2381

Agrael1 opened this issue Jun 7, 2024 · 3 comments
Labels
Feature Request Feature request (enhancement)

Comments

@Agrael1
Copy link

Agrael1 commented Jun 7, 2024

Hello, I have been working with descriptor buffers for quite some time, and I'd like to see them as a standard way to do decriptors. They allow for so much flexibility!

However there are some points I would like to discuss.

  1. vkCmdSetDescriptorBufferOffsetsEXT offset is only allowed with alignment:
    I have 3 images, which I'd like to offset on a frame basis, similar to swapchain. However for that I have to allocate 3 * padding bytes for descriptors, and indexing from index * desc_size becomes a pain to manage.

  2. Querying the offsets for specific descriptors within desc set with vkGetDescriptorSetLayoutBindingOffsetEXT is yet another API call. Could it be substituted with concrete values from VkPhysicalDeviceDescriptorBufferPropertiesEXT? This would make predicting size of the sets with variable descriptor count more feasible and will essentially remove a need for vkGetDescriptorSetLayoutSizeEXT.

  3. Would something like vkSetDescriptorAddressIncrement be a feasible feature to have? This would come as a refinement for mutable descriptors and allow for better control over descriptor buffers, since it would provide a mean to shift indexing of descriptors.

What do you think?

@oddhack oddhack added the Feature Request Feature request (enhancement) label Jun 12, 2024
@Tobski
Copy link
Contributor

Tobski commented Jun 13, 2024

Hi @Agrael1! Thanks for your feedback! We are actually working towards standardising something in this area in the roadmap, and while I can't go into any details yet, all of what you've asked for is covered in what we're working on already (at least based on your descriptions). I'll keep this open until it's released to make sure we don't accidentally drop any of this functionality before then.

@HansKristian-Work
Copy link
Contributor

As for existing API:

  1. Binding a descriptor buffer is similar to binding a UBO in some hardware, so UBO-style alignment is required. To avoid that case, descriptor indexing is the way to go.

  2. In descriptor sets, drivers are free to optimize the memory layout. Again, for consistent layouts, descriptor indexing is the way to go.

  3. Can be solved with spec constants in theory, but it is very ugly, yes.

@Agrael1
Copy link
Author

Agrael1 commented Jun 13, 2024

@HansKristian-Work I haven't seen any possibility of descriptor shifting using desc indexing. You are essentially forced into non-uniform resource indexing.

Now I'm thinking, how well would descriptor shifting fit into descriptor indexing? It seems quite logical to index into offset of descriptor set. May be a good extension?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Feature request (enhancement)
Projects
None yet
Development

No branches or pull requests

4 participants