Merge branch 'linux' of git://github.com/dougvj/xenia into linux

# Conflicts:
#	.travis.yml
This commit is contained in:
DrChat
2017-12-14 19:20:02 -06:00
45 changed files with 2214 additions and 369 deletions

View File

@@ -16,6 +16,8 @@
#if XE_PLATFORM_WIN32
#define VK_USE_PLATFORM_WIN32_KHR 1
#elif XE_PLATFORM_LINUX
#define VK_USE_PLATFORM_XCB_KHR 1
#else
#error Platform not yet supported.
#endif // XE_PLATFORM_WIN32

View File

@@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2016 Ben Vanik. All rights reserved. *
* Copyright 2017 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@@ -25,6 +25,10 @@
#include "xenia/ui/vulkan/vulkan_util.h"
#include "xenia/ui/window.h"
#if XE_PLATFORM_LINUX
#include "xenia/ui/window_gtk.h"
#endif
namespace xe {
namespace ui {
namespace vulkan {
@@ -61,6 +65,29 @@ bool VulkanContext::Initialize() {
auto err = vkCreateWin32SurfaceKHR(*provider->instance(), &create_info,
nullptr, &surface);
CheckResult(err, "vkCreateWin32SurfaceKHR");
#elif XE_PLATFORM_LINUX
#ifdef GDK_WINDOWING_X11
GtkWidget* window_handle =
static_cast<GtkWidget*>(target_window_->native_handle());
GdkDisplay* gdk_display = gtk_widget_get_display(window_handle);
assert(GDK_IS_X11_DISPLAY(gdk_display));
xcb_connection_t* connection =
XGetXCBConnection(gdk_x11_display_get_xdisplay(gdk_display));
xcb_window_t window =
gdk_x11_window_get_xid(gtk_widget_get_window(window_handle));
VkXcbSurfaceCreateInfoKHR create_info;
create_info.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
create_info.pNext = nullptr;
create_info.flags = 0;
create_info.connection = static_cast<xcb_connection_t*>(
target_window_->native_platform_handle());
create_info.window = static_cast<xcb_window_t>(window);
auto err = vkCreateXcbSurfaceKHR(*provider->instance(), &create_info,
nullptr, &surface);
CheckResult(err, "vkCreateXcbSurfaceKHR");
#else
#error Unsupported GDK Backend on Linux.
#endif // GDK_WINDOWING_X11
#else
#error Platform not yet implemented.
#endif // XE_PLATFORM_WIN32

View File

@@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2016 Ben Vanik. All rights reserved. *
* Copyright 2017 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@@ -12,6 +12,7 @@
#include <gflags/gflags.h>
#include <cinttypes>
#include <climits>
#include <mutex>
#include <string>

View File

@@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2016 Ben Vanik. All rights reserved. *
* Copyright 2017 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@@ -26,6 +26,10 @@
#include "xenia/ui/vulkan/vulkan_util.h"
#include "xenia/ui/window.h"
#if XE_PLATFORM_LINUX
#include "xenia/ui/window_gtk.h"
#endif
#define VK_API_VERSION VK_API_VERSION_1_0
namespace xe {
@@ -385,6 +389,29 @@ bool VulkanInstance::QueryDevices(Window* any_target_window) {
create_info.hwnd = static_cast<HWND>(any_target_window->native_handle());
err = vkCreateWin32SurfaceKHR(handle, &create_info, nullptr, &any_surface);
CheckResult(err, "vkCreateWin32SurfaceKHR");
#elif XE_PLATFORM_LINUX
#ifdef GDK_WINDOWING_X11
GtkWidget* window_handle =
static_cast<GtkWidget*>(any_target_window->native_handle());
GdkDisplay* gdk_display = gtk_widget_get_display(window_handle);
assert(GDK_IS_X11_DISPLAY(gdk_display));
xcb_connection_t* connection =
XGetXCBConnection(gdk_x11_display_get_xdisplay(gdk_display));
xcb_window_t window =
gdk_x11_window_get_xid(gtk_widget_get_window(window_handle));
VkXcbSurfaceCreateInfoKHR create_info;
create_info.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
create_info.pNext = nullptr;
create_info.flags = 0;
create_info.connection = static_cast<xcb_connection_t*>(
any_target_window->native_platform_handle());
create_info.window = static_cast<xcb_window_t>(window);
auto err =
vkCreateXcbSurfaceKHR(handle, &create_info, nullptr, &any_surface);
CheckResult(err, "vkCreateXcbSurfaceKHR");
#else
#error Unsupported GDK Backend on Linux.
#endif // GDK_WINDOWING_X11
#else
#error Platform not yet implemented.
#endif // XE_PLATFORM_WIN32