summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2021-12-02 10:44:10 +0200
committerEric Engestrom <eric@engestrom.ch>2021-12-17 22:30:48 +0000
commit0025ef9880e444cc8371048a76ff8f1a868b4ab3 (patch)
treeaac89d59ae3c94ff6ec187900519f2659430ce61
parent04ccbf5fead10904836aa504079c4c92bbe16c20 (diff)
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@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14008> (cherry picked from commit d44d2e823f6fae31bff5876835717b64149414c2)
-rw-r--r--.pick_status.json2
-rw-r--r--src/intel/vulkan/genX_cmd_buffer.c9
2 files changed, 7 insertions, 4 deletions
diff --git a/.pick_status.json b/.pick_status.json
index ace3158746e..9d8d58a5962 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4801,7 +4801,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)