diff options
Diffstat (limited to 'layers/buffer_validation.cpp')
| -rw-r--r-- | layers/buffer_validation.cpp | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp index 99b3fa06..ca1f57cb 100644 --- a/layers/buffer_validation.cpp +++ b/layers/buffer_validation.cpp @@ -3375,18 +3375,46 @@ bool PreCallValidateCreateImageView(layer_data *device_data, const VkImageViewCr // Validate VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT state if (image_flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) { - if ((!GetDeviceExtensions(device_data)->vk_khr_maintenance2 || - !(image_flags & VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT_KHR))) { - // Format MUST be compatible (in the same format compatibility class) as the format the image was created with - if (FormatCompatibilityClass(image_format) != FormatCompatibilityClass(view_format)) { + if (FormatIsMultiplane(image_format)) { + // View format must match the multiplane compatible format + uint32_t plane = 3; // invalid + switch (aspect_mask) { + case VK_IMAGE_ASPECT_PLANE_0_BIT: + plane = 0; + break; + case VK_IMAGE_ASPECT_PLANE_1_BIT: + plane = 1; + break; + case VK_IMAGE_ASPECT_PLANE_2_BIT: + plane = 2; + break; + default: + break; + } + + VkFormat compat_format = FindMultiplaneCompatibleFormat(image_format, plane); + if (view_format != compat_format) { std::stringstream ss; ss << "vkCreateImageView(): ImageView format " << string_VkFormat(view_format) - << " is not in the same format compatibility class as image (" << HandleToUint64(create_info->image) - << ") format " << string_VkFormat(image_format) - << ". Images created with the VK_IMAGE_CREATE_MUTABLE_FORMAT BIT " - << "can support ImageViews with differing formats but they must be in the same compatibility class."; + << " is not compatible with plane " << plane << " of underlying image format " + << string_VkFormat(image_format) << ", must be " << string_VkFormat(compat_format) << "."; skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, - VALIDATION_ERROR_0ac007f4, "%s", ss.str().c_str()); + VALIDATION_ERROR_0ac00c64, "%s", ss.str().c_str()); + } + } else { + if ((!GetDeviceExtensions(device_data)->vk_khr_maintenance2 || + !(image_flags & VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT_KHR))) { + // Format MUST be compatible (in the same format compatibility class) as the format the image was created with + if (FormatCompatibilityClass(image_format) != FormatCompatibilityClass(view_format)) { + std::stringstream ss; + ss << "vkCreateImageView(): ImageView format " << string_VkFormat(view_format) + << " is not in the same format compatibility class as image (" << HandleToUint64(create_info->image) + << ") format " << string_VkFormat(image_format) + << ". Images created with the VK_IMAGE_CREATE_MUTABLE_FORMAT BIT " + << "can support ImageViews with differing formats but they must be in the same compatibility class."; + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, + VALIDATION_ERROR_0ac007f4, "%s", ss.str().c_str()); + } } } } else { |
