diff options
| author | Dave Houlton <daveh@lunarg.com> | 2018-03-30 15:07:41 -0600 |
|---|---|---|
| committer | Dave Houlton <daveh@lunarg.com> | 2018-04-03 11:40:45 -0600 |
| commit | 874651452c6fd4e576729aee5061388a389de4fe (patch) | |
| tree | 3b7dadc4f3627126660be72ad6a09440fde12b2a | |
| parent | cb72bd9b0291ba3dc0ee32fc00c7a3b5119b2e23 (diff) | |
| download | usermoji-874651452c6fd4e576729aee5061388a389de4fe.tar.xz | |
layers: Fix multi-plane aspect bit check
Remove multi-plane formats from classification as 'color' formats
and add specific aspect bit checks for them.
Change-Id: Ie899a6f2a91ceb43e6fb92c3fdd9056e00849fc3
| -rw-r--r-- | layers/buffer_validation.cpp | 12 | ||||
| -rw-r--r-- | layers/vk_format_utils.h | 4 |
2 files changed, 15 insertions, 1 deletions
diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp index 1a1f7dc8..9abc47b3 100644 --- a/layers/buffer_validation.cpp +++ b/layers/buffer_validation.cpp @@ -3147,6 +3147,18 @@ bool ValidateImageAspectMask(layer_data *device_data, VkImage image, VkFormat fo HandleToUint64(image), VALIDATION_ERROR_0a400c01, "%s: Stencil-only image formats can have only the VK_IMAGE_ASPECT_STENCIL_BIT set.", func_name); } + } else if (FormatIsMultiplane(format)) { + VkImageAspectFlags valid_flags = VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT; + if (3 == FormatPlaneCount(format)) { + valid_flags = valid_flags | VK_IMAGE_ASPECT_PLANE_2_BIT; + } + if ((aspect_mask & valid_flags) != aspect_mask) { + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + HandleToUint64(image), VALIDATION_ERROR_0a400c01, + "%s: Multi-plane image formats may have only VK_IMAGE_ASPECT_COLOR_BIT or VK_IMAGE_ASPECT_PLANE_n_BITs " + "set, where n = [0, 1, 2].", + func_name); + } } return skip; } diff --git a/layers/vk_format_utils.h b/layers/vk_format_utils.h index 8ffa231c..c5304059 100644 --- a/layers/vk_format_utils.h +++ b/layers/vk_format_utils.h @@ -119,10 +119,12 @@ VK_LAYER_EXPORT VkFormatCompatibilityClass FormatCompatibilityClass(VkFormat for VK_LAYER_EXPORT VkDeviceSize SafeModulo(VkDeviceSize dividend, VkDeviceSize divisor); static inline bool FormatIsUndef(VkFormat format) { return (format == VK_FORMAT_UNDEFINED); } -static inline bool FormatIsColor(VkFormat format) { return !(FormatIsUndef(format) || FormatIsDepthOrStencil(format)); } static inline bool FormatHasDepth(VkFormat format) { return (FormatIsDepthOnly(format) || FormatIsDepthAndStencil(format)); } static inline bool FormatHasStencil(VkFormat format) { return (FormatIsStencilOnly(format) || FormatIsDepthAndStencil(format)); } static inline bool FormatIsMultiplane(VkFormat format) { return ((FormatPlaneCount(format)) > 1u); } +static inline bool FormatIsColor(VkFormat format) { + return !(FormatIsUndef(format) || FormatIsDepthOrStencil(format) || FormatIsMultiplane(format)); +} #ifdef __cplusplus } |
