qt: Extract CAMetalLayer from NSView to pass to MoltenVK.
This commit is contained in:
@@ -250,6 +250,8 @@ if (APPLE)
|
|||||||
set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE TRUE)
|
set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE TRUE)
|
||||||
set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
|
set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
|
||||||
target_sources(citra-qt PRIVATE
|
target_sources(citra-qt PRIVATE
|
||||||
|
applesurfacehelper.h
|
||||||
|
applesurfacehelper.mm
|
||||||
macos_authorization.h
|
macos_authorization.h
|
||||||
macos_authorization.mm
|
macos_authorization.mm
|
||||||
)
|
)
|
||||||
|
11
src/citra_qt/applesurfacehelper.h
Normal file
11
src/citra_qt/applesurfacehelper.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// Copyright 2022 Citra Emulator Project
|
||||||
|
// Licensed under GPLv2 or any later version
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace AppleSurfaceHelper {
|
||||||
|
|
||||||
|
void* GetSurfaceLayer(void* surface);
|
||||||
|
|
||||||
|
} // namespace AppleSurfaceHelper
|
16
src/citra_qt/applesurfacehelper.mm
Normal file
16
src/citra_qt/applesurfacehelper.mm
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// Copyright 2022 Citra Emulator Project
|
||||||
|
// Licensed under GPLv2 or any later version
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
#include "citra_qt/applesurfacehelper.h"
|
||||||
|
|
||||||
|
namespace AppleSurfaceHelper {
|
||||||
|
|
||||||
|
void* GetSurfaceLayer(void* surface) {
|
||||||
|
NSView* view = static_cast<NSView*>(surface);
|
||||||
|
return view.layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // AppleSurfaceHelper
|
@@ -24,6 +24,10 @@
|
|||||||
#include "video_core/renderer_base.h"
|
#include "video_core/renderer_base.h"
|
||||||
#include "video_core/video_core.h"
|
#include "video_core/video_core.h"
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#include "citra_qt/applesurfacehelper.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(WIN32)
|
#if !defined(WIN32)
|
||||||
#include <qpa/qplatformnativeinterface.h>
|
#include <qpa/qplatformnativeinterface.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -334,8 +338,10 @@ static Frontend::EmuWindow::WindowSystemInfo GetWindowSystemInfo(QWindow* window
|
|||||||
wsi.type = GetWindowSystemType();
|
wsi.type = GetWindowSystemType();
|
||||||
|
|
||||||
// Our Win32 Qt external doesn't have the private API.
|
// Our Win32 Qt external doesn't have the private API.
|
||||||
#if defined(WIN32) || defined(__APPLE__)
|
#if defined(WIN32)
|
||||||
wsi.render_surface = window ? reinterpret_cast<void*>(window->winId()) : nullptr;
|
wsi.render_surface = window ? reinterpret_cast<void*>(window->winId()) : nullptr;
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
wsi.render_surface = window ? AppleSurfaceHelper::GetSurfaceLayer(reinterpret_cast<void*>(window->winId())) : nullptr;
|
||||||
#else
|
#else
|
||||||
QPlatformNativeInterface* pni = QGuiApplication::platformNativeInterface();
|
QPlatformNativeInterface* pni = QGuiApplication::platformNativeInterface();
|
||||||
wsi.display_connection = pni->nativeResourceForWindow("display", window);
|
wsi.display_connection = pni->nativeResourceForWindow("display", window);
|
||||||
|
Reference in New Issue
Block a user