MetalHostDisplay: Fix fullscreen in Qt interface

This commit is contained in:
Connor McLaughlin 2022-05-03 19:28:38 +10:00 committed by refractionpcsx2
parent bec9b34f54
commit af4c047c41
1 changed files with 4 additions and 3 deletions

View File

@ -83,6 +83,9 @@ bool MetalHostDisplay::HasRenderSurface() const { return static_cast<bool>(m_la
void MetalHostDisplay::AttachSurfaceOnMainThread()
{
ASSERT([NSThread isMainThread]);
m_layer = MRCRetain([CAMetalLayer layer]);
[m_layer setDrawableSize:CGSizeMake(m_window_info.surface_width, m_window_info.surface_height)];
[m_layer setDevice:m_dev.dev];
m_view = MRCRetain((__bridge NSView*)m_window_info.window_handle);
[m_view setWantsLayer:YES];
[m_view setLayer:m_layer];
@ -94,6 +97,7 @@ void MetalHostDisplay::DetachSurfaceOnMainThread()
[m_view setLayer:nullptr];
[m_view setWantsLayer:NO];
m_view = nullptr;
m_layer = nullptr;
}
bool MetalHostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, VsyncMode vsync, bool threaded_presentation, bool debug_device)
@ -137,9 +141,6 @@ bool MetalHostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view
{
OnMainThread([this]
{
m_layer = MRCRetain([CAMetalLayer layer]);
[m_layer setDrawableSize:CGSizeMake(m_window_info.surface_width, m_window_info.surface_height)];
[m_layer setDevice:m_dev.dev];
AttachSurfaceOnMainThread();
});
SetVSync(vsync);