Cocoa Port: Fix a bug where changing the GPU Scaling Factor or GPU Color Depth while the emulator is paused would cause the program to freeze upon restarting the emulation via Run, Frame Advance, or Frame Jump.

This commit is contained in:
rogerman 2021-08-27 14:48:22 -07:00
parent b7c9b6b614
commit 9ac09387e3
2 changed files with 14 additions and 1 deletions

View File

@ -306,6 +306,11 @@ public:
gpuEvent->FramebufferUnlock(); gpuEvent->FramebufferUnlock();
gpuEvent->Render3DUnlock(); gpuEvent->Render3DUnlock();
if (_needRestoreRender3DLock)
{
_needRestoreRender3DLock = NO;
}
} }
- (NSSize) gpuDimensions - (NSSize) gpuDimensions
@ -374,6 +379,11 @@ public:
gpuEvent->FramebufferUnlock(); gpuEvent->FramebufferUnlock();
gpuEvent->Render3DUnlock(); gpuEvent->Render3DUnlock();
if (_needRestoreRender3DLock)
{
_needRestoreRender3DLock = NO;
}
} }
- (NSUInteger) gpuColorFormat - (NSUInteger) gpuColorFormat

View File

@ -685,7 +685,6 @@ volatile bool execute = true;
pthread_cond_signal(&threadParam.condThreadExecute); pthread_cond_signal(&threadParam.condThreadExecute);
pthread_mutex_unlock(&threadParam.mutexThreadExecute); pthread_mutex_unlock(&threadParam.mutexThreadExecute);
[[self cdsGPU] respondToPauseState:(coreState == ExecutionBehavior_Pause)];
[[self cdsController] setHardwareMicPause:(coreState != ExecutionBehavior_Run)]; [[self cdsController] setHardwareMicPause:(coreState != ExecutionBehavior_Run)];
// This method affects UI updates, but can also be called from a thread that is different from // This method affects UI updates, but can also be called from a thread that is different from
@ -1178,6 +1177,8 @@ static void* RunCoreThread(void *arg)
execControl->ApplySettingsOnExecutionLoopStart(); execControl->ApplySettingsOnExecutionLoopStart();
behavior = execControl->GetExecutionBehaviorApplied(); behavior = execControl->GetExecutionBehaviorApplied();
[[cdsCore cdsGPU] respondToPauseState:(behavior == ExecutionBehavior_Pause)];
while (!(behavior != ExecutionBehavior_Pause && execute)) while (!(behavior != ExecutionBehavior_Pause && execute))
{ {
pthread_cond_wait(&param->condThreadExecute, &param->mutexThreadExecute); pthread_cond_wait(&param->condThreadExecute, &param->mutexThreadExecute);
@ -1187,6 +1188,8 @@ static void* RunCoreThread(void *arg)
behavior = execControl->GetExecutionBehaviorApplied(); behavior = execControl->GetExecutionBehaviorApplied();
} }
[[cdsCore cdsGPU] respondToPauseState:(behavior == ExecutionBehavior_Pause)];
if ( (lastBehavior == ExecutionBehavior_Run) && (behavior != ExecutionBehavior_Run) ) if ( (lastBehavior == ExecutionBehavior_Run) && (behavior != ExecutionBehavior_Run) )
{ {
lastExecutionWaitBias = executionWaitBias; lastExecutionWaitBias = executionWaitBias;