From ad190dca307a079766a6f558ddda4e2774b2c136 Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Thu, 11 May 2017 08:52:51 -0600 Subject: layers: Validate shared presentable image cases Add validation support for shared presentable images as defined in VK_KHR_shared_presentable_image extension. For all uses of shared presentable images, make sure that the image is appropriately in VK_IMAGE_LAYOUT_PRESENT_SRC_KHR layout. For two cases where no layout validation was performed, added a TODO note (vkCmdBlitImage, vkCmdResolveImage) as basic layout validation should first be added upstream. Also locked the layout in the case where a front-buffered image is presented and then flag an error if an attempt is made to transition the image layout after that point. Change-Id: I06cda727e3a7f56ccff4bffd7503b5ff73e8a795 --- layers/descriptor_sets.cpp | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'layers/descriptor_sets.cpp') diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp index 3539a831..c36831a3 100644 --- a/layers/descriptor_sets.cpp +++ b/layers/descriptor_sets.cpp @@ -895,14 +895,29 @@ bool cvdescriptorset::ValidateImageUpdate(VkImageView image_view, VkImageLayout error_usage_bit = "VK_IMAGE_USAGE_STORAGE_BIT"; } else if (VK_IMAGE_LAYOUT_GENERAL != image_layout) { std::stringstream error_str; - // TODO : Need to create custom enum error code for this case - error_str - << "ImageView (" << image_view << ") of VK_DESCRIPTOR_TYPE_STORAGE_IMAGE type is being updated with layout " - << string_VkImageLayout(image_layout) - << " but according to spec section 13.1 Descriptor Types, 'Load and store operations on storage images can " - "only be done on images in VK_IMAGE_LAYOUT_GENERAL layout.'"; - *error_msg = error_str.str(); - return false; + // TODO : Need to create custom enum error codes for these cases + if (image_node->shared_presentable) { + if (VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR != image_layout) { + error_str + << "ImageView (" << image_view + << ") of VK_DESCRIPTOR_TYPE_STORAGE_IMAGE type with a front-buffered image is being updated with " + "layout " + << string_VkImageLayout(image_layout) + << " but according to spec section 13.1 Descriptor Types, 'Front-buffered images that report support " + "for " + "VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT must be in the VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR layout.'"; + *error_msg = error_str.str(); + return false; + } + } else if (VK_IMAGE_LAYOUT_GENERAL != image_layout) { + error_str + << "ImageView (" << image_view << ") of VK_DESCRIPTOR_TYPE_STORAGE_IMAGE type is being updated with layout " + << string_VkImageLayout(image_layout) + << " but according to spec section 13.1 Descriptor Types, 'Load and store operations on storage images can " + "only be done on images in VK_IMAGE_LAYOUT_GENERAL layout.'"; + *error_msg = error_str.str(); + return false; + } } break; } -- cgit v1.2.3