88 lines
3.2 KiB
Diff
88 lines
3.2 KiB
Diff
From 7b27a46d14acf050e6e836c41ca2f286680e6edc Mon Sep 17 00:00:00 2001
|
|
From: Prabhu Sundararaj <prabhu.sundararaj@nxp.com>
|
|
Date: Tue, 11 May 2021 17:28:06 -0500
|
|
Subject: [PATCH 1/3] Add support for wayland.
|
|
|
|
Use VKB_BUILD_WAYLAND=1 and GLFW_USE_WAYLAND=1 to enable wayland
|
|
|
|
Signed-off-by: Hugo Osornio <hugo.osornio@nxp.com>
|
|
Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@nxp.com>
|
|
---
|
|
bldsys/cmake/template/entrypoint_main.cpp.in | 2 ++
|
|
framework/platform/unix/unix_platform.cpp | 7 +++++++
|
|
third_party/CMakeLists.txt | 19 ++++++++++++-------
|
|
3 files changed, 21 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/bldsys/cmake/template/entrypoint_main.cpp.in b/bldsys/cmake/template/entrypoint_main.cpp.in
|
|
index 92ec703..eaf158e 100644
|
|
--- a/bldsys/cmake/template/entrypoint_main.cpp.in
|
|
+++ b/bldsys/cmake/template/entrypoint_main.cpp.in
|
|
@@ -47,6 +47,8 @@ int main(int argc, char *argv[])
|
|
vkb::UnixPlatform platform{vkb::UnixType::Mac, argc, argv};
|
|
# elif defined(VK_USE_PLATFORM_XCB_KHR)
|
|
vkb::UnixPlatform platform{vkb::UnixType::Linux, argc, argv};
|
|
+# elif defined(VK_USE_PLATFORM_WAYLAND_KHR)
|
|
+ vkb::UnixPlatform platform{vkb::UnixType::Linux, argc, argv};
|
|
# endif
|
|
#endif
|
|
|
|
diff --git a/framework/platform/unix/unix_platform.cpp b/framework/platform/unix/unix_platform.cpp
|
|
index 53a0502..84e8f79 100644
|
|
--- a/framework/platform/unix/unix_platform.cpp
|
|
+++ b/framework/platform/unix/unix_platform.cpp
|
|
@@ -35,6 +35,10 @@ VKBP_ENABLE_WARNINGS()
|
|
# define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface"
|
|
#endif
|
|
|
|
+#ifndef VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME
|
|
+# define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface"
|
|
+#endif
|
|
+
|
|
namespace vkb
|
|
{
|
|
namespace
|
|
@@ -95,6 +99,9 @@ const char *UnixPlatform::get_surface_extension()
|
|
}
|
|
else
|
|
{
|
|
+#ifdef VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME
|
|
+ return VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME;
|
|
+#endif
|
|
return VK_KHR_XCB_SURFACE_EXTENSION_NAME;
|
|
}
|
|
}
|
|
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
|
|
index 499fe9a..de13c11 100644
|
|
--- a/third_party/CMakeLists.txt
|
|
+++ b/third_party/CMakeLists.txt
|
|
@@ -57,14 +57,19 @@ elseif(WIN32)
|
|
elseif(APPLE)
|
|
target_compile_definitions(vulkan INTERFACE VK_USE_PLATFORM_MACOS_MVK)
|
|
elseif(UNIX)
|
|
- # See whether X11 is available. If not, fall back to direct-to-display mode.
|
|
- find_package(X11 QUIET)
|
|
- if (X11_FOUND)
|
|
- target_compile_definitions(vulkan INTERFACE VK_USE_PLATFORM_XCB_KHR)
|
|
+ if (VKB_BUILD_WAYLAND)
|
|
+ message(STATUS "Using Vulkan platform wayland")
|
|
+ target_compile_definitions(vulkan INTERFACE VK_USE_PLATFORM_WAYLAND_KHR)
|
|
else()
|
|
- set(DIRECT_TO_DISPLAY TRUE)
|
|
- set(DIRECT_TO_DISPLAY TRUE PARENT_SCOPE)
|
|
- target_compile_definitions(vulkan INTERFACE VK_USE_PLATFORM_DISPLAY_KHR)
|
|
+ # See whether X11 is available. If not, fall back to direct-to-display mode.
|
|
+ find_package(X11 QUIET)
|
|
+ if (X11_FOUND)
|
|
+ target_compile_definitions(vulkan INTERFACE VK_USE_PLATFORM_XCB_KHR)
|
|
+ else()
|
|
+ set(DIRECT_TO_DISPLAY TRUE)
|
|
+ set(DIRECT_TO_DISPLAY TRUE PARENT_SCOPE)
|
|
+ target_compile_definitions(vulkan INTERFACE VK_USE_PLATFORM_DISPLAY_KHR)
|
|
+ endif()
|
|
endif()
|
|
endif()
|
|
|
|
--
|
|
2.25.1
|
|
|