Cocoa Port: Signal a fetch at startup, after reading the user defaults for GPU Scaling Factor and GPU Color Depth, in order to guarantee that the client-side fetch buffers will be cleared.

This commit is contained in:
rogerman 2017-11-21 19:05:11 -08:00
parent 5890540007
commit 96bd35517b
2 changed files with 19 additions and 10 deletions

View File

@ -253,6 +253,9 @@ public:
- (void) setGpuDimensions:(NSSize)theDimensions - (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->Render3DLock();
gpuEvent->FramebufferLock(); gpuEvent->FramebufferLock();
@ -261,7 +264,7 @@ public:
pthread_rwlock_wrlock([[self sharedData] rwlockFramebufferAtIndex:1]); pthread_rwlock_wrlock([[self sharedData] rwlockFramebufferAtIndex:1]);
#endif #endif
GPU->SetCustomFramebufferSize(theDimensions.width, theDimensions.height); GPU->SetCustomFramebufferSize(w, h);
#ifdef ENABLE_SHARED_FETCH_OBJECT #ifdef ENABLE_SHARED_FETCH_OBJECT
fetchObject->SetFetchBuffers(GPU->GetDisplayInfo()); fetchObject->SetFetchBuffers(GPU->GetDisplayInfo());
@ -313,18 +316,23 @@ public:
gpuEvent->Render3DLock(); gpuEvent->Render3DLock();
gpuEvent->FramebufferLock(); gpuEvent->FramebufferLock();
#ifdef ENABLE_SHARED_FETCH_OBJECT const NDSDisplayInfo &dispInfo = GPU->GetDisplayInfo();
pthread_rwlock_wrlock([[self sharedData] rwlockFramebufferAtIndex:0]);
pthread_rwlock_wrlock([[self sharedData] rwlockFramebufferAtIndex:1]);
#endif
GPU->SetColorFormat((NDSColorFormat)colorFormat);
if (colorFormat != dispInfo.colorFormat)
{
#ifdef ENABLE_SHARED_FETCH_OBJECT #ifdef ENABLE_SHARED_FETCH_OBJECT
fetchObject->SetFetchBuffers(GPU->GetDisplayInfo()); pthread_rwlock_wrlock([[self sharedData] rwlockFramebufferAtIndex:0]);
pthread_rwlock_unlock([[self sharedData] rwlockFramebufferAtIndex:1]); pthread_rwlock_wrlock([[self sharedData] rwlockFramebufferAtIndex:1]);
pthread_rwlock_unlock([[self sharedData] rwlockFramebufferAtIndex:0]);
#endif #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->FramebufferUnlock();
gpuEvent->Render3DUnlock(); gpuEvent->Render3DUnlock();

View File

@ -2254,6 +2254,7 @@
[[cdsCore cdsGPU] setRender3DFragmentSamplingHack:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_FragmentSamplingHack"]]; [[cdsCore cdsGPU] setRender3DFragmentSamplingHack:[[NSUserDefaults standardUserDefaults] boolForKey:@"Render3D_FragmentSamplingHack"]];
[[cdsCore cdsGPU] setGpuScale:(NSUInteger)[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_ScalingFactor"]]; [[cdsCore cdsGPU] setGpuScale:(NSUInteger)[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_ScalingFactor"]];
[[cdsCore cdsGPU] setGpuColorFormat:(NSUInteger)[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_ColorFormat"]]; [[cdsCore cdsGPU] setGpuColorFormat:(NSUInteger)[[NSUserDefaults standardUserDefaults] integerForKey:@"Render3D_ColorFormat"]];
[[[cdsCore cdsGPU] sharedData] signalFetchAtIndex:0];
// Set the stylus options per user preferences. // Set the stylus options per user preferences.
[[cdsCore cdsController] setStylusPressure:[[NSUserDefaults standardUserDefaults] integerForKey:@"Emulation_StylusPressure"]]; [[cdsCore cdsController] setStylusPressure:[[NSUserDefaults standardUserDefaults] integerForKey:@"Emulation_StylusPressure"]];