[Vulkan v2] GDK VkSurface

This commit is contained in:
Triang3l 2019-08-10 14:52:33 +03:00
parent af93986c8f
commit fb656f3493
2 changed files with 23 additions and 1 deletions

View File

@ -66,6 +66,21 @@ bool VulkanContext::Initialize() {
static_cast<HWND>(target_window_->native_handle());
surface_create_result = vkCreateWin32SurfaceKHR(
instance, &surface_create_info, nullptr, &surface_);
#elif XE_PLATFORM_LINUX
#ifdef GDK_WINDOWING_X11
VkXcbSurfaceCreateInfoKHR surface_create_info;
surface_create_info.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
surface_create_info.pNext = nullptr;
surface_create_info.flags = 0;
surface_create_info.connection = static_cast<xcb_connection_t*>(
target_window_->native_platform_handle());
surface_create_info.window = gdk_x11_window_get_xid(gtk_widget_get_window(
static_cast<GtkWidget*>(target_window_->native_handle())));
surface_create_result = vkCreateXcbSurfaceKHR(
instance, &surface_create_info, nullptr, &surface_);
#else
#error No Vulkan surface creation for the GDK backend implemented yet.
#endif
#else
#error No Vulkan surface creation for the platform implemented yet.
#endif

View File

@ -16,9 +16,16 @@
#include "xenia/base/platform.h"
#include "xenia/ui/graphics_provider.h"
#if XE_PLATFORM_WIN32 && !defined(VK_USE_PLATFORM_WIN32_KHR)
#if XE_PLATFORM_WIN32
#ifndef VK_USE_PLATFORM_WIN32_KHR
#define VK_USE_PLATFORM_WIN32_KHR 1
#endif
#elif XE_PLATFORM_LINUX
#include "xenia/ui/window_gtk.h"
#if defined(GDK_WINDOWING_X11) && !defined(VK_USE_PLATFORM_XCB_KHR)
#define VK_USE_PLATFORM_XCB_KHR 1
#endif
#endif
#include "third_party/volk/volk.h"
#define XELOGVK XELOGI