diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-06-22 16:38:29 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-06-23 13:49:43 -0600 |
| commit | 7328b7a828ea2854c62ca6e015d7d1c45a834386 (patch) | |
| tree | 3278cbd6f37ff174cb917daba4476da473f17355 /layers/core_validation.cpp | |
| parent | 7bf94579ca98332a4e1dd13db3ecb54c08cdebbf (diff) | |
| download | usermoji-7328b7a828ea2854c62ca6e015d7d1c45a834386.tar.xz | |
layers: Add Framebuffer dimensions check
When creating a framebuffer, make sure that the dimensions for the
attachments are at least as big as the framebuffer dimensions.
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index b8c69161..f57726b5 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -8283,17 +8283,31 @@ static bool ValidateFramebufferCreateInfo(layer_data *dev_data, const VkFramebuf "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) || - ((ici->extent.height >> mip_level) < pCreateInfo->height)) { - // TODO + uint32_t mip_width = max(1u, ici->extent.width >> mip_level); + uint32_t mip_height = max(1u, ici->extent.height >> mip_level); + if ((ivci->subresourceRange.layerCount < pCreateInfo->layers) || (mip_width < pCreateInfo->width) || + (mip_height < pCreateInfo->height)) { + skip_call |= + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT, + reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass), __LINE__, + DRAWSTATE_INVALID_FRAMEBUFFER_CREATE_INFO, "DS", + "vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u mip level %u has dimensions smaller " + "than the corresponding " + "framebuffer dimensions. Attachment dimensions must be at least as large. Here are the respective " + "dimensions for " + "attachment #%u, framebuffer:\n" + "width: %u, %u\n" + "height: %u, %u\n" + "layerCount: %u, %u\n", + i, ivci->subresourceRange.baseMipLevel, i, mip_width, pCreateInfo->width, mip_height, + pCreateInfo->height, ivci->subresourceRange.layerCount, pCreateInfo->layers); } - if ((ivci->components.r != VK_COMPONENT_SWIZZLE_IDENTITY) || - (ivci->components.r != VK_COMPONENT_SWIZZLE_IDENTITY) || - (ivci->components.r != VK_COMPONENT_SWIZZLE_IDENTITY) || - (ivci->components.r != VK_COMPONENT_SWIZZLE_IDENTITY)) { +#if 0 // Enabling 1 new check/test at a time + if (((ivci->components.r != VK_COMPONENT_SWIZZLE_IDENTITY) && (ivci->components.r != VK_COMPONENT_SWIZZLE_R)) || + ((ivci->components.g != VK_COMPONENT_SWIZZLE_IDENTITY) && (ivci->components.g != VK_COMPONENT_SWIZZLE_G)) || + ((ivci->components.b != VK_COMPONENT_SWIZZLE_IDENTITY) && (ivci->components.b != VK_COMPONENT_SWIZZLE_B)) || + ((ivci->components.a != VK_COMPONENT_SWIZZLE_IDENTITY) && (ivci->components.a != VK_COMPONENT_SWIZZLE_A))) { // TODO } #endif |
