Add a separate thread for rendering and add texture mailbox and shared context to SDL

This commit is contained in:
James Rowe
2019-09-16 20:39:19 -06:00
parent 91255b8802
commit fcbe5e1acd
3 changed files with 84 additions and 14 deletions

View File

@@ -35,6 +35,7 @@
#include "core/file_sys/cia_container.h"
#include "core/frontend/applets/default_applets.h"
#include "core/frontend/framebuffer_layout.h"
#include "core/frontend/scope_acquire_context.h"
#include "core/gdbstub/gdbstub.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/cfg/cfg.h"
@@ -347,7 +348,7 @@ int main(int argc, char** argv) {
Core::System::GetInstance().RegisterImageInterface(std::make_shared<LodePNGImageInterface>());
std::unique_ptr<EmuWindow_SDL2> emu_window{std::make_unique<EmuWindow_SDL2>(fullscreen)};
Frontend::ScopeAcquireContext scope(*emu_window);
Core::System& system{Core::System::GetInstance()};
const Core::System::ResultStatus load_result{system.Load(*emu_window, filepath)};
@@ -411,9 +412,11 @@ int main(int argc, char** argv) {
system.VideoDumper().StartDumping(dump_video, "webm", layout);
}
std::thread render_thread([&emu_window] { emu_window->Present(); });
while (emu_window->IsOpen()) {
system.RunLoop();
}
render_thread.join();
Core::Movie::GetInstance().Shutdown();
if (system.VideoDumper().IsDumping()) {