diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-05-31 13:06:24 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-05-31 13:31:56 -0600 |
| commit | 8491e5be6c0ecb358754945729a90280a7b58ba5 (patch) | |
| tree | af7c384ebe8d92c40fb6be49fe2c4f7685e93b3d /layers/core_validation.cpp | |
| parent | 6a4abdf7cd3702b64a0a54f99e2fbc2d07974e82 (diff) | |
| download | usermoji-8491e5be6c0ecb358754945729a90280a7b58ba5.tar.xz | |
layers: GH601 Add check for clearValueCount
We were missing check "clearValueCount must be greater than or equal
to the number of attachments in renderPass that specify a loadOp of VK_ATTACHMENT_LOAD_OP_CLEAR" (Vulkan spec 1.0.15 section 7.4)
This change adds that check.
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 381ca02e..f2eff32c 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -8897,11 +8897,12 @@ CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *p auto framebuffer = pRenderPassBegin ? getFramebuffer(dev_data, pRenderPassBegin->framebuffer) : nullptr; if (pCB) { if (renderPass) { -#if MTMERGE + uint32_t clear_op_count = 0; pCB->activeFramebuffer = pRenderPassBegin->framebuffer; for (size_t i = 0; i < renderPass->attachments.size(); ++i) { MT_FB_ATTACHMENT_INFO &fb_info = framebuffer->attachments[i]; if (renderPass->attachments[i].load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) { + ++clear_op_count; std::function<bool()> function = [=]() { set_memory_valid(dev_data, fb_info.mem, true, fb_info.image); return false; @@ -8926,7 +8927,15 @@ CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *p pCB->validate_functions.push_back(function); } } -#endif + if (clear_op_count > pRenderPassBegin->clearValueCount) { + skipCall |= log_msg( + dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, + reinterpret_cast<uint64_t &>(renderPass), __LINE__, DRAWSTATE_RENDERPASS_INCOMPATIBLE, "DS", + "In vkCmdBeginRenderPass() the VkRenderPassBeginInfo struct has a clearValueCount of %u but the actual number " + "of attachments in renderPass 0x%" PRIx64 " that use VK_ATTACHMENT_LOAD_OP_CLEAR is %u. The clearValueCount " + "must therefore be greater than or equal to %u.", + pRenderPassBegin->clearValueCount, reinterpret_cast<uint64_t &>(renderPass), clear_op_count, clear_op_count); + } skipCall |= VerifyRenderAreaBounds(dev_data, pRenderPassBegin); skipCall |= VerifyFramebufferAndRenderPassLayouts(dev_data, pCB, pRenderPassBegin); skipCall |= insideRenderPass(dev_data, pCB, "vkCmdBeginRenderPass"); |
