DescriptorHeapVulkan: buffer region misplaced when image and buffer descriptor sizes do not divide evenly (latent) #163
Labels
No labels
claude:blocked
claude:done
claude:failed
claude:in-progress
claude:ready
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Catcrafts/Crafter.Graphics#163
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
DescriptorHeapVulkan::Initializeplaces the buffer-descriptor region with an integer division that only works when the image region's byte size is a multiple of the buffer descriptor size. Where it is not, the buffer region overlaps the last image descriptor, or the heap is allocated too small. This is latent: the two drivers I could check have sizes that divide evenly.Line numbers refer to
interfaces/Crafter.Graphics-DescriptorHeapVulkan.cppmat6aa0338.The arithmetic (
:43-52)Two ways this goes wrong:
images * imageDescriptorSizeis not a multiple ofbufferDescriptorSize, the division rounds down andbufferStartOffsetlands inside the image region. Example: image size 24, buffer size 16, 1 image → buffers start at byte 16, the image descriptor occupies bytes 0-23.images * imageDescriptorSize < bufferDescriptorSize, the element is forced to 1, so buffers start atbufferDescriptorSize. The heap size was computed fromdescriptorRegion, which assumed buffers start right after the images. Example: image size 32, buffer size 64, 1 image, 4 buffers → region is 288 bytes, but the buffers occupy bytes 64-319. The tail runs into alignment padding or the reserved range.bufferDescriptorAlignmentis not considered at all.GetBufferOffset/GetBufferOffsetElement(:161-177) repeat the same rounding.Drivers checked
RADV and ANV were not checked. The extension does not promise that one size divides the other.
Suggested fix
Round the start up and size the heap from it:
and make the two static helpers share that code.