Bootmanager/CPU_Manager: Correct shader caches and sync GPU on OpenGL.
This commit is contained in:
parent
19165cd859
commit
54e304fe2a
2 changed files with 13 additions and 6 deletions
|
@ -22,13 +22,7 @@ CpuManager::CpuManager(System& system) : system{system} {}
|
||||||
CpuManager::~CpuManager() = default;
|
CpuManager::~CpuManager() = default;
|
||||||
|
|
||||||
void CpuManager::ThreadStart(CpuManager& cpu_manager, std::size_t core) {
|
void CpuManager::ThreadStart(CpuManager& cpu_manager, std::size_t core) {
|
||||||
if (!cpu_manager.is_async_gpu && !cpu_manager.is_multicore) {
|
|
||||||
cpu_manager.render_window->MakeCurrent();
|
|
||||||
}
|
|
||||||
cpu_manager.RunThread(core);
|
cpu_manager.RunThread(core);
|
||||||
if (!cpu_manager.is_async_gpu && !cpu_manager.is_multicore) {
|
|
||||||
cpu_manager.render_window->DoneCurrent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CpuManager::SetRenderWindow(Core::Frontend::EmuWindow& render_window) {
|
void CpuManager::SetRenderWindow(Core::Frontend::EmuWindow& render_window) {
|
||||||
|
@ -353,10 +347,16 @@ void CpuManager::RunThread(std::size_t core) {
|
||||||
data.host_context = Common::Fiber::ThreadToFiber();
|
data.host_context = Common::Fiber::ThreadToFiber();
|
||||||
data.is_running = false;
|
data.is_running = false;
|
||||||
data.initialized = true;
|
data.initialized = true;
|
||||||
|
const bool sc_sync = !is_async_gpu && !is_multicore;
|
||||||
|
bool sc_sync_first_use = sc_sync;
|
||||||
/// Running
|
/// Running
|
||||||
while (running_mode) {
|
while (running_mode) {
|
||||||
data.is_running = false;
|
data.is_running = false;
|
||||||
data.enter_barrier->Wait();
|
data.enter_barrier->Wait();
|
||||||
|
if (sc_sync_first_use) {
|
||||||
|
render_window->MakeCurrent();
|
||||||
|
sc_sync_first_use = false;
|
||||||
|
}
|
||||||
auto& scheduler = system.Kernel().CurrentScheduler();
|
auto& scheduler = system.Kernel().CurrentScheduler();
|
||||||
Kernel::Thread* current_thread = scheduler.GetCurrentThread();
|
Kernel::Thread* current_thread = scheduler.GetCurrentThread();
|
||||||
data.is_running = true;
|
data.is_running = true;
|
||||||
|
@ -366,6 +366,9 @@ void CpuManager::RunThread(std::size_t core) {
|
||||||
data.exit_barrier->Wait();
|
data.exit_barrier->Wait();
|
||||||
data.is_paused = false;
|
data.is_paused = false;
|
||||||
}
|
}
|
||||||
|
if (sc_sync) {
|
||||||
|
render_window->DoneCurrent();
|
||||||
|
}
|
||||||
/// Time to cleanup
|
/// Time to cleanup
|
||||||
data.host_context->Exit();
|
data.host_context->Exit();
|
||||||
data.enter_barrier.reset();
|
data.enter_barrier.reset();
|
||||||
|
|
|
@ -56,6 +56,8 @@ void EmuThread::run() {
|
||||||
|
|
||||||
Core::System::GetInstance().RegisterHostThread();
|
Core::System::GetInstance().RegisterHostThread();
|
||||||
|
|
||||||
|
context.MakeCurrent();
|
||||||
|
|
||||||
Core::System::GetInstance().Renderer().Rasterizer().LoadDiskResources(
|
Core::System::GetInstance().Renderer().Rasterizer().LoadDiskResources(
|
||||||
stop_run, [this](VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total) {
|
stop_run, [this](VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total) {
|
||||||
emit LoadProgress(stage, value, total);
|
emit LoadProgress(stage, value, total);
|
||||||
|
@ -63,6 +65,8 @@ void EmuThread::run() {
|
||||||
|
|
||||||
emit LoadProgress(VideoCore::LoadCallbackStage::Complete, 0, 0);
|
emit LoadProgress(VideoCore::LoadCallbackStage::Complete, 0, 0);
|
||||||
|
|
||||||
|
context.DoneCurrent();
|
||||||
|
|
||||||
// Holds whether the cpu was running during the last iteration,
|
// Holds whether the cpu was running during the last iteration,
|
||||||
// so that the DebugModeLeft signal can be emitted before the
|
// so that the DebugModeLeft signal can be emitted before the
|
||||||
// next execution step
|
// next execution step
|
||||||
|
|
Loading…
Reference in a new issue