From e1235a55b63e520235558d40cdb430c1f32d6cc4 Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Tue, 17 Nov 2015 15:11:24 -0700 Subject: layers: Fix invalid depth/stencil attachment index validation Was validating against color attachment index instead of attachment index for depth/stencil ClearAttachment calls. --- layers/draw_state.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'layers/draw_state.cpp') diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index 57307502..21c6c94d 100644 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -3186,14 +3186,16 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments( attachment->colorAttachment, pCB->activeSubpass); } } else if (attachment->aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) { - /* TODO: Is this a good test for depth/stencil? */ - if (!pSD->pDepthStencilAttachment || pSD->pDepthStencilAttachment->attachment != attachment->colorAttachment) { + if (!pSD->pDepthStencilAttachment || // Says no DS will be used in active subpass + (pSD->pDepthStencilAttachment->attachment == VK_ATTACHMENT_UNUSED) || // Says no DS will be used in active subpass + (pSD->pDepthStencilAttachment->attachment != attachment_idx )) { // AttachmentIndex doesn't match subpass index + skipCall |= log_msg(dev_data->report_data, VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER, - (uint64_t)commandBuffer, 0, DRAWSTATE_MISSING_ATTACHMENT_REFERENCE, "DS", - "vkCmdClearAttachments() attachment index %d does not match depthStencilAttachment.attachment (%d) found in active subpass %d", - attachment->colorAttachment, - (pSD->pDepthStencilAttachment) ? pSD->pDepthStencilAttachment->attachment : VK_ATTACHMENT_UNUSED, - pCB->activeSubpass); + (uint64_t)commandBuffer, 0, DRAWSTATE_MISSING_ATTACHMENT_REFERENCE, "DS", + "vkCmdClearAttachments() attachment index %d does not match depthStencilAttachment.attachment (%d) found in active subpass %d", + attachment->colorAttachment, + (pSD->pDepthStencilAttachment) ? pSD->pDepthStencilAttachment->attachment : VK_ATTACHMENT_UNUSED, + pCB->activeSubpass); } } } -- cgit v1.2.3