zink: limit images we mark as cube-compatible

The Vulkan spec says the following:

> If imageType is VK_IMAGE_TYPE_2D and flags contains
> VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT, extent.width and extent.height
> must be equal and arrayLayers must be greater than or equal to 6

This makes a lot of sense, as these are also requirements for being able
to create cubemaps from them in the first place.

Let's thread a bit more careful, and only set this bit in these cases.
This matters in the new case of setting this flag on 2D array textures.
In the other cases, this should already be the case.

I haven't seen this trigger any issues, I just realized this while
reading the Vulkan-spec.

Fixes: 1887ff2ebb ("zink: mark 2d-arrays as cube-compatible")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11081>
This commit is contained in:
Erik Faye-Lund 2021-05-29 09:51:29 +02:00 committed by Marge Bot
parent 6f504b5fc6
commit 28c842e4b7

View file

@ -388,7 +388,9 @@ create_ici(struct zink_screen *screen, const struct pipe_resource *templ, unsign
if (templ->target == PIPE_TEXTURE_CUBE ||
templ->target == PIPE_TEXTURE_CUBE_ARRAY ||
templ->target == PIPE_TEXTURE_2D_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,