aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp35
1 files changed, 24 insertions, 11 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index f3f2e0a9..8eec89f1 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -9062,20 +9062,33 @@ static bool ValidateLayouts(const layer_data *my_data, VkDevice device, const Vk
attach_first_use[attach_index] = false;
}
if ((subpass.pDepthStencilAttachment != NULL) && (subpass.pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED)) {
- if (subpass.pDepthStencilAttachment->layout != VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL) {
- if (subpass.pDepthStencilAttachment->layout == VK_IMAGE_LAYOUT_GENERAL) {
- // TODO: Verify Valid Use in spec. I believe this is allowed (valid) but may not be optimal performance
- skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT,
- (VkDebugReportObjectTypeEXT)0, 0, __LINE__, DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS",
- "Layout for depth attachment is GENERAL but should be DEPTH_STENCIL_ATTACHMENT_OPTIMAL.");
- } else {
- skip |=
- log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
+ switch (subpass.pDepthStencilAttachment->layout) {
+ case VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL:
+ case VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL:
+ /* These are ideal. */
+ break;
+
+ case VK_IMAGE_LAYOUT_GENERAL:
+ /* May not be optimal; TODO: reconsider this warning based on
+ * other constraints? GENERAL can be better than doing a bunch
+ * of transitions.
+ */
+ skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT,
+ VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__,
DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS",
- "Layout for depth attachment is %s but can only be DEPTH_STENCIL_ATTACHMENT_OPTIMAL or GENERAL.",
+ "GENERAL layout for depth attachment may not give optimal performance.");
+ break;
+
+ default:
+ /* No other layouts are acceptable */
+ skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__,
+ DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS",
+ "Layout for depth attachment is %s but can only be DEPTH_STENCIL_ATTACHMENT_OPTIMAL, "
+ "DEPTH_STENCIL_READ_ONLY_OPTIMAL or GENERAL.",
string_VkImageLayout(subpass.pDepthStencilAttachment->layout));
- }
}
+
auto attach_index = subpass.pDepthStencilAttachment->attachment;
if (attach_first_use[attach_index]) {
skip |= ValidateLayoutVsAttachmentDescription(my_data->report_data, subpass.pDepthStencilAttachment->layout,