radv: fix buffers in vkGetDescriptorEXT with size not aligned to 4

The range alignment didn't happen through GetDescriptorEXT as it called
write_buffer_descriptor directly. So simply move the align
from write_buffer_descriptor_impl into write_buffer_descriptor.

Fixes: 46e0c77582 ("radv: implement VK_EXT_descriptor_buffer")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25837>
This commit is contained in:
Karol Herbst 2023-10-22 21:50:35 +02:00 committed by Marge Bot
parent 01b6ccccc6
commit 1c619b668d

View file

@ -1095,7 +1095,11 @@ write_buffer_descriptor(struct radv_device *device, unsigned *dst, uint64_t va,
dst[0] = va;
dst[1] = S_008F04_BASE_ADDRESS_HI(va >> 32);
dst[2] = range;
/* robustBufferAccess is relaxed enough to allow this (in combination with the alignment/size
* we return from vkGetBufferMemoryRequirements) and this allows the shader compiler to create
* more efficient 8/16-bit buffer accesses.
*/
dst[2] = align(range, 4);
dst[3] = rsrc_word3;
}
@ -1111,12 +1115,6 @@ write_buffer_descriptor_impl(struct radv_device *device, struct radv_cmd_buffer
range = vk_buffer_range(&buffer->vk, buffer_info->offset, buffer_info->range);
assert(buffer->vk.size > 0 && range > 0);
/* robustBufferAccess is relaxed enough to allow this (in combination with the alignment/size
* we return from vkGetBufferMemoryRequirements) and this allows the shader compiler to create
* more efficient 8/16-bit buffer accesses.
*/
range = align(range, 4);
}
write_buffer_descriptor(device, dst, va, range);