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

Descriptor buffers size issues #8203

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

Descriptor buffers size issues #8203

Agrael1 opened this issue Jun 17, 2024 · 7 comments
Assignees
Labels
Bug Something isn't working

Comments

@Agrael1
Copy link

Agrael1 commented Jun 17, 2024

Hi, I have reverted to using bytes for descriptor tables.

However there is a validation problem. If I bind and set offset 0 for a simple layout it starts making noisy messages in validation.

The offsets in pOffsets must be small enough such that any descriptor binding referenced by layout without the VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT flag computes a valid address inside the underlying VkBuffer

But if I change the size of the buffer to 256, the error goes away. I am using a huge buffer for bindless and bindful tests, so I may or may not be able to query the size of the descriptor layout. The layout itself does not exceed a single uniform binding, so allocating a buffer for 1 uniform should be enough. May this be a rule, that I missed, or is it a validation false positive?

@spencer-lunarg spencer-lunarg self-assigned this Jun 26, 2024
@spencer-lunarg
Copy link
Contributor

@Agrael1 so this would be for VUID-VkSetDescriptorBufferOffsetsInfoEXT-pOffsets-08063/VUID-vkCmdSetDescriptorBufferOffsetsEXT-pOffsets-08063

Can you print the entire Validation error message? What version of the SDK did you use (this seems like an older message)

@Agrael1
Copy link
Author

Agrael1 commented Jun 27, 2024

@spencer-lunarg

[Validation layer]: VUID-vkCmdSetDescriptorBufferOffsetsEXT-pOffsets-08063
 [Message]:Validation Error: [ VUID-vkCmdSetDescriptorBufferOffsetsEXT-pOffsets-08063 ] Object 0: handle = 0x27fa20378c0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x22ff52a9 | vkCmdSetDescriptorBufferOffsetsEXT(): pOffsets[0] 0 must be small enough such that any descriptor binding referenced by layout without the VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT flag computes a valid address inside the underlying VkBuffer. The Vulkan spec states: The offsets in pOffsets must be small enough such that any descriptor binding referenced by layout without the VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT flag computes a valid address inside the underlying VkBuffer (https://vulkan.lunarg.com/doc/view/1.3.280.0/windows/1.3-extensions/vkspec.html#VUID-vkCmdSetDescriptorBufferOffsetsEXT-pOffsets-08063)

The SDK version I run is 1.3.280, the real implemented version is 1.3.275 on NVidia 555.99 RTX driver
The only thing I change to see the error is I change the descriptor buffer size from 256 to 3 * (mutable_desc_size), which is 3*16=48.
Buffer is allocated using Vulkan Memory Allocator

@spencer-lunarg spencer-lunarg transferred this issue from KhronosGroup/Vulkan-Docs Jun 27, 2024
@spencer-lunarg
Copy link
Contributor

@Agrael1 I am still looking into this, what my "guess" is going on is the VVL is throwing a real error, but giving a terrible message (so needs to be fixed regardless)

If you call vkGetDescriptorSetLayoutSizeEXT on your layout, is it over 3 * (mutable_desc_size), if see the issue is not the offset, but that the offset (0) plus the pLayoutSizeInBytes is too large for your buffer

@Agrael1
Copy link
Author

Agrael1 commented Jun 28, 2024

@spencer-lunarg The thing is, it is not registering as an error, VkResult is fine, and rendering is fine as well. 3 * (mutable_desc_size) is enough to fit all descriptors, but pLayoutSizeInBytes is not giving adequate size. 256 is something worth mentioning in documentation of VK_EXT_descriptor_buffer, since it makes use of desc buffers challenging. I have tested it on several cards, none have any problems reading descriptors.

My guess is that pLayoutSizeInBytes gives minimal buffer size to allocate, with regards to buffer memory size alignment, but does not reflect the actual memory descriptors consume.

@spencer-lunarg
Copy link
Contributor

spencer-lunarg commented Jun 28, 2024

but pLayoutSizeInBytes is not giving adequate size

Just to confirm, did you query the size and what did it return for you here... this is what the validation layers is currently using to decide (if that is correct or not, is something I am still trying to figure out)

@Agrael1
Copy link
Author

Agrael1 commented Jun 28, 2024

yes, it returns 256.

@Agrael1
Copy link
Author

Agrael1 commented Jun 28, 2024

Create a VkBuffer, size equal to NumDescriptors multiplied by the descriptor size within it

https://github.com/KhronosGroup/Vulkan-Docs/blob/main/proposals/VK_EXT_descriptor_buffer.adoc
Paragraph 4.1.
Now it seems that the check is incorrect, and the buffer should be indeed 3 * (mutable_desc_size)

@spencer-lunarg spencer-lunarg added the Bug Something isn't working label Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants