vk: Stop using internal defines to structure platform-specific code

This commit is contained in:
kd-11 2025-04-29 00:29:17 +03:00 committed by kd-11
parent 2aca213ba1
commit 1af67f39ca
3 changed files with 13 additions and 8 deletions

View file

@ -6,8 +6,13 @@
#define VK_USE_PLATFORM_MACOS_MVK #define VK_USE_PLATFORM_MACOS_MVK
#elif defined(ANDROID) #elif defined(ANDROID)
#define VK_USE_PLATFORM_ANDROID_KHR #define VK_USE_PLATFORM_ANDROID_KHR
#elif HAVE_X11 #else
#define VK_USE_PLATFORM_XLIB_KHR #if defined(HAVE_X11)
#define VK_USE_PLATFORM_XLIB_KHR
#endif
#if defined(HAVE_WAYLAND)
#define VK_USE_PLATFORM_WAYLAND_KHR
#endif
#endif #endif
#ifdef _MSC_VER #ifdef _MSC_VER

View file

@ -174,14 +174,14 @@ namespace vk
found_surface_ext = true; found_surface_ext = true;
} }
#endif #endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR #ifdef HAVE_WAYLAND
if (support.is_supported(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME)) if (support.is_supported(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME))
{ {
extensions.push_back(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME); extensions.push_back(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME);
found_surface_ext = true; found_surface_ext = true;
} }
#endif //(WAYLAND) #endif //(WAYLAND)
#ifdef VK_USE_PLATFORM_ANDROID_KHR #ifdef ANDROID
if (support.is_supported(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME)) if (support.is_supported(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME))
{ {
extensions.push_back(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME); extensions.push_back(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME);

View file

@ -11,7 +11,7 @@ using Display = struct _XDisplay;
using Window = unsigned long; using Window = unsigned long;
#endif #endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR #ifdef HAVE_WAYLAND
#include <wayland-client.h> #include <wayland-client.h>
#endif #endif
@ -22,14 +22,14 @@ using display_handle_t = void*; // NSView
#else #else
#include <variant> #include <variant>
using display_handle_t = std::variant< using display_handle_t = std::variant<
#if defined(HAVE_X11) && defined(VK_USE_PLATFORM_WAYLAND_KHR) #if defined(HAVE_X11) && defined(HAVE_WAYLAND)
std::pair<Display*, Window>, std::pair<wl_display*, wl_surface*> std::pair<Display*, Window>, std::pair<wl_display*, wl_surface*>
#elif defined(HAVE_X11) #elif defined(HAVE_X11)
std::pair<Display*, Window> std::pair<Display*, Window>
#elif defined(VK_USE_PLATFORM_WAYLAND_KHR) #elif defined(HAVE_WAYLAND)
std::pair<wl_display*, wl_surface*> std::pair<wl_display*, wl_surface*>
#elif defined(ANDROID) #elif defined(ANDROID)
struct ANativeWindow * struct ANativeWindow*
#endif #endif
>; >;
#endif #endif