From 88d7f9713a942dfe1533486236ebf088ffbaf780 Mon Sep 17 00:00:00 2001 From: spencer-lunarg Date: Sat, 4 Jul 2026 18:03:51 -0500 Subject: [PATCH] Fix heap diagram to flip address with indexStride --- chapters/descriptor_heap.adoc | 12 ++++++------ chapters/images/descriptor_heap_indirect_index.svg | 2 +- .../images/descriptor_heap_indirect_index_array.svg | 2 +- chapters/images/descriptor_heap_push_data.svg | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/chapters/descriptor_heap.adoc b/chapters/descriptor_heap.adoc index 2ee580c2..900f48d3 100644 --- a/chapters/descriptor_heap.adoc +++ b/chapters/descriptor_heap.adoc @@ -244,11 +244,11 @@ The results are: `x == vec4(3)` and `y == vec4(5)` The formula is `offset = heapOffset + (indirectIndex * heapIndexStride) + (shaderIndex * heapArrayStride)` -The `pushOffset = 16` sets `indirectAddress` to `0x4000` which must be a valid `VkDeviceAddress` of memory backing some `VkBuffer`. The `addressOffset` of `0x40` is applied to that `indirectAddress` to get `0x4040`. We see at `0x4040` the uint32_t value of `0x20`, which becomes the `indirectIndex`. +The `pushOffset = 16` sets `indirectAddress` to `0x4000` which must be a valid `VkDeviceAddress` of memory backing some `VkBuffer`. The `addressOffset` of `0x40` is applied to that `indirectAddress` to get `0x4040`. We see at `0x4040` the uint32_t value of `2`, which becomes the `indirectIndex`. ---- -u_buffers[0] offset = 0x10 + (0x20 * 1) + (0 * 0x20) -u_buffers[1] offset = 0x10 + (0x20 * 1) + (1 * 0x20) +u_buffers[0] offset = 0x10 + (2 * 0x10) + (0 * 0x20) +u_buffers[1] offset = 0x10 + (2 * 0x10) + (1 * 0x20) ---- ==== VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_INDIRECT_INDEX_ARRAY_EXT @@ -264,8 +264,8 @@ Like the previous example, the `pushOffset = 16` sets `indirectAddress` to `0x40 From `0x4040`, each `shaderIndex` jumps to the next uint32_t and gets the offset from the indirect uniform buffer. ---- -u_buffers[0] offset = 0x00 + (0x60 * 1) -u_buffers[1] offset = 0x00 + (0x20 * 1) +u_buffers[0] offset = 0x00 + (6 * 0x10) +u_buffers[1] offset = 0x00 + (2 * 0x10) ---- === VkDescriptorMappingSourceEXT Inline Access @@ -573,7 +573,7 @@ you now can pack it into a single 32-bit word. ---- VkDescriptorMappingSourcePushIndexEXT::pushOffset = 0; VkDescriptorMappingSourcePushIndexEXT::useCombinedImageSamplerIndex = true; -VkDescriptorMappingSourcePushIndexEXT::samplerPushOffset = IGNORED; +VkDescriptorMappingSourcePushIndexEXT::samplerPushOffset = IGNORED; uint32_t image_index = 6; uint32_t sampler_index = 7; diff --git a/chapters/images/descriptor_heap_indirect_index.svg b/chapters/images/descriptor_heap_indirect_index.svg index 1de0e7d4..38fecceb 100644 --- a/chapters/images/descriptor_heap_indirect_index.svg +++ b/chapters/images/descriptor_heap_indirect_index.svg @@ -1,4 +1,4 @@ -
VkDescriptorMappingSourceIndirectIndexEXT::heapOffset = 0x10
VkDescriptorMappingSourceIndirectIndexEXT::pushOffset = 16
VkDescriptorMappingSourceIndirectIndexEXT::addressOffset = 0x40
VkDescriptorMappingSourceIndirectIndexEXT::heapIndexStride = 1
VkDescriptorMappingSourceIndirectIndexEXT::heapArrayStride = 0x20

0x0000
vkCmdPushDataEXT was called and set the internal push data as
0x4000
0
4
8
12
16
20
0x2000
0x0000
24
28
VkBuffer
(Uniform Buffer)
0x4000
0x4040
0x4060
0x4020
uninitialized
0x20
uninitialized
u_buffers[0]
u_buffers[1]
VkBuffer
(Resource Heap)
0x1000
0x1040
0x1060
0x1080
0x1020
Descriptor Blob A
Descriptor Blob B
Descriptor Blob C
Descriptor Blob D
Descriptor Blob E
Descriptor Blob F
Descriptor Blob G
Descriptor Blob I
\ No newline at end of file +
VkDescriptorMappingSourceIndirectIndexEXT::heapOffset = 0x10
VkDescriptorMappingSourceIndirectIndexEXT::pushOffset = 16
VkDescriptorMappingSourceIndirectIndexEXT::addressOffset = 0x40
VkDescriptorMappingSourceIndirectIndexEXT::heapIndexStride = 0x10
VkDescriptorMappingSourceIndirectIndexEXT::heapArrayStride = 0x20

0x0000
vkCmdPushDataEXT was called and set the internal push data as
0x4000
0
4
8
12
16
20
0x2000
0x0000
24
28
VkBuffer
(Uniform Buffer)
0x4000
0x4040
0x4060
0x4020
other data
2
other data
u_buffers[0]
u_buffers[1]
VkBuffer
(Resource Heap)
0x1000
0x1040
0x1060
0x1080
0x1020
Descriptor Blob A
Descriptor Blob B
Descriptor Blob C
Descriptor Blob D
Descriptor Blob E
Descriptor Blob F
Descriptor Blob G
Descriptor Blob I
\ No newline at end of file diff --git a/chapters/images/descriptor_heap_indirect_index_array.svg b/chapters/images/descriptor_heap_indirect_index_array.svg index b0cc0a2e..41f776a1 100644 --- a/chapters/images/descriptor_heap_indirect_index_array.svg +++ b/chapters/images/descriptor_heap_indirect_index_array.svg @@ -1,4 +1,4 @@ -
VkDescriptorMappingSourceIndirectIndexArrayEXT::heapOffset = 0
VkDescriptorMappingSourceIndirectIndexArrayEXT::pushOffset = 16
VkDescriptorMappingSourceIndirectIndexArrayEXT::addressOffset = 0x40
VkDescriptorMappingSourceIndirectIndexArrayEXT::heapIndexStride = 1

VkBuffer
(Uniform Buffer)
0x4040
0x4050
0x4048
0x60
0x20
0x00
0x40
0x0000
vkCmdPushDataEXT was called and set the internal push data as
0x4000
0
4
8
12
16
20
0x2000
0x0000
24
28
u_buffers[1]
u_buffers[0]
VkBuffer
(Resource Heap)
0x1000
0x1040
0x1060
0x1080
0x1020
Descriptor Blob A
Descriptor Blob B
Descriptor Blob C
Descriptor Blob D
Descriptor Blob E
Descriptor Blob F
Descriptor Blob G
Descriptor Blob H
\ No newline at end of file +
VkDescriptorMappingSourceIndirectIndexArrayEXT::heapOffset = 0
VkDescriptorMappingSourceIndirectIndexArrayEXT::pushOffset = 16
VkDescriptorMappingSourceIndirectIndexArrayEXT::addressOffset = 0x40
VkDescriptorMappingSourceIndirectIndexArrayEXT::heapIndexStride = 0x10

VkBuffer
(Uniform Buffer)
0x4040
0x4050
0x4048
6
2
0
4
0x0000
vkCmdPushDataEXT was called and set the internal push data as
0x4000
0
4
8
12
16
20
0x2000
0x0000
24
28
u_buffers[1]
u_buffers[0]
VkBuffer
(Resource Heap)
0x1000
0x1040
0x1060
0x1080
0x1020
Descriptor Blob A
Descriptor Blob B
Descriptor Blob C
Descriptor Blob D
Descriptor Blob E
Descriptor Blob F
Descriptor Blob G
Descriptor Blob H
\ No newline at end of file diff --git a/chapters/images/descriptor_heap_push_data.svg b/chapters/images/descriptor_heap_push_data.svg index bb402778..250e9881 100644 --- a/chapters/images/descriptor_heap_push_data.svg +++ b/chapters/images/descriptor_heap_push_data.svg @@ -1,4 +1,4 @@ -
pushDataOffset = 0x16

vkCmdPushDataEXT was called and set the internal push data as
0
48
16
32
u_buffer
uvec4(1)
uvec4(2)
uvec4(3)
uvec4(4)
\ No newline at end of file +
pushDataOffset = 16

vkCmdPushDataEXT was called and set the internal push data as
0
48
16
32
u_buffer
uvec4(1)
uvec4(2)
uvec4(3)
uvec4(4)
\ No newline at end of file