Mesa (main): anv: allow VK_IMAGE_LAYOUT_UNDEFINED as final layout
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Dec 3 09:29:57 UTC 2021
Module: Mesa
Branch: main
Commit: d44d2e823f6fae31bff5876835717b64149414c2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d44d2e823f6fae31bff5876835717b64149414c2
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>
---
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)
More information about the mesa-commit
mailing list