summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Versace <chad@kiwitree.net>2020-08-04 10:14:11 -0700
committerDylan Baker <dylan.c.baker@intel.com>2020-11-17 10:57:32 -0800
commitc9d10b391c121e0518b9e2b124f87aa28c108970 (patch)
tree626dbbc646271d594f49c89c04e82f7a2dee81e4
parent1534e28669ddaec5031027f6f98e3ae371a09a42 (diff)
anv/image: Check DISJOINT in vkGetPhysicalDeviceImageFormatProperties2 (v2)
The code did not return error when VK_IMAGE_CREATE_DISJOINT_BIT was incompatible with the other input params. If the Vulkan spec forbids a set of input params for vkCreateImage, but permits them for vkGetPhysicalDeviceImageFormatProperties2, then vkGetPhysicalDeviceImageFormatProperties2 must reject those input params with failure. - v2: Clearer commit message. CC: <mesa-stable@lists.freedesktop.org> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (v2) Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (cherry picked from commit 51a19c83b000407a31b5cd17b996084a6b58a4ff)
-rw-r--r--.pick_status.json2
-rw-r--r--src/intel/vulkan/anv_formats.c25
2 files changed, 26 insertions, 1 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 2509e22c85e..387b08b7315 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -211,7 +211,7 @@
"description": "anv/image: Check DISJOINT in vkGetPhysicalDeviceImageFormatProperties2 (v2)",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": null
},
diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index 6cbbc77337c..a8d847a57b4 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -923,6 +923,31 @@ anv_get_image_format_properties(
}
}
+ if (info->flags & VK_IMAGE_CREATE_DISJOINT_BIT) {
+ /* From the Vulkan 1.2.149 spec, VkImageCreateInfo:
+ *
+ * If format is a multi-planar format, and if imageCreateFormatFeatures
+ * (as defined in Image Creation Limits) does not contain
+ * VK_FORMAT_FEATURE_DISJOINT_BIT, then flags must not contain
+ * VK_IMAGE_CREATE_DISJOINT_BIT.
+ */
+ if (format->n_planes > 1 &&
+ !(format_feature_flags & VK_FORMAT_FEATURE_DISJOINT_BIT)) {
+ goto unsupported;
+ }
+
+ /* From the Vulkan 1.2.149 spec, VkImageCreateInfo:
+ *
+ * If format is not a multi-planar format, and flags does not include
+ * VK_IMAGE_CREATE_ALIAS_BIT, flags must not contain
+ * VK_IMAGE_CREATE_DISJOINT_BIT.
+ */
+ if (format->n_planes == 1 &&
+ !(info->flags & VK_IMAGE_CREATE_ALIAS_BIT)) {
+ goto unsupported;
+ }
+ }
+
if (info->usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) {
/* Nothing to check. */
}