From f6df420d230f3f0de7f16b084896074015ec10a8 Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Wed, 22 Jun 2016 14:16:06 -0600 Subject: layers: Add sample count check at CreateFramebuffer time When creating a framebuffer make sure that samples for its attachments match samples for corresponding renderpass attachments. This is a valid usage requirement for CreateFramebuffer. Also need to store swapchain images with default samples value of VK_SAMPLE_COUNT_1_BIT to avoid false errors. --- layers/core_validation.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'layers/core_validation.cpp') diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 2e1136d2..82050326 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -8250,7 +8250,7 @@ static bool ValidateFramebufferCreateInfo(layer_data *dev_data, const VkFramebuf "renderPass (0x%" PRIxLEAST64 ") being used to create Framebuffer.", pCreateInfo->attachmentCount, rpci->attachmentCount, reinterpret_cast(pCreateInfo->renderPass)); } else { - // attachmentCounts match, so make sure corresponding Formats match + // attachmentCounts match, so make sure corresponding attachment details line up const VkImageView *image_views = pCreateInfo->pAttachments; for (uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i) { VkImageViewCreateInfo *ivci = getImageViewData(dev_data, image_views[i]); @@ -8264,11 +8264,17 @@ static bool ValidateFramebufferCreateInfo(layer_data *dev_data, const VkFramebuf i, string_VkFormat(ivci->format), string_VkFormat(rpci->pAttachments[i].format), reinterpret_cast(pCreateInfo->renderPass)); } -#if 0 // Enabling 1 new check/test at a time const VkImageCreateInfo *ici = &getImageNode(dev_data, ivci->image)->createInfo; if (ici->samples != rpci->pAttachments[i].samples) { - // TODO : ERROR + skip_call |= log_msg( + dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, + reinterpret_cast(pCreateInfo->renderPass), __LINE__, DRAWSTATE_RENDERPASS_INCOMPATIBLE, + "DS", "vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u has %s samples that do not match " + "the %s samples used by the corresponding attachment for renderPass (0x%" PRIxLEAST64 ").", + i, string_VkSampleCountFlagBits(ici->samples), string_VkSampleCountFlagBits(rpci->pAttachments[i].samples), + reinterpret_cast(pCreateInfo->renderPass)); } +#if 0 // Enabling 1 new check/test at a time // Verify that view only has a single mip level if (ivci->subresourceRange.levelCount != 1) { // TODO @@ -9973,6 +9979,7 @@ GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pCoun image_ci.arrayLayers = swapchain_node->createInfo.imageArrayLayers; image_ci.usage = swapchain_node->createInfo.imageUsage; image_ci.format = swapchain_node->createInfo.imageFormat; + image_ci.samples = VK_SAMPLE_COUNT_1_BIT; image_ci.extent.width = swapchain_node->createInfo.imageExtent.width; image_ci.extent.height = swapchain_node->createInfo.imageExtent.height; image_ci.sharingMode = swapchain_node->createInfo.imageSharingMode; -- cgit v1.2.3