From 8a4d7f38edc4ecc5ea12938a0be39eb33ca65395 Mon Sep 17 00:00:00 2001 From: Petr Kraus Date: Tue, 13 Mar 2018 12:31:27 +0100 Subject: [PATCH] layers: Check CUBE to have 6+ layers --- layers/parameter_validation_utils.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/layers/parameter_validation_utils.cpp b/layers/parameter_validation_utils.cpp index 583baf4..bcc4a05 100644 --- a/layers/parameter_validation_utils.cpp +++ b/layers/parameter_validation_utils.cpp @@ -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) { -- 2.7.4