From d75effecdfce7deda2829ba474383e31dd2d1afd Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Thu, 8 Sep 2016 17:55:54 +1200 Subject: [PATCH] layers: Require VkGraphicsPipelineCreateInfo::pDepthStencilState If the subpass uses a depth/stencil attachment and rasterization is not disabled, then this structure must be present. Signed-off-by: Chris Forbes --- layers/core_validation.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 2124b67..3b73f27 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -3425,6 +3425,20 @@ static bool verifyPipelineCreateState(layer_data *my_data, const VkDevice device } } } + + // If rasterization is not disabled, and subpass uses a depth/stencil + // attachment, pDepthStencilState must be a pointer to a valid structure + auto subpass_desc = renderPass ? &renderPass->pCreateInfo->pSubpasses[pPipeline->graphicsPipelineCI.subpass] : nullptr; + if (subpass_desc && subpass_desc->pDepthStencilAttachment && + subpass_desc->pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) { + if (!pPipeline->graphicsPipelineCI.pDepthStencilState) { + skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + __LINE__, DRAWSTATE_INVALID_PIPELINE_CREATE_STATE, "DS", + "Invalid Pipeline CreateInfo State: " + "pDepthStencilState is NULL when rasterization is enabled and subpass uses a " + "depth/stencil attachment"); + } + } } return skip_call; } -- 2.7.4