mirror of https://github.com/PCSX2/pcsx2.git
GS:Mac: Properly init vulkan on main thread
This commit is contained in:
parent
d9e2bcef6d
commit
099ddfedc7
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#include <objc/message.h>
|
#include <objc/message.h>
|
||||||
|
#include <dispatch/dispatch.h>
|
||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
typedef float CGFloat;
|
typedef float CGFloat;
|
||||||
|
@ -52,6 +53,14 @@ Ret msgsend(Self self, const char* sel, Args... args)
|
||||||
|
|
||||||
static bool CreateMetalLayer(WindowInfo* wi)
|
static bool CreateMetalLayer(WindowInfo* wi)
|
||||||
{
|
{
|
||||||
|
// if (![NSThread isMainThread])
|
||||||
|
if (!msgsend<BOOL, Class>(objc_getClass("NSThread"), "isMainThread"))
|
||||||
|
{
|
||||||
|
__block bool ret;
|
||||||
|
dispatch_sync(dispatch_get_main_queue(), ^{ ret = CreateMetalLayer(wi); });
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
id view = reinterpret_cast<id>(wi->window_handle);
|
id view = reinterpret_cast<id>(wi->window_handle);
|
||||||
|
|
||||||
Class clsCAMetalLayer = objc_getClass("CAMetalLayer");
|
Class clsCAMetalLayer = objc_getClass("CAMetalLayer");
|
||||||
|
|
Loading…
Reference in New Issue