Module: Mesa Branch: main Commit: 1c619b668d69c66521d1da8edd97e518d6d61857 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1c619b668d69c66521d1da8edd97e518d6d61857
Author: Karol Herbst <[email protected]> Date: Sun Oct 22 21:50:35 2023 +0200 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: 46e0c77582d ("radv: implement VK_EXT_descriptor_buffer") Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Georg Lehmann <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25837> --- src/amd/vulkan/radv_descriptor_set.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c index 979ea00ab69..a0aa0673fe5 100644 --- a/src/amd/vulkan/radv_descriptor_set.c +++ b/src/amd/vulkan/radv_descriptor_set.c @@ -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);
