From d5d2f7606389a2ba9d27e23899c0ded782eb7559 Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Tue, 7 Jun 2016 06:06:01 -0600 Subject: layers: Add PSO render pass compability check At draw time, the active render pass must be compatible with the render pass that the gfx pipeline was created with. --- layers/core_validation.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'layers/core_validation.cpp') diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 29703f65..b4d8e510 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -2151,7 +2151,7 @@ static bool attachment_references_compatible(const uint32_t index, const VkAttac } // For give primary and secondary RenderPass objects, verify that they're compatible -static bool verify_renderpass_compatibility(layer_data *my_data, const VkRenderPass primaryRP, const VkRenderPass secondaryRP, +static bool verify_renderpass_compatibility(const layer_data *my_data, const VkRenderPass primaryRP, const VkRenderPass secondaryRP, string &errorMsg) { auto primary_render_pass = getRenderPass(my_data, primaryRP); auto secondary_render_pass = getRenderPass(my_data, secondaryRP); @@ -2849,6 +2849,21 @@ static bool validatePipelineDrawtimeState(layer_data const *my_data, reinterpret_cast(pPipeline->pipeline)); } } + // Verify that PSO creation renderPass is compatible with active renderPass + if (pCB->activeRenderPass) { + std::string err_string; + if (!verify_renderpass_compatibility(my_data, pCB->activeRenderPass->renderPass, pPipeline->graphicsPipelineCI.renderPass, + err_string)) { + // renderPass that PSO was created with must be compatible with active renderPass that PSO is being used with + skip_call |= + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, + reinterpret_cast(pPipeline->pipeline), __LINE__, DRAWSTATE_RENDERPASS_INCOMPATIBLE, "DS", + "At Draw time the active render pass (0x%" PRIxLEAST64 ") is incompatible w/ gfx pipeline " + "(0x%" PRIxLEAST64 ") that was created w/ render pass (0x%" PRIxLEAST64 ") due to: %s", + reinterpret_cast(pCB->activeRenderPass->renderPass), reinterpret_cast(pPipeline), + reinterpret_cast(pPipeline->graphicsPipelineCI.renderPass), err_string.c_str()); + } + } // TODO : Add more checks here return skip_call; -- cgit v1.2.3