layers: Don't insist on memory dependency for present
When transitioning to/from VK_IMAGE_LAYOUT_PRESENT_SRC_KHR we don't need
to insist on VK_ACCESS_MEMORY_READ_BIT. On the transition TO, it's
automatically handled; in the transition FROM, it's a WAR hazard rather
than RAW/WAW so only the execution dependency is needed.
Fixes #1717.
diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp
index ec8016f..d5b15cb 100644
--- a/layers/buffer_validation.cpp
+++ b/layers/buffer_validation.cpp
@@ -2078,10 +2078,6 @@
skip |= ValidateMaskBits(device_data, cmdBuffer, accessMask, layout, VK_ACCESS_TRANSFER_READ_BIT, 0, type);
break;
}
- case VK_IMAGE_LAYOUT_PRESENT_SRC_KHR: {
- skip |= ValidateMaskBits(device_data, cmdBuffer, accessMask, layout, VK_ACCESS_MEMORY_READ_BIT, 0, type);
- break;
- }
case VK_IMAGE_LAYOUT_UNDEFINED: {
if (accessMask != 0) {
// TODO: Verify against Valid Use section spec
@@ -2092,6 +2088,17 @@
}
break;
}
+ case VK_IMAGE_LAYOUT_PRESENT_SRC_KHR:
+ // Notes: QueuePresentKHR performs automatic visibility operations,
+ // so the app is /NOT/ required to include VK_ACCESS_MEMORY_READ_BIT
+ // when transitioning to this layout.
+ //
+ // When transitioning /from/ this layout, the application needs to
+ // avoid only a WAR hazard -- any writes need to be ordered after
+ // the PE's reads. There is no need for a memory dependency for this
+ // case.
+ /* fallthrough */
+
case VK_IMAGE_LAYOUT_GENERAL:
default: { break; }
}