From 7950325e9b1ed8d686abb072124433a06bff19cc Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Fri, 27 Jan 2017 11:13:21 -0700 Subject: layers: Fix CreateImage extent validation Spec has changed and no longer allows any member of the extents structure to be <= zero. Fixed validation and added correct VU ID, updated test and database. Change-Id: Ifafedf8cd6d59ecba975ae1b25c9f00d86247504 --- layers/buffer_validation.cpp | 37 +++++++-------------------------- layers/vk_validation_error_database.txt | 2 +- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp index 1b650aaa..e886b138 100644 --- a/layers/buffer_validation.cpp +++ b/layers/buffer_validation.cpp @@ -115,36 +115,13 @@ bool PreCallValidateCreateImage(core_validation::layer_data *device_data, const VkDeviceSize imageGranularity = core_validation::GetPhysicalDeviceProperties(device_data)->limits.bufferImageGranularity; imageGranularity = imageGranularity == 1 ? 0 : imageGranularity; - // Make sure all required dimension are non-zero at least. - bool failedMinSize = false; - switch (pCreateInfo->imageType) { - case VK_IMAGE_TYPE_3D: - if (pCreateInfo->extent.depth == 0) { - failedMinSize = true; - } - // Intentional fall-through - case VK_IMAGE_TYPE_2D: - if (pCreateInfo->extent.height == 0) { - failedMinSize = true; - } - // Intentional fall-through - case VK_IMAGE_TYPE_1D: - if (pCreateInfo->extent.width == 0) { - failedMinSize = true; - } - break; - default: - break; - } - // TODO: VALIDATION_ERROR_00716 - // this is *almost* VU 00716, except should not be condidtional on image type - all extents must be non-zero for all types - if (failedMinSize) { - skip_call |= - log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, 0, __LINE__, - IMAGE_INVALID_FORMAT_LIMITS_VIOLATION, "Image", - "CreateImage extents is 0 for at least one required dimension for image of type %d: " - "Width = %d Height = %d Depth = %d.", - pCreateInfo->imageType, pCreateInfo->extent.width, pCreateInfo->extent.height, pCreateInfo->extent.depth); + if ((pCreateInfo->extent.width <= 0) || (pCreateInfo->extent.height <= 0) || (pCreateInfo->extent.depth <= 0)) { + skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, 0, __LINE__, + VALIDATION_ERROR_00716, "Image", + "CreateImage extent is 0 for at least one required dimension for image: " + "Width = %d Height = %d Depth = %d. %s", + pCreateInfo->extent.width, pCreateInfo->extent.height, pCreateInfo->extent.depth, + validation_error_map[VALIDATION_ERROR_00716]); } // TODO: VALIDATION_ERROR_02125 VALIDATION_ERROR_02126 VALIDATION_ERROR_02128 VALIDATION_ERROR_00720 diff --git a/layers/vk_validation_error_database.txt b/layers/vk_validation_error_database.txt index 793b773e..14045a12 100644 --- a/layers/vk_validation_error_database.txt +++ b/layers/vk_validation_error_database.txt @@ -704,7 +704,7 @@ VALIDATION_ERROR_00712~^~N~^~Unknown~^~vkCreateImage~^~For more information refe VALIDATION_ERROR_00713~^~Y~^~Unknown~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'If sharingMode is VK_SHARING_MODE_CONCURRENT, pQueueFamilyIndices must be a pointer to an array of queueFamilyIndexCount uint32_t values' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~ VALIDATION_ERROR_00714~^~Y~^~Unknown~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~ VALIDATION_ERROR_00715~^~Y~^~Unknown~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'format must not be VK_FORMAT_UNDEFINED' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~ -VALIDATION_ERROR_00716~^~N~^~Unknown~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'The width, height, and depth members of extent must all be greater than 0' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~ +VALIDATION_ERROR_00716~^~Y~^~CreateImageLimitsViolationMinWidth~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'The width, height, and depth members of extent must all be greater than 0' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~ VALIDATION_ERROR_00717~^~N~^~Unknown~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'mipLevels must be greater than 0' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~ VALIDATION_ERROR_00718~^~N~^~Unknown~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'arrayLayers must be greater than 0' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~ VALIDATION_ERROR_00719~^~N~^~Unknown~^~vkCreateImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'If flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, imageType must be VK_IMAGE_TYPE_2D' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageCreateInfo)~^~ -- cgit v1.2.3