VideoBackend: Add a virtual PrepareWindow function

Executes backend-specific commands on the main thread.
This commit is contained in:
Stenzek 2018-11-07 05:10:51 -08:00
parent 2e370b4ec3
commit 487ea5ab36
2 changed files with 7 additions and 0 deletions

View File

@ -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;

View File

@ -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);