From 7bf94579ca98332a4e1dd13db3ecb54c08cdebbf Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Wed, 22 Jun 2016 16:12:58 -0600 Subject: layers: Add INVALID_FRAMEBUFFER_CREATE_INFO error Added new error enum DRAWSTATE_INVALID_FRAMEBUFFER_CREATE_INFO and added initial check with this enum type that flags and error if framebuffer attachment has non-1 mip levelCount. --- layers/core_validation.cpp | 9 +++++++-- layers/core_validation_error_enums.h | 1 + layers/vk_validation_layer_details.md | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 82050326..b8c69161 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -8274,11 +8274,16 @@ static bool ValidateFramebufferCreateInfo(layer_data *dev_data, const VkFramebuf 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 + 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_INVALID_FRAMEBUFFER_CREATE_INFO, + "DS", "vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u has mip levelCount of %u " + "but only a single mip level (levelCount == 1) is allowed when creating a Framebuffer.", + i, ivci->subresourceRange.levelCount); } +#if 0 // Enabling 1 new check/test at a time const uint32_t mip_level = ivci->subresourceRange.baseMipLevel; if ((ivci->subresourceRange.layerCount < pCreateInfo->layers) || ((ici->extent.width >> mip_level) < pCreateInfo->width) || diff --git a/layers/core_validation_error_enums.h b/layers/core_validation_error_enums.h index bcbdd33b..3918da75 100644 --- a/layers/core_validation_error_enums.h +++ b/layers/core_validation_error_enums.h @@ -131,6 +131,7 @@ enum DRAW_STATE_ERROR { DRAWSTATE_FRAMEBUFFER_INCOMPATIBLE, // Incompatible framebuffer between // secondary cmdBuffer and active // renderPass + DRAWSTATE_INVALID_FRAMEBUFFER_CREATE_INFO, // Invalid VkFramebufferCreateInfo state DRAWSTATE_INVALID_RENDERPASS, // Use of a NULL or otherwise invalid // RenderPass object DRAWSTATE_INVALID_RENDERPASS_CMD, // Invalid cmd submitted while a diff --git a/layers/vk_validation_layer_details.md b/layers/vk_validation_layer_details.md index 2f24f2e7..dcee2db3 100644 --- a/layers/vk_validation_layer_details.md +++ b/layers/vk_validation_layer_details.md @@ -70,6 +70,7 @@ The Draw State portion of the core validation layer tracks state leading into Dr | Valid RenderPass | Flag error if attempt made to Begin/End/Continue a NULL or otherwise invalid RenderPass object | INVALID_RENDERPASS | vkCmdBeginRenderPass vkCmdEndRenderPass vkBeginCommandBuffer | NullRenderPass | NA | | RenderPass Compatibility | Verify that active renderpass is compatible with renderpass specified in secondary command buffer, and that renderpass specified for a framebuffer is compatible with renderpass specified in secondary command buffer. Also that parameters for BeginRenderpass are compatible with actual renderpass. | RENDERPASS_INCOMPATIBLE | vkCmdExecuteCommands vkBeginCommandBuffer vkCmdBeginRenderPass vkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirect | RenderPassClearOpMismatch RenderPassIncompatible FramebufferCreateErrors | Need to write some more tests to cover all of these cases. | | Framebuffer Compatibility | If a framebuffer is passed to secondary command buffer in vkBeginCommandBuffer, then it must match active renderpass (if any) at time of vkCmdExecuteCommands | FRAMEBUFFER_INCOMPATIBLE | vkCmdExecuteCommands | TODO | None | +| Framebuffer Creation | If a CreateFramebuffer is called with invalide CreateInfo such as attachments with bad mip levelCount or dimensions | INVALID_FRAMEBUFFER_CREATE_INFO | vkCreateFramebuffer | FramebufferCreateErrors | None | | DescriptorSet Updated | Warn user if DescriptorSet bound that was never updated and is not empty. Trigger error at draw time if a set being used was never updated. | DESCRIPTOR_SET_NOT_UPDATED | vkCmdBindDescriptorSets vkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirect | DescriptorSetCompatibility | NA | | DescriptorSet Bound | Error if DescriptorSet not bound that is used by currently bound VkPipeline at draw time | DESCRIPTOR_SET_NOT_BOUND | vkCmdBindDescriptorSets | DescriptorSetNotUpdated | NA | | Dynamic Offset Count | Error if dynamicOffsetCount at CmdBindDescriptorSets time is not equal to the actual number of dynamic descriptors in all sets being bound. | INVALID_DYNAMIC_OFFSET_COUNT | vkCmdBindDescriptorSets | InvalidDynamicOffsetCases | None | -- cgit v1.2.3