Mesa (master): turnip: fix CmdBlitImage with D32_SFLOAT_S8_UINT

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Aug 14 14:04:20 UTC 2020


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

Author: Jonathan Marek <jonathan at marek.ca>
Date:   Thu Aug 13 13:37:49 2020 -0400

turnip: fix CmdBlitImage with D32_SFLOAT_S8_UINT

Fixes these dEQP tests:

dEQP-VK.api.copy_and_blit.core.blit_image.all_formats.depth_stencil.2d_d32_sfloat_s8_uint_d32_sfloat_s8_uint.*

Signed-off-by: Jonathan Marek <jonathan at marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6304>

---

 src/freedreno/vulkan/tu_clear_blit.c | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/src/freedreno/vulkan/tu_clear_blit.c b/src/freedreno/vulkan/tu_clear_blit.c
index 4082d3e21dd..15a984a9c12 100644
--- a/src/freedreno/vulkan/tu_clear_blit.c
+++ b/src/freedreno/vulkan/tu_clear_blit.c
@@ -1050,7 +1050,20 @@ tu6_blit_image(struct tu_cmd_buffer *cmd,
        filter == VK_FILTER_CUBIC_EXT)
       ops = &r3d_ops;
 
-   ops->setup(cmd, cs, dst_image->vk_format, info->dstSubresource.aspectMask,
+   /* use the right format in setup() for D32_S8
+    * TODO: this probably should use a helper
+    */
+   VkFormat format = dst_image->vk_format;
+   if (format == VK_FORMAT_D32_SFLOAT_S8_UINT) {
+      if (info->dstSubresource.aspectMask == VK_IMAGE_ASPECT_DEPTH_BIT)
+         format = VK_FORMAT_D32_SFLOAT;
+      else if (info->dstSubresource.aspectMask == VK_IMAGE_ASPECT_STENCIL_BIT)
+         format = VK_FORMAT_S8_UINT;
+      else
+         unreachable("unexpected D32_S8 aspect mask in blit_image");
+   }
+
+   ops->setup(cmd, cs, format, info->dstSubresource.aspectMask,
               rotate[mirror_y][mirror_x], false, dst_image->layout[0].ubwc);
 
    if (ops == &r3d_ops) {
@@ -1104,8 +1117,23 @@ tu_CmdBlitImage(VkCommandBuffer commandBuffer,
    tu_bo_list_add(&cmd->bo_list, src_image->bo, MSM_SUBMIT_BO_READ);
    tu_bo_list_add(&cmd->bo_list, dst_image->bo, MSM_SUBMIT_BO_WRITE);
 
-   for (uint32_t i = 0; i < regionCount; ++i)
+   for (uint32_t i = 0; i < regionCount; ++i) {
+      /* can't blit both depth and stencil at once with D32_S8
+       * TODO: more advanced 3D blit path to support it instead?
+       */
+      if (src_image->vk_format == VK_FORMAT_D32_SFLOAT_S8_UINT ||
+          dst_image->vk_format == VK_FORMAT_D32_SFLOAT_S8_UINT) {
+         VkImageBlit region = pRegions[i];
+         uint32_t b;
+         for_each_bit(b, pRegions[i].dstSubresource.aspectMask) {
+            region.srcSubresource.aspectMask = BIT(b);
+            region.dstSubresource.aspectMask = BIT(b);
+            tu6_blit_image(cmd, src_image, dst_image, &region, filter);
+         }
+         continue;
+      }
       tu6_blit_image(cmd, src_image, dst_image, pRegions + i, filter);
+   }
 }
 
 static void



More information about the mesa-commit mailing list