summaryrefslogtreecommitdiff
path: root/src/yuzu_tester
diff options
context:
space:
mode:
authorcomex <comexk@gmail.com>2020-11-22 16:05:18 -0500
committercomex <comexk@gmail.com>2020-11-23 17:58:49 -0500
commit994f4977810749c0b597e7a7531a02d907967a68 (patch)
tree82eaf8b6dea5baf60e17601771dc8191b8e69a8f /src/yuzu_tester
parent5d1447897aebc371439507f42507bd98f1cfc223 (diff)
Overhaul EmuWindow::PollEvents to fix yuzu-cmd calling SDL_PollEvents off main thread
EmuWindow::PollEvents was called from the GPU thread (or the CPU thread in sync-GPU mode) when swapping buffers. It had three implementations: - In GRenderWindow, it didn't actually poll events, just set a flag and emit a signal to indicate that a frame was displayed. - In EmuWindow_SDL2_Hide, it did nothing. - In EmuWindow_SDL2, it did call SDL_PollEvents, but this is wrong because SDL_PollEvents is supposed to be called on the thread that set up video - in this case, the main thread, which was sleeping in a busyloop (regardless of whether sync-GPU was enabled). On macOS this causes a crash. To fix this: - Rename EmuWindow::PollEvents to OnFrameDisplayed, and give it a default implementation that does nothing. - In EmuWindow_SDL2, do not override OnFrameDisplayed, but instead have the main thread call SDL_WaitEvent in a loop.
Diffstat (limited to 'src/yuzu_tester')
-rw-r--r--src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp2
-rw-r--r--src/yuzu_tester/emu_window/emu_window_sdl2_hide.h3
2 files changed, 0 insertions, 5 deletions
diff --git a/src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp b/src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp
index 78f75fb38..358e03870 100644
--- a/src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp
+++ b/src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp
@@ -109,8 +109,6 @@ EmuWindow_SDL2_Hide::~EmuWindow_SDL2_Hide() {
SDL_Quit();
}
-void EmuWindow_SDL2_Hide::PollEvents() {}
-
bool EmuWindow_SDL2_Hide::IsShown() const {
return false;
}
diff --git a/src/yuzu_tester/emu_window/emu_window_sdl2_hide.h b/src/yuzu_tester/emu_window/emu_window_sdl2_hide.h
index a553b4b95..adccdf35e 100644
--- a/src/yuzu_tester/emu_window/emu_window_sdl2_hide.h
+++ b/src/yuzu_tester/emu_window/emu_window_sdl2_hide.h
@@ -17,9 +17,6 @@ public:
explicit EmuWindow_SDL2_Hide();
~EmuWindow_SDL2_Hide();
- /// Polls window events
- void PollEvents() override;
-
/// Whether the screen is being shown or not.
bool IsShown() const override;