aboutsummaryrefslogtreecommitdiff
path: root/layers/descriptor_sets.cpp
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2016-10-10 14:02:48 -0600
committerTobin Ehlis <tobine@google.com>2016-10-11 21:37:55 -0600
commit34abf2be930f2230dcb111dd69aaa2fd31be0550 (patch)
tree283ce17ad5bcb5576a29c424b5f06f9a0541c70e /layers/descriptor_sets.cpp
parentd322ff06db2fb6432cca90d445debde0215ed221 (diff)
downloadusermoji-34abf2be930f2230dcb111dd69aaa2fd31be0550.tar.xz
layers: Validate correct layout for STORAGE_IMAGE descriptors
According to the spec "Load and store operations on storage images can only be done on images in VK_IMAGE_LAYOUT_GENERAL layout." This change flags an error if a STORAGE_IMAGE descriptor is updated with an image layout other than GENERAL.
Diffstat (limited to 'layers/descriptor_sets.cpp')
-rw-r--r--layers/descriptor_sets.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp
index 4af5674b..82e693d0 100644
--- a/layers/descriptor_sets.cpp
+++ b/layers/descriptor_sets.cpp
@@ -796,6 +796,7 @@ bool cvdescriptorset::ValidateImageUpdate(VkImageView image_view, VkImageLayout
break;
}
// Now validate that usage flags are correctly set for given type of update
+ // As we're switching per-type, if any type has specific layout requirements, check those here as well
// TODO : The various image usage bit requirements are in general spec language for VkImageUsageFlags bit block in 11.3 Images
// under vkCreateImage()
// TODO : Need to also validate case VALIDATION_ERROR_00952 where STORAGE_IMAGE & INPUT_ATTACH types must have been created with
@@ -812,6 +813,15 @@ bool cvdescriptorset::ValidateImageUpdate(VkImageView image_view, VkImageLayout
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: {
if (!(usage & VK_IMAGE_USAGE_STORAGE_BIT)) {
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;
}
break;
}