layers: Check CUBE to have 6+ layers
authorPetr Kraus <petr_kraus@email.cz>
Tue, 13 Mar 2018 11:31:27 +0000 (12:31 +0100)
committerMark Lobodzinski <mark@lunarg.com>
Tue, 20 Mar 2018 17:14:18 +0000 (11:14 -0600)
layers/parameter_validation_utils.cpp

index 583baf4..bcc4a05 100644 (file)
@@ -906,16 +906,23 @@ bool pv_vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, con
         }
 
         if (pCreateInfo->imageType == VK_IMAGE_TYPE_2D) {
-            // If imageType is VK_IMAGE_TYPE_2D and flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, extent.width and
-            // extent.height must be equal
-            if ((pCreateInfo->flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) &&
-                (pCreateInfo->extent.width != pCreateInfo->extent.height)) {
-                skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__,
-                                VALIDATION_ERROR_09e00774, LayerName,
-                                "vkCreateImage(): if pCreateInfo->imageType is VK_IMAGE_TYPE_2D and pCreateInfo->flags contains "
-                                "VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, pCreateInfo->extent.width and pCreateInfo->extent.height "
-                                "must be equal. %s",
-                                validation_error_map[VALIDATION_ERROR_09e00774]);
+            if (pCreateInfo->flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) {
+                if (pCreateInfo->extent.width != pCreateInfo->extent.height) {
+                    skip |= log_msg(
+                        report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, VK_NULL_HANDLE, __LINE__,
+                        VALIDATION_ERROR_09e00774, LayerName,
+                        "vkCreateImage(): pCreateInfo->flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, but "
+                        "pCreateInfo->extent.width (=%" PRIu32 ") and pCreateInfo->extent.height (=%" PRIu32 ") are not equal. %s",
+                        pCreateInfo->extent.width, pCreateInfo->extent.height, validation_error_map[VALIDATION_ERROR_09e00774]);
+                }
+
+                if (pCreateInfo->arrayLayers < 6) {
+                    skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
+                                    VK_NULL_HANDLE, __LINE__, VALIDATION_ERROR_09e00774, LayerName,
+                                    "vkCreateImage(): pCreateInfo->flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, but "
+                                    "pCreateInfo->arrayLayers (=%" PRIu32 ") is not greater than or equal to 6. %s",
+                                    pCreateInfo->arrayLayers, validation_error_map[VALIDATION_ERROR_09e00774]);
+                }
             }
 
             if (pCreateInfo->extent.depth != 1) {