4

As descriptors are essentially pointers/references to resources, set host-side (CPU conceptually) in order to tell the device (GPU) what each descriptor points to (device-local/GPU) buffers/memory, how does this actually happen? The reason I ask this is because usually the programmer knows exactly when the transfer of data is done from host to device because it's recorded into a command buffer and then submitted to a queue. vkUpdateDescriptorSets is not a command buffer command, and people say that the descriptor sets are updated instantly. How does this actually work?

The descriptor sets are allocated in descriptor pools, which like command buffer pools reside host-side. So essentially when recording commands you're writing into host-side memory until you submit the command buffer. Does vkUpdateDescriptorSets work the same way, in that it's writing to host-side memory, and then when a command buffer is submitted it transfers the data to the GPU? Or does it do a transfer to the GPU immediately then and there? In the case of a descriptor which is an array and I write descriptor binding array element [1] and element[4091] does Vulkan need to transfer the entire array over to the GPU or will this result in two small transfers?

Please explain to me if my conception of this is correct. Written descriptors need to be written to the GPU because this is where the resource pointers are.

1 Answer 1

2

Descriptor sets are essentially a black box. How they work is how the specification describes how they work. Anything more than that is implementation-specific.

Are they in GPU memory or host memory? That depends on the implementation.

If you're using the descriptor indexing feature of more recent Vulkan implementations, it's not possible for an implementation to batch changes to descriptor sets after the call to vkUpdateDescriptorSets. As such, the changes made by that function must be visible to any commands that reference the descriptor set that have already been added to a CB but are not yet submitted. So the implementation must have modified the data in a way that it is visible to the GPU. This also relaxes the synchronization requirements of said functions.

In the case of a descriptor which is an array and I write descriptor binding array element [1] and element[4091] does Vulkan need to transfer the entire array over to the GPU or will this result in two small transfers?

The implementation can do what it wants. As such, you'll have to rely on profiling to tell if it is a performance problem on the platforms of interest to you.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.