aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 1414bd5d..9211503f 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -9489,7 +9489,7 @@ CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *p
auto framebuffer = pRenderPassBegin ? getFramebuffer(dev_data, pRenderPassBegin->framebuffer) : nullptr;
if (pCB) {
if (renderPass) {
- uint32_t clear_op_count = 0;
+ uint32_t clear_op_size = 0; // Make sure pClearValues is at least as large as last LOAD_OP_CLEAR
pCB->activeFramebuffer = pRenderPassBegin->framebuffer;
for (size_t i = 0; i < renderPass->attachments.size(); ++i) {
MT_FB_ATTACHMENT_INFO &fb_info = framebuffer->attachments[i];
@@ -9497,7 +9497,7 @@ CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *p
if (FormatSpecificLoadAndStoreOpSettings(format, renderPass->attachments[i].load_op,
renderPass->attachments[i].stencil_load_op,
VK_ATTACHMENT_LOAD_OP_CLEAR)) {
- ++clear_op_count;
+ clear_op_size = i + 1;
std::function<bool()> function = [=]() {
set_memory_valid(dev_data, fb_info.mem, true, fb_info.image);
return false;
@@ -9526,14 +9526,18 @@ CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *p
pCB->validate_functions.push_back(function);
}
}
- if (clear_op_count > pRenderPassBegin->clearValueCount) {
- skip_call |= 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);
+ if (clear_op_size > pRenderPassBegin->clearValueCount) {
+ skip_call |=
+ 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 there must "
+ "be at least %u "
+ "entries in pClearValues array to account for the highest index attachment in renderPass 0x%" PRIx64
+ " that uses VK_ATTACHMENT_LOAD_OP_CLEAR is %u. Note that the pClearValues array "
+ "is indexed by attachment number so even if some pClearValues entries between 0 and %u correspond to "
+ "attachments that aren't cleared they will be ignored.",
+ pRenderPassBegin->clearValueCount, clear_op_size, reinterpret_cast<uint64_t &>(renderPass),
+ clear_op_size, clear_op_size - 1);
}
skip_call |= VerifyRenderAreaBounds(dev_data, pRenderPassBegin);
skip_call |= VerifyFramebufferAndRenderPassLayouts(dev_data, pCB, pRenderPassBegin);