From 5a4c5f46c771217d0dcf8cb14a9525c486e6e0fe Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Tue, 12 Jul 2022 11:02:15 +0200 Subject: [PATCH] v3dv: fix comment in texel buffer shader copy path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using the texel buffer copy path to copy a buffer we need to sample from the buffer and for that we need a texture shader state record where we specify the base offset of the texture (the buffer). If the copy operation has a start offset we can't add that offset to the base address of the buffer because the texture state record requires the base pointer to be 64-byte aligned, so it would only work for offsets that are multiple of 64B. Instead, we pass the offset (in elements) to the shader and we use that to shift the indices into the buffer when selecting the source texel to copy. Reviewed-by: Alejandro PiƱeiro Part-of: --- src/broadcom/vulkan/v3dv_meta_copy.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_meta_copy.c b/src/broadcom/vulkan/v3dv_meta_copy.c index 6739df24942..1af5c3d8d16 100644 --- a/src/broadcom/vulkan/v3dv_meta_copy.c +++ b/src/broadcom/vulkan/v3dv_meta_copy.c @@ -2057,13 +2057,10 @@ texel_buffer_shader_copy(struct v3dv_cmd_buffer *cmd_buffer, if (result != VK_SUCCESS) return handled; - /* FIXME: for some reason passing region->bufferOffset here for the - * offset field doesn't work, making the following CTS tests fail: - * - * dEQP-VK.api.copy_and_blit.core.buffer_to_image.*buffer_offset* - * - * So instead we pass 0 here and we pass the offset in texels as a push - * constant to the shader, which seems to work correctly. + /* We can't pass region->bufferOffset here for the offset field because + * the texture base pointer in the texture shader state must be a 64-byte + * aligned value. Instead, we use 0 here and we pass the offset in texels + * as a push constant to the shader. */ VkDevice _device = v3dv_device_to_handle(cmd_buffer->device); VkBufferViewCreateInfo buffer_view_info = {