diff --git a/desmume/src/frontend/cocoa/cocoa_GPU.mm b/desmume/src/frontend/cocoa/cocoa_GPU.mm index 4efbcc40c..986e2ef96 100644 --- a/desmume/src/frontend/cocoa/cocoa_GPU.mm +++ b/desmume/src/frontend/cocoa/cocoa_GPU.mm @@ -253,6 +253,9 @@ public: - (void) setGpuDimensions:(NSSize)theDimensions { + const size_t w = (size_t)(theDimensions.width + 0.01); + const size_t h = (size_t)(theDimensions.height + 0.01); + gpuEvent->Render3DLock(); gpuEvent->FramebufferLock(); @@ -261,7 +264,7 @@ public: pthread_rwlock_wrlock([[self sharedData] rwlockFramebufferAtIndex:1]); #endif - GPU->SetCustomFramebufferSize(theDimensions.width, theDimensions.height); + GPU->SetCustomFramebufferSize(w, h); #ifdef ENABLE_SHARED_FETCH_OBJECT fetchObject->SetFetchBuffers(GPU->GetDisplayInfo()); @@ -313,18 +316,23 @@ public: gpuEvent->Render3DLock(); gpuEvent->FramebufferLock(); -#ifdef ENABLE_SHARED_FETCH_OBJECT - pthread_rwlock_wrlock([[self sharedData] rwlockFramebufferAtIndex:0]); - pthread_rwlock_wrlock([[self sharedData] rwlockFramebufferAtIndex:1]); -#endif - - GPU->SetColorFormat((NDSColorFormat)colorFormat); + const NDSDisplayInfo &dispInfo = GPU->GetDisplayInfo(); + if (colorFormat != dispInfo.colorFormat) + { #ifdef ENABLE_SHARED_FETCH_OBJECT - fetchObject->SetFetchBuffers(GPU->GetDisplayInfo()); - pthread_rwlock_unlock([[self sharedData] rwlockFramebufferAtIndex:1]); - pthread_rwlock_unlock([[self sharedData] rwlockFramebufferAtIndex:0]); + pthread_rwlock_wrlock([[self sharedData] rwlockFramebufferAtIndex:0]); + pthread_rwlock_wrlock([[self sharedData] rwlockFramebufferAtIndex:1]); #endif + + GPU->SetColorFormat((NDSColorFormat)colorFormat); + +#ifdef ENABLE_SHARED_FETCH_OBJECT + fetchObject->SetFetchBuffers(GPU->GetDisplayInfo()); + pthread_rwlock_unlock([[self sharedData] rwlockFramebufferAtIndex:1]); + pthread_rwlock_unlock([[self sharedData] rwlockFramebufferAtIndex:0]); +#endif + } gpuEvent->FramebufferUnlock(); gpuEvent->Render3DUnlock(); diff --git a/desmume/src/frontend/cocoa/userinterface/EmuControllerDelegate.mm b/desmume/src/frontend/cocoa/userinterface/EmuControllerDelegate.mm index 804a66bab..37338d167 100644 --- a/desmume/src/frontend/cocoa/userinterface/EmuControllerDelegate.mm +++ b/desmume/src/frontend/cocoa/userinterface/EmuControllerDelegate.mm @@ -2254,6 +2254,7 @@ [[cdsCore cdsGPU] setRender3DFragmentSamplingHack:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_FragmentSamplingHack"]]; [[cdsCore cdsGPU] setGpuScale:(NSUInteger)[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_ScalingFactor"]]; [[cdsCore cdsGPU] setGpuColorFormat:(NSUInteger)[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_ColorFormat"]]; + [[[cdsCore cdsGPU] sharedData] signalFetchAtIndex:0]; // Set the stylus options per user preferences. [[cdsCore cdsController] setStylusPressure:[[NSUserDefaults standardUserDefaults] integerForKey:@"Emulation_StylusPressure"]];