Mesa (staging/21.3): anv: allow VK_IMAGE_LAYOUT_UNDEFINED as final layout

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Dec 6 20:33:25 UTC 2021


Module: Mesa
Branch: staging/21.3
Commit: 88a4d6993b02cb8f59593117d2b063a3249dd5dc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=88a4d6993b02cb8f59593117d2b063a3249dd5dc

Author: Tapani Pälli <tapani.palli at intel.com>
Date:   Thu Dec  2 10:44:10 2021 +0200

anv: allow VK_IMAGE_LAYOUT_UNDEFINED as final layout

>From VK_KHR_synchronization2:
   "Image memory barriers that do not perform an image layout
    transition can be specified by setting oldLayout equal to
    newLayout.

    E.g. the old and new layout can both be set to
    VK_IMAGE_LAYOUT_UNDEFINED, without discarding data in the
    image."

v2: make assert more readable (Lionel Landwerlin)

Cc: mesa-stable
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14008>
(cherry picked from commit d44d2e823f6fae31bff5876835717b64149414c2)

---

 .pick_status.json                  | 2 +-
 src/intel/vulkan/genX_cmd_buffer.c | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index a4b6bc79e62..4916842deeb 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -967,7 +967,7 @@
         "description": "anv: allow VK_IMAGE_LAYOUT_UNDEFINED as final layout",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index c884440e9ad..495938989cd 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -1179,9 +1179,12 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,
    UNUSED const uint32_t image_layers = MAX2(image->vk.array_layers, max_depth);
    assert((uint64_t)base_layer + layer_count  <= image_layers);
    assert(last_level_num <= image->vk.mip_levels);
-   /* The spec disallows these final layouts. */
-   assert(final_layout != VK_IMAGE_LAYOUT_UNDEFINED &&
-          final_layout != VK_IMAGE_LAYOUT_PREINITIALIZED);
+   /* If there is a layout transfer, the final layout cannot be undefined or
+    * preinitialized (VUID-VkImageMemoryBarrier-newLayout-01198).
+    */
+   assert(initial_layout == final_layout ||
+          (final_layout != VK_IMAGE_LAYOUT_UNDEFINED &&
+           final_layout != VK_IMAGE_LAYOUT_PREINITIALIZED));
    const struct isl_drm_modifier_info *isl_mod_info =
       image->vk.tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT
       ? isl_drm_modifier_get_info(image->vk.drm_format_mod)



More information about the mesa-commit mailing list