From ccaed44dc376d964fb98d51d2136132fa9a2f158 Mon Sep 17 00:00:00 2001 From: Slawomir Cygan Date: Tue, 24 Apr 2018 17:18:26 +0200 Subject: [PATCH] core validation: extend CLEAR LOAD_OP check to new DS image layouts Extend check for load operation vs first time use image layout to new read-only depth stencil image layouts. The new layouts were added in VK_KHR_maintenance2 / Vulkan 1.1 and follow similar restrictions to VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL. Spec: " For any member of pAttachments with a loadOp equal to VK_ATTACHMENT_LOAD_OP_CLEAR, the first use of that attachment must not specify a layout equal to VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL. For any member of pAttachments with a stencilLoadOp equal to VK_ATTACHMENT_LOAD_OP_CLEAR, the first use of that attachment must not specify a layout equal to VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL. " --- layers/buffer_validation.cpp | 15 +++++++++++++++ layers/vk_validation_error_database.txt | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp index ca1f57c..d6f8786 100644 --- a/layers/buffer_validation.cpp +++ b/layers/buffer_validation.cpp @@ -2824,6 +2824,21 @@ bool ValidateLayoutVsAttachmentDescription(const debug_report_data *report_data, string_VkImageLayout(first_layout)); } } + if (attachment_description.loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR) { + if (first_layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) { + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + VALIDATION_ERROR_12200c3c, "Cannot clear attachment %d with invalid first layout %s.", attachment, + string_VkImageLayout(first_layout)); + } + } + + if (attachment_description.stencilLoadOp == VK_ATTACHMENT_LOAD_OP_CLEAR) { + if (first_layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL) { + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + VALIDATION_ERROR_12200c3e, "Cannot clear attachment %d with invalid first layout %s.", attachment, + string_VkImageLayout(first_layout)); + } + } return skip; } diff --git a/layers/vk_validation_error_database.txt b/layers/vk_validation_error_database.txt index 7cd87d3..7631cbc 100644 --- a/layers/vk_validation_error_database.txt +++ b/layers/vk_validation_error_database.txt @@ -1278,8 +1278,8 @@ VALIDATION_ERROR_12200686~^~N~^~Unknown~^~VkRenderPassCreateInfo~^~VUID-VkRender VALIDATION_ERROR_12200688~^~Y~^~Unknown~^~VkRenderPassCreateInfo~^~VUID-VkRenderPassCreateInfo-pAttachments-00836~^~core~^~The spec valid usage text states 'For any member of pAttachments with a loadOp equal to VK_ATTACHMENT_LOAD_OP_CLEAR, the first use of that attachment must not specify a layout equal to VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL or VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL.' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkRenderPassCreateInfo-pAttachments-00836)~^~ VALIDATION_ERROR_1220068a~^~N~^~Unknown~^~VkRenderPassCreateInfo~^~VUID-VkRenderPassCreateInfo-pDependencies-00837~^~core~^~The spec valid usage text states 'For any element of pDependencies, if the srcSubpass is not VK_SUBPASS_EXTERNAL, all stage flags included in the srcStageMask member of that dependency must be a pipeline stage supported by the pipeline identified by the pipelineBindPoint member of the source subpass.' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkRenderPassCreateInfo-pDependencies-00837)~^~ VALIDATION_ERROR_1220068c~^~N~^~Unknown~^~VkRenderPassCreateInfo~^~VUID-VkRenderPassCreateInfo-pDependencies-00838~^~core~^~The spec valid usage text states 'For any element of pDependencies, if the dstSubpass is not VK_SUBPASS_EXTERNAL, all stage flags included in the dstStageMask member of that dependency must be a pipeline stage supported by the pipeline identified by the pipelineBindPoint member of the source subpass.' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-VkRenderPassCreateInfo-pDependencies-00838)~^~ -VALIDATION_ERROR_12200c3c~^~N~^~None~^~VkRenderPassCreateInfo~^~VUID-VkRenderPassCreateInfo-pAttachments-01566~^~(VK_VERSION_1_1,VK_KHR_maintenance2)~^~The spec valid usage text states 'For any member of pAttachments with a loadOp equal to VK_ATTACHMENT_LOAD_OP_CLEAR, the first use of that attachment must not specify a layout equal to VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkRenderPassCreateInfo-pAttachments-01566)~^~ -VALIDATION_ERROR_12200c3e~^~N~^~None~^~VkRenderPassCreateInfo~^~VUID-VkRenderPassCreateInfo-pAttachments-01567~^~(VK_VERSION_1_1,VK_KHR_maintenance2)~^~The spec valid usage text states 'For any member of pAttachments with a stencilLoadOp equal to VK_ATTACHMENT_LOAD_OP_CLEAR, the first use of that attachment must not specify a layout equal to VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkRenderPassCreateInfo-pAttachments-01567)~^~ +VALIDATION_ERROR_12200c3c~^~Y~^~None~^~VkRenderPassCreateInfo~^~VUID-VkRenderPassCreateInfo-pAttachments-01566~^~(VK_VERSION_1_1,VK_KHR_maintenance2)~^~The spec valid usage text states 'For any member of pAttachments with a loadOp equal to VK_ATTACHMENT_LOAD_OP_CLEAR, the first use of that attachment must not specify a layout equal to VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkRenderPassCreateInfo-pAttachments-01566)~^~ +VALIDATION_ERROR_12200c3e~^~Y~^~None~^~VkRenderPassCreateInfo~^~VUID-VkRenderPassCreateInfo-pAttachments-01567~^~(VK_VERSION_1_1,VK_KHR_maintenance2)~^~The spec valid usage text states 'For any member of pAttachments with a stencilLoadOp equal to VK_ATTACHMENT_LOAD_OP_CLEAR, the first use of that attachment must not specify a layout equal to VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkRenderPassCreateInfo-pAttachments-01567)~^~ VALIDATION_ERROR_12200f0c~^~N~^~None~^~VkRenderPassCreateInfo~^~VUID-VkRenderPassCreateInfo-pNext-01926~^~(VK_VERSION_1_1,VK_KHR_maintenance2)~^~The spec valid usage text states 'If the pNext chain includes an instance of VkRenderPassInputAttachmentAspectCreateInfo, the subpass member of each element of its pAspectReferences member must be less than subpassCount' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkRenderPassCreateInfo-pNext-01926)~^~ VALIDATION_ERROR_12200f0e~^~N~^~None~^~VkRenderPassCreateInfo~^~VUID-VkRenderPassCreateInfo-pNext-01927~^~(VK_VERSION_1_1,VK_KHR_maintenance2)~^~The spec valid usage text states 'If the pNext chain includes an instance of VkRenderPassInputAttachmentAspectCreateInfo, the inputAttachmentIndex member of each element of its pAspectReferences member must be less than the value of inputAttachmentCount in the member of pSubpasses identified by its subpass member' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkRenderPassCreateInfo-pNext-01927)~^~ VALIDATION_ERROR_12200f10~^~N~^~None~^~VkRenderPassCreateInfo~^~VUID-VkRenderPassCreateInfo-pNext-01928~^~(VK_VERSION_1_1,VK_KHR_multiview)~^~The spec valid usage text states 'If the pNext chain includes an instance of VkRenderPassMultiviewCreateInfo, and its subpassCount member is not zero, that member must be equal to the value of subpassCount' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VUID-VkRenderPassCreateInfo-pNext-01928)~^~ -- 2.7.4