From a545344268fbfd2f3464df1579c8942d30a672d3 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 11 Mar 2020 23:10:28 +1000 Subject: [PATCH] VideoBackends: Make it possible for PrepareWindow to change the surface Again, needed for MoltenVK. --- Source/Core/Core/Core.cpp | 5 +++-- Source/Core/VideoBackends/Vulkan/VideoBackend.h | 2 +- Source/Core/VideoBackends/Vulkan/main.cpp | 2 +- Source/Core/VideoCommon/VideoBackendBase.h | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index dfad2b100e..1a62b44d82 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -233,12 +233,13 @@ bool Init(std::unique_ptr boot, const WindowSystemInfo& wsi) Host_UpdateMainFrame(); // Disable any menus or buttons at boot // Issue any API calls which must occur on the main thread for the graphics backend. - g_video_backend->PrepareWindow(wsi); + WindowSystemInfo prepared_wsi(wsi); + g_video_backend->PrepareWindow(prepared_wsi); // Start the emu thread s_done_booting.Reset(); s_is_booting.Set(); - s_emu_thread = std::thread(EmuThread, std::move(boot), wsi); + s_emu_thread = std::thread(EmuThread, std::move(boot), prepared_wsi); return true; } diff --git a/Source/Core/VideoBackends/Vulkan/VideoBackend.h b/Source/Core/VideoBackends/Vulkan/VideoBackend.h index 91cdbb6a1e..bcc4f9d2c8 100644 --- a/Source/Core/VideoBackends/Vulkan/VideoBackend.h +++ b/Source/Core/VideoBackends/Vulkan/VideoBackend.h @@ -18,6 +18,6 @@ public: std::string GetName() const override { return "Vulkan"; } std::string GetDisplayName() const override { return _trans("Vulkan"); } void InitBackendInfo() override; - void PrepareWindow(const WindowSystemInfo& wsi) override; + void PrepareWindow(WindowSystemInfo& wsi) override; }; } // namespace Vulkan diff --git a/Source/Core/VideoBackends/Vulkan/main.cpp b/Source/Core/VideoBackends/Vulkan/main.cpp index 93b7e9dfe4..80063ff844 100644 --- a/Source/Core/VideoBackends/Vulkan/main.cpp +++ b/Source/Core/VideoBackends/Vulkan/main.cpp @@ -304,7 +304,7 @@ static bool IsRunningOnMojaveOrHigher() } #endif -void VideoBackend::PrepareWindow(const WindowSystemInfo& wsi) +void VideoBackend::PrepareWindow(WindowSystemInfo& wsi) { #if defined(VK_USE_PLATFORM_MACOS_MVK) // This is kinda messy, but it avoids having to write Objective C++ just to create a metal layer. diff --git a/Source/Core/VideoCommon/VideoBackendBase.h b/Source/Core/VideoCommon/VideoBackendBase.h index b02122621b..7eeffaaf95 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.h +++ b/Source/Core/VideoCommon/VideoBackendBase.h @@ -47,7 +47,7 @@ public: // Prepares a native window for rendering. This is called on the main thread, or the // thread which owns the window. - virtual void PrepareWindow(const WindowSystemInfo& wsi) {} + virtual void PrepareWindow(WindowSystemInfo& wsi) {} static std::string BadShaderFilename(const char* shader_stage, int counter);