diff options
| author | Chris Forbes <chrisforbes@google.com> | 2016-06-29 11:50:31 +1200 |
|---|---|---|
| committer | Chris Forbes <chrisforbes@google.com> | 2016-07-01 17:44:15 +1200 |
| commit | 1b3858ea73cc192d610404fc4a78aa62c9031527 (patch) | |
| tree | d6ebaacf1e1f5857f6a9187c738575f1e41567ac /layers/core_validation.cpp | |
| parent | 90be8218a551f261ff1391af28bf24d0b091f35e (diff) | |
| download | usermoji-1b3858ea73cc192d610404fc4a78aa62c9031527.tar.xz | |
layers: Add validation for subpass multisample resolve rules
Signed-off-by: Chris Forbes <chrisforbes@google.com>
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index b67df88b..b5e5936f 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -8908,14 +8908,39 @@ static bool ValidateRenderpassAttachmentUsage(layer_data *dev_data, const VkRend skip_call |= ValidateAttachmentIndex(dev_data, attachment, pCreateInfo->attachmentCount, "Preserve"); } } + + auto subpass_performs_resolve = subpass.pResolveAttachments && std::any_of( + subpass.pResolveAttachments, subpass.pResolveAttachments + subpass.colorAttachmentCount, + [](VkAttachmentReference ref) { return ref.attachment != VK_ATTACHMENT_UNUSED; }); + for (uint32_t j = 0; j < subpass.colorAttachmentCount; ++j) { uint32_t attachment; if (subpass.pResolveAttachments) { attachment = subpass.pResolveAttachments[j].attachment; skip_call |= ValidateAttachmentIndex(dev_data, attachment, pCreateInfo->attachmentCount, "Resolve"); + + if (!skip_call && attachment != VK_ATTACHMENT_UNUSED && + pCreateInfo->pAttachments[attachment].samples != VK_SAMPLE_COUNT_1_BIT) { + skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, + __LINE__, DRAWSTATE_INVALID_RENDERPASS, "DS", + "CreateRenderPass: Subpass %u requests multisample resolve into attachment %u, " + "which must have VK_SAMPLE_COUNT_1_BIT but has %s", + i, attachment, string_VkSampleCountFlagBits(pCreateInfo->pAttachments[attachment].samples)); + } } attachment = subpass.pColorAttachments[j].attachment; skip_call |= ValidateAttachmentIndex(dev_data, attachment, pCreateInfo->attachmentCount, "Color"); + + if (!skip_call && + subpass_performs_resolve && + attachment != VK_ATTACHMENT_UNUSED && + pCreateInfo->pAttachments[attachment].samples == VK_SAMPLE_COUNT_1_BIT) { + skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, + __LINE__, DRAWSTATE_INVALID_RENDERPASS, "DS", + "CreateRenderPass: Subpass %u requests multisample resolve, but renders to " + "attachment %u which has VK_SAMPLE_COUNT_1_BIT", + i, attachment); + } } if (subpass.pDepthStencilAttachment && subpass.pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) { uint32_t attachment = subpass.pDepthStencilAttachment->attachment; |
