vulkan: allocate host-visible memory for swapchain images
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Tue, 13 Jul 2021 13:38:16 +0000 (15:38 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 14 Jul 2021 07:09:38 +0000 (07:09 +0000)
The Vulkan 1.2 specification, section 11.2.12 ("Host Access to Device
Memory Objects") say the following:

> memory must have been created with a memory type that reports
> VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT

Since there's no guarantee that there's any memory that is *both*
device-local *and* host-visible, let's just use the latter requirement.

Fixes: 8af568e4ae7 ("vulkan: implement wsi_win32 backend")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11848>

src/vulkan/wsi/wsi_common_win32.c

index 1b21914..c62de45 100644 (file)
@@ -387,7 +387,7 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
       .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
       .pNext = &memory_dedicated_info,
       .allocationSize = reqs.size,
-      .memoryTypeIndex = select_memory_type(wsi, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
+      .memoryTypeIndex = select_memory_type(wsi, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT,
                                             reqs.memoryTypeBits),
    };
    result = wsi->AllocateMemory(chain->device, &memory_info,