mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 20:38:06 +02:00
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: 71494c4874 ("zink: only mark resources as cube-compatible if supported")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12580>
This commit is contained in:
parent
5a2513a515
commit
2de6beaa12
1 changed files with 14 additions and 17 deletions
|
|
@ -343,8 +343,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:
|
||||
|
|
@ -380,21 +378,15 @@ create_ici(struct zink_screen *screen, VkImageCreateInfo *ici, const struct pipe
|
|||
ici->sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||
ici->initialLayout = dmabuf ? VK_IMAGE_LAYOUT_PREINITIALIZED : 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;
|
||||
|
|
@ -437,6 +429,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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue