From d44d2e823f6fae31bff5876835717b64149414c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Thu, 2 Dec 2021 10:44:10 +0200 Subject: [PATCH] anv: allow VK_IMAGE_LAYOUT_UNDEFINED as final layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/genX_cmd_buffer.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 23b431eb1ad..186485ba78a 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -1160,9 +1160,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)