Mesa (main): v3dv: fix format usage checks when extended usage flag is set
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri May 20 13:03:41 UTC 2022
Module: Mesa
Branch: main
Commit: a987167ebd75c002f8f5d3724ffbafb60cccc86c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a987167ebd75c002f8f5d3724ffbafb60cccc86c
Author: Iago Toral Quiroga <itoral at igalia.com>
Date: Fri May 20 08:46:51 2022 +0200
v3dv: fix format usage checks when extended usage flag is set
Fixes:
dEQP-VK.image.extended_usage_bit_compatibility.*
Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16625>
---
src/broadcom/vulkan/v3dv_formats.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/broadcom/vulkan/v3dv_formats.c b/src/broadcom/vulkan/v3dv_formats.c
index 581ad8d5a6e..cc48ccf61de 100644
--- a/src/broadcom/vulkan/v3dv_formats.c
+++ b/src/broadcom/vulkan/v3dv_formats.c
@@ -350,10 +350,20 @@ get_image_format_properties(
const VkImageStencilUsageCreateInfo *stencil_usage_info =
vk_find_struct_const(info->pNext, IMAGE_STENCIL_USAGE_CREATE_INFO);
- VkImageUsageFlags usage =
+ VkImageUsageFlags image_usage =
info->usage | (stencil_usage_info ? stencil_usage_info->stencilUsage : 0);
- if (usage & VK_IMAGE_USAGE_TRANSFER_SRC_BIT) {
+ /* If VK_IMAGE_CREATE_EXTENDED_USAGE_BIT is set it means the usage flags may
+ * not be be supported for the image format but are supported for at least
+ * one compatible format from which an image view can be created for the
+ * image. This means we should not report the format as unsupported based
+ * on the usage flags when usage refers to how an image view may be used
+ * (i.e. as a framebuffer attachment, for sampling, etc).
+ */
+ VkImageUsageFlags view_usage =
+ info->flags & VK_IMAGE_CREATE_EXTENDED_USAGE_BIT ? 0 : image_usage;
+
+ if (image_usage & VK_IMAGE_USAGE_TRANSFER_SRC_BIT) {
if (!(format_feature_flags & VK_FORMAT_FEATURE_TRANSFER_SRC_BIT)) {
goto unsupported;
}
@@ -369,14 +379,14 @@ get_image_format_properties(
}
}
- if (usage & VK_IMAGE_USAGE_TRANSFER_DST_BIT) {
+ if (image_usage & VK_IMAGE_USAGE_TRANSFER_DST_BIT) {
if (!(format_feature_flags & VK_FORMAT_FEATURE_TRANSFER_DST_BIT)) {
goto unsupported;
}
}
- if (usage & (VK_IMAGE_USAGE_SAMPLED_BIT |
- VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT)) {
+ if (view_usage & (VK_IMAGE_USAGE_SAMPLED_BIT |
+ VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT)) {
if (!(format_feature_flags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)) {
goto unsupported;
}
@@ -391,19 +401,19 @@ get_image_format_properties(
}
}
- if (usage & VK_IMAGE_USAGE_STORAGE_BIT) {
+ if (view_usage & VK_IMAGE_USAGE_STORAGE_BIT) {
if (!(format_feature_flags & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT)) {
goto unsupported;
}
}
- if (usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) {
+ if (view_usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) {
if (!(format_feature_flags & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)) {
goto unsupported;
}
}
- if (usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) {
+ if (view_usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) {
if (!(format_feature_flags &
VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)) {
goto unsupported;
More information about the mesa-commit
mailing list