Reland "Vulkan: Fallback to XCB for Xlib surfaces"

This is a reland of fb0bf70459

Reland after making libx11-xcb dynamically loaded since it isn't present
on all Linux deployment targets of Chromium. Also includes a couple of
additional cosmetic changes to d3d12/PlatformFunctions noticed while
looking at it for inspiration.

Original change's description:
> Vulkan: Fallback to XCB for Xlib surfaces
>
> Chromium builds the Vulkan loader without support Xlib (because it
> prefers XCB) which caused Xlib wgpu::SwapChain creation to fail on the
> Vulkan backend.
>
> This CL adds a fallback to use VK_KHR_xcb_surface if VK_KHR_xlib_surface
> isn't present.
>
> Bug: dawn:662
> Change-Id: I0e0128ee6b5c75da03998dbae231d17e48bacc81
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41180
> Reviewed-by: Austin Eng <enga@chromium.org>
> Commit-Queue: Austin Eng <enga@chromium.org>
> Auto-Submit: Corentin Wallez <cwallez@chromium.org>

Bug: dawn:662
Change-Id: I617fcd1059dddfa05c29ac20d77f891ca6962342
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41380
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2021-02-11 08:26:38 +00:00
committed by Commit Bot service account
parent 7e80cce1a9
commit aa0e1be0e8
13 changed files with 153 additions and 8 deletions

View File

@@ -162,6 +162,7 @@ namespace dawn_native { namespace vulkan {
#if defined(DAWN_USE_X11)
# define VK_USE_PLATFORM_XLIB_KHR
# define VK_USE_PLATFORM_XCB_KHR
# include "common/xlib_with_undefs.h"
#endif // defined(DAWN_USE_X11)

View File

@@ -26,6 +26,10 @@
// interface.
#include <X11/Xlib.h>
// Xlib-xcb.h technically includes Xlib.h but we separate the includes to make it more clear what
// the problem is if one of these two includes fail.
#include <X11/Xlib-xcb.h>
#undef Success
#undef None
#undef Always