Mesa (main): zink: only mark resources as cube-compatible if supported
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat May 29 07:43:58 UTC 2021
Module: Mesa
Branch: main
Commit: 71494c4874c6d8eba93309faeed01e1444eb49b5
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=71494c4874c6d8eba93309faeed01e1444eb49b5
Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date: Fri May 21 10:38:32 2021 +0200
zink: only mark resources as cube-compatible if supported
We need to check if the number of samples are valid for the image
first if we've going to set the cube-compatible bit.
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10913>
---
src/gallium/drivers/zink/zink_resource.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index 8d3abdcc411..4abea44c708 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -331,8 +331,6 @@ create_ici(struct zink_screen *screen, const struct pipe_resource *templ, unsign
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:
@@ -385,6 +383,19 @@ create_ici(struct zink_screen *screen, const struct pipe_resource *templ, unsign
if (!good)
debug_printf("ZINK: failed to validate image creation\n");
+ if (templ->target == PIPE_TEXTURE_CUBE ||
+ templ->target == PIPE_TEXTURE_CUBE_ARRAY) {
+ 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;
+ }
+ }
+
ici.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
ici.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
return ici;
More information about the mesa-commit
mailing list