Add support for Vulkan on Wayland

The variable VK_USE_PLATFORM_WAYLAND_KHR is actually used by the Vulkan
header, so use it here too.
This commit is contained in:
Greg V 2017-12-31 18:33:43 +03:00 committed by kd-11
parent 51a2b43d81
commit fbceec47b8
9 changed files with 245 additions and 62 deletions

View file

@ -8,6 +8,13 @@
#include <QTimer>
#include <QThread>
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
#include <QGuiApplication>
#include <qpa/qplatformnativeinterface.h>
#endif
#include <X11/Xlib.h>
#include <string>
#include "rpcs3_version.h"
@ -145,12 +152,28 @@ void gs_frame::show()
});
}
void* gs_frame::handle() const
display_handle_t gs_frame::handle() const
{
#ifdef _WIN32
return (HWND) this->winId();
#else
return (void *)this->winId();
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
struct wl_display *wl_dpy = static_cast<struct wl_display *>(
native->nativeResourceForWindow("display", NULL));
struct wl_surface *wl_surf = static_cast<struct wl_surface *>(
native->nativeResourceForWindow("surface", (QWindow *)this));
if (wl_dpy != nullptr && wl_surf != nullptr)
{
return std::make_pair(wl_dpy, wl_surf);
}
else
{
#endif
return std::make_pair(XOpenDisplay(0), (unsigned long)(this->winId()));
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
}
#endif
#endif
}