aboutsummaryrefslogtreecommitdiff
path: root/layers/draw_state.cpp
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2015-11-17 15:11:24 -0700
committerMark Lobodzinski <mark@lunarg.com>2015-11-17 15:11:24 -0700
commite1235a55b63e520235558d40cdb430c1f32d6cc4 (patch)
tree59fbc0d9b5d82e9f16b730a72c9ba86350553c70 /layers/draw_state.cpp
parent462bd043ab02a4cac8664dabd813210c2f9b1cc4 (diff)
downloadusermoji-e1235a55b63e520235558d40cdb430c1f32d6cc4.tar.xz
layers: Fix invalid depth/stencil attachment index validation
Was validating against color attachment index instead of attachment index for depth/stencil ClearAttachment calls.
Diffstat (limited to 'layers/draw_state.cpp')
-rw-r--r--layers/draw_state.cpp16
1 files changed, 9 insertions, 7 deletions
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);
}
}
}