2
votes

Here's a quote from the vulkan spec, chapter 'Descriptor Set Binding':

The effective offset used for dynamic uniform and storage buffer bindings is the sum of the relative offset taken from pDynamicOffsets, and the base address of the buffer plus base offset in the descriptor set.

That doesn't seem to make sense, an offset can't be the sum of an address and other offsets. What does the statement really want to say? Is the final offset A) the sum of the offset in pDynamicOffsets and the offset in the descriptor set or is it B) equal to the offset in pDynamicOffsets?

1
Vulkan is awesome but The whole Kronos documentation is a catastrophe. It is rare to see a paragraph that I can say, Ah got it. The Vulkan Tutorial tries to explain why we use it vulkan-tutorial.com. I wish this guy was part of the Kronos Documentation Group. - alcoforado

1 Answers

4
votes

an offset can't be the sum of an address and other offsets

Why not?

When you bind a VkBuffer to a piece of memory, you provide a byte offset within that allocation to the start of where you want the buffer to exist within that memory. That offset is occasionally referred to as the "base address" of the buffer (something similar is used for images).

What it's saying is that the start of the range of memory accessible through the descriptor is defined by 3 values: the dynamic offset you're sending to the descriptor, the static offset that was already set in the descriptor, and the "base address" for the VkBuffer, which you provided when you bound it to a piece of memory.

The reason for the statement at all is to let you know that the static offset you used in the descriptor still applies. The dynamic offset adds to it; it does not override it.