Mesa (staging/21.2): zink: add better handling for CUBE_COMPATIBLE bit
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Oct 29 16:34:58 UTC 2021
Module: Mesa
Branch: staging/21.2
Commit: c0a49bc4c9ce02d94228f7b0f44693e3a209c32d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c0a49bc4c9ce02d94228f7b0f44693e3a209c32d
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Fri Aug 6 16:20:45 2021 -0400
zink: add better handling for CUBE_COMPATIBLE bit
this check was illegal because the usage bits weren't yet populated,
so add another check after usage bits are determined to figure out if
CUBE_COMPATIBLE can be applied
additionally, checking sample counts was never needed since the spec
prohibits CUBE_COMPATIBLE use with multisampling
zink DEBUG: ERR: 'Validation Error: [ VUID-vkGetPhysicalDeviceImageFormatProperties-usage-requiredbitmask ] Object 0: VK_NULL_HANDLE, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x991b3105 | vkGetPhysicalDeviceImageFormatProperties: value of usage must not be 0. The Vulkan spec states: usage must not be 0 (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-vkGetPhysicalDeviceImageFormatProperties-usage-requiredbitmask)'
Fixes: 71494c4874c ("zink: only mark resources as cube-compatible if supported")
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12580>
(cherry picked from commit 2de6beaa12f9b855d31c3c11a8a6cea51a14d6b1)
---
.pick_status.json | 2 +-
src/gallium/drivers/zink/zink_resource.c | 31 ++++++++++++++-----------------
2 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index b7730481a8b..a163884c5be 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1057,7 +1057,7 @@
"description": "zink: add better handling for CUBE_COMPATIBLE bit",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "71494c4874c6d8eba93309faeed01e1444eb49b5"
},
diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index a923f9d0b9c..29ba0927c9a 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -400,8 +400,6 @@ create_ici(struct zink_screen *screen, VkImageCreateInfo *ici, const struct pipe
case PIPE_TEXTURE_CUBE:
case PIPE_TEXTURE_CUBE_ARRAY:
- ici->flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
- FALLTHROUGH;
case PIPE_TEXTURE_2D:
case PIPE_TEXTURE_2D_ARRAY:
case PIPE_TEXTURE_RECT:
@@ -437,21 +435,15 @@ create_ici(struct zink_screen *screen, VkImageCreateInfo *ici, const struct pipe
ici->sharingMode = VK_SHARING_MODE_EXCLUSIVE;
ici->initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
- if (templ->target == PIPE_TEXTURE_CUBE ||
- templ->target == PIPE_TEXTURE_CUBE_ARRAY ||
- (templ->target == PIPE_TEXTURE_2D_ARRAY &&
- ici->extent.width == ici->extent.height &&
- ici->arrayLayers >= 6)) {
- VkImageFormatProperties props;
- if (vkGetPhysicalDeviceImageFormatProperties(screen->pdev, ici->format,
- ici->imageType, ici->tiling,
- ici->usage, ici->flags |
- VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT,
- &props) == VK_SUCCESS) {
- if (props.sampleCounts & ici->samples)
- ici->flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
- }
- }
+ /* sampleCounts will be set to VK_SAMPLE_COUNT_1_BIT if at least one of the following conditions is true:
+ * - flags contains VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT
+ *
+ * 44.1.1. Supported Sample Counts
+ */
+ bool want_cube = ici->samples == 1 &&
+ (templ->target == PIPE_TEXTURE_CUBE ||
+ templ->target == PIPE_TEXTURE_CUBE_ARRAY ||
+ (templ->target == PIPE_TEXTURE_2D_ARRAY && ici->extent.width == ici->extent.height && ici->arrayLayers >= 6));
if (templ->target == PIPE_TEXTURE_CUBE)
ici->arrayLayers *= 6;
@@ -494,6 +486,11 @@ create_ici(struct zink_screen *screen, VkImageCreateInfo *ici, const struct pipe
if (ici->tiling != VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT)
tried[ici->tiling] = true;
}
+ if (want_cube) {
+ ici->flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
+ if (get_image_usage(screen, ici, templ, bind, modifiers_count, modifiers, &mod) != ici->usage)
+ ici->flags &= ~VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
+ }
*success = true;
return mod;
More information about the mesa-commit
mailing list