Mesa (master): v3dv: allow a component swizzle in copy_buffer_to_image_shader

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 5 12:41:22 UTC 2021


Module: Mesa
Branch: master
Commit: c72d99550c88434243c4ea58b777ff52f8b58fe1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c72d99550c88434243c4ea58b777ff52f8b58fe1

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Fri Feb  5 11:36:42 2021 +0100

v3dv: allow a component swizzle in copy_buffer_to_image_shader

This is trivial because this path relies on our blit_shader interface
which supports this already, so it just needs to pass it along.

I don't think this is ever triggered practice, since we should be
able to handle any case that could require this with the texel buffer
path, but at least it allows us to simplify a bit the code.

Tested by  manually disabling the priority paths to ensure we exercise
component swizzles with this path.

Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8875>

---

 src/broadcom/vulkan/v3dv_meta_copy.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/src/broadcom/vulkan/v3dv_meta_copy.c b/src/broadcom/vulkan/v3dv_meta_copy.c
index cedc5cd26dc..08d6ca1278c 100644
--- a/src/broadcom/vulkan/v3dv_meta_copy.c
+++ b/src/broadcom/vulkan/v3dv_meta_copy.c
@@ -3597,6 +3597,7 @@ copy_buffer_to_image_blit(struct v3dv_cmd_buffer *cmd_buffer,
                           struct v3dv_buffer *buffer,
                           uint32_t buffer_bpp,
                           VkColorComponentFlags cmask,
+                          VkComponentMapping *cswizzle,
                           uint32_t region_count,
                           const VkBufferImageCopy *regions)
 {
@@ -3804,7 +3805,7 @@ copy_buffer_to_image_blit(struct v3dv_cmd_buffer *cmd_buffer,
          handled = blit_shader(cmd_buffer,
                                image, dst_format,
                                v3dv_image_from_handle(buffer_image), src_format,
-                               cmask, NULL,
+                               cmask, cswizzle,
                                &blit_region, VK_FILTER_NEAREST, true);
          if (!handled) {
             /* This is unexpected, we should have a supported blit spec */
@@ -3940,18 +3941,10 @@ copy_buffer_to_image_shader(struct v3dv_cmd_buffer *cmd_buffer,
                                       cmask, &cswizzle,
                                       region_count, regions);
    } else {
-      /* This path doesn't know about source swizzling. It should be easy
-       * to add since it ends up using the blit shader interface, which
-       * has support for that, but we only require this for combined D/S
-       * copies and we can handle that with the texel buffer path, so
-       * there is really no need to support it here.
-       */
-      if (memcmp(&cswizzle, &ident_swizzle, sizeof(cswizzle)))
-         return false;
-
       return copy_buffer_to_image_blit(cmd_buffer, aspect, image,
                                        dst_format, src_format,
-                                       buffer, buf_bpp, cmask,
+                                       buffer, buf_bpp,
+                                       cmask, &cswizzle,
                                        region_count, regions);
    }
 }



More information about the mesa-commit mailing list