vulkan/image: Use GENERAL for initial layout of DMA-BUF textures

The VK_IMAGE_LAYOUT_UNDEFINED layout means that the data hold by the
texture can be discarded, and we don't want to discard it. Because the
Vulkan spec is unclear (see [1] for a discussion), err on the side of
caution and use VK_IMAGE_LAYOUT_GENERAL.

Fixes import failures with WebKit.

[1] https://github.com/ValveSoftware/gamescope/issues/356
This commit is contained in:
Georges Basile Stavracas Neto
2024-04-24 17:21:51 -03:00
parent 7075e6be89
commit 3aa6c27c26

View File

@@ -825,7 +825,7 @@ gsk_vulkan_image_new_for_dmabuf (GskVulkanDevice *device,
self->vk_tiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
self->vk_format = vk_format;
self->vk_pipeline_stage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
self->vk_image_layout = VK_IMAGE_LAYOUT_UNDEFINED;
self->vk_image_layout = VK_IMAGE_LAYOUT_GENERAL;
self->vk_access = 0;
res = vkCreateImage (vk_device,