There was an error fetching the commit references. Please try again later.
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.
Showing
- src/core/frontend/emu_window.h 2 additions, 2 deletionssrc/core/frontend/emu_window.h
- src/video_core/renderer_opengl/renderer_opengl.cpp 1 addition, 1 deletionsrc/video_core/renderer_opengl/renderer_opengl.cpp
- src/video_core/renderer_vulkan/renderer_vulkan.cpp 1 addition, 3 deletionssrc/video_core/renderer_vulkan/renderer_vulkan.cpp
- src/yuzu/bootmanager.cpp 1 addition, 1 deletionsrc/yuzu/bootmanager.cpp
- src/yuzu/bootmanager.h 1 addition, 1 deletionsrc/yuzu/bootmanager.h
- src/yuzu_cmd/emu_window/emu_window_sdl2.cpp 51 additions, 49 deletionssrc/yuzu_cmd/emu_window/emu_window_sdl2.cpp
- src/yuzu_cmd/emu_window/emu_window_sdl2.h 10 additions, 10 deletionssrc/yuzu_cmd/emu_window/emu_window_sdl2.h
- src/yuzu_cmd/yuzu.cpp 1 addition, 1 deletionsrc/yuzu_cmd/yuzu.cpp
- src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp 0 additions, 2 deletionssrc/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp
- src/yuzu_tester/emu_window/emu_window_sdl2_hide.h 0 additions, 3 deletionssrc/yuzu_tester/emu_window/emu_window_sdl2_hide.h
Loading
Please register or sign in to comment