layers: Add relaxed image layout matching rules
For descriptor accessed images, implement additional logic supporting
depth only and stencil only usage relaxed layout matching rules.
Change-Id: I7dc2160882d6d7994aaf3d47163be2110ff597a8
diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp
index 3fee2fa..37de111 100644
--- a/layers/buffer_validation.cpp
+++ b/layers/buffer_validation.cpp
@@ -1048,8 +1048,9 @@
}
bool CoreChecks::VerifyImageLayout(GLOBAL_CB_NODE const *cb_node, IMAGE_STATE *image_state, const VkImageSubresourceRange &range,
- VkImageLayout explicit_layout, VkImageLayout optimal_layout, const char *caller,
- const char *layout_invalid_msg_code, const char *layout_mismatch_msg_code, bool *error) {
+ VkImageAspectFlags aspect_mask, VkImageLayout explicit_layout, VkImageLayout optimal_layout,
+ const char *caller, const char *layout_invalid_msg_code, const char *layout_mismatch_msg_code,
+ bool *error) {
assert(cb_node);
assert(image_state);
const auto image = image_state->image;
@@ -1058,9 +1059,9 @@
const auto *subresource_map = GetImageSubresourceLayoutMap(cb_node, image);
if (subresource_map) {
bool subres_skip = false;
- auto subresource_cb = [this, explicit_layout, cb_node, layout_mismatch_msg_code, caller, image, &error, &subres_skip](
- const VkImageSubresource &subres, VkImageLayout layout, VkImageLayout initial_layout) {
- LayoutUseCheckAndMessage layout_check(explicit_layout, layout, initial_layout);
+ auto subresource_cb = [this, explicit_layout, cb_node, layout_mismatch_msg_code, caller, image, aspect_mask, &error,
+ &subres_skip](const VkImageSubresource &subres, VkImageLayout layout, VkImageLayout initial_layout) {
+ LayoutUseCheckAndMessage layout_check(explicit_layout, layout, initial_layout, aspect_mask);
if (layout_check.CheckFailed()) {
*error = true;
subres_skip |=