summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2018-11-07 05:10:51 -0800
committerStenzek <stenzek@gmail.com>2018-11-07 05:12:20 -0800
commit487ea5ab36120130ec2e43a458780df4deea963b (patch)
treef4a5e2cd53c6fcac1d34d3522c4bcf3759bb4a2d /Source/Core
parent2e370b4ec3427637da4e19e7c3fdc7d9467a2cbc (diff)
VideoBackend: Add a virtual PrepareWindow function
Executes backend-specific commands on the main thread.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Core.cpp3
-rw-r--r--Source/Core/VideoCommon/VideoBackendBase.h4
2 files changed, 7 insertions, 0 deletions
diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp
index c64eb1e22e..91f1200f73 100644
--- a/Source/Core/Core/Core.cpp
+++ b/Source/Core/Core/Core.cpp
@@ -214,6 +214,9 @@ bool Init(std::unique_ptr<BootParameters> 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);
+
// Start the emu thread
s_emu_thread = std::thread(EmuThread, std::move(boot), wsi);
return true;
diff --git a/Source/Core/VideoCommon/VideoBackendBase.h b/Source/Core/VideoCommon/VideoBackendBase.h
index 83a74b0608..d1dada2247 100644
--- a/Source/Core/VideoCommon/VideoBackendBase.h
+++ b/Source/Core/VideoCommon/VideoBackendBase.h
@@ -43,6 +43,10 @@ public:
virtual std::string GetDisplayName() const { return GetName(); }
virtual void InitBackendInfo() = 0;
+ // 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) {}
+
void Video_ExitLoop();
void Video_BeginField(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u64 ticks);