Cocoa Port (OpenEmu Plug-in): Changing a single display mode no longer applies all settings each time. Now, individual settings are applied only if the relevant state bits were actually changed.

- This change helps make display view resizing smoother.
This commit is contained in:
rogerman 2022-05-07 11:33:02 -07:00
parent 289c68fae8
commit 9c3e206fed
1 changed files with 75 additions and 53 deletions

View File

@ -591,6 +591,8 @@ void UpdateDisplayPropertiesFromStates(uint64_t displayModeStates, ClientDisplay
return;
}
if (appliedState != _displayModeStatesApplied)
{
ClientDisplaySource displaySource[2] = { ClientDisplaySource_DeterminedByNDS, ClientDisplaySource_DeterminedByNDS };
if ( DISPLAYMODE_STATEBIT_CHECK(appliedState, NDSDisplayOptionID_VideoSourceMain_None) ) displaySource[NDSDisplayID_Main] = ClientDisplaySource_None;
@ -630,14 +632,11 @@ void UpdateDisplayPropertiesFromStates(uint64_t displayModeStates, ClientDisplay
}
_cdp->SetHUDShowVideoFPS(isVideoFPSEnabled);
ClientDisplayPresenterProperties newProps;
UpdateDisplayPropertiesFromStates(appliedState, newProps);
newProps.clientWidth = _OEViewSize.width;
newProps.clientHeight = _OEViewSize.height;
_cdp->CommitPresenterProperties(newProps);
_cdp->SetupPresenterProperties();
[cdsGPU setRender3DFragmentSamplingHack:(DISPLAYMODE_STATEBIT_CHECK(appliedState, NDSDisplayOptionID_GPU_Software_FragmentSamplingHack)) ? YES : NO];
[cdsGPU setRender3DTextureSmoothing:(DISPLAYMODE_STATEBIT_CHECK(appliedState, NDSDisplayOptionID_GPU_OpenGL_SmoothTextures)) ? YES : NO];
if ( (appliedState & NDSDISPLAYMODE_GROUPBITMASK_GPUENGINE) != (_displayModeStatesApplied & NDSDISPLAYMODE_GROUPBITMASK_GPUENGINE) )
{
if ( DISPLAYMODE_STATEBIT_CHECK(appliedState, NDSDisplayOptionID_GPU_Engine_Software) )
{
[cdsGPU setRender3DRenderingEngine:CORE3DLIST_SWRASTERIZE];
@ -648,13 +647,29 @@ void UpdateDisplayPropertiesFromStates(uint64_t displayModeStates, ClientDisplay
[cdsGPU setRender3DRenderingEngine:CORE3DLIST_OPENGL];
[cdsGPU setGpuColorFormat:NDSColorFormat_BGR888_Rev];
}
}
[cdsGPU setRender3DFragmentSamplingHack:(DISPLAYMODE_STATEBIT_CHECK(appliedState, NDSDisplayOptionID_GPU_Software_FragmentSamplingHack)) ? YES : NO];
[cdsGPU setRender3DTextureSmoothing:(DISPLAYMODE_STATEBIT_CHECK(appliedState, NDSDisplayOptionID_GPU_OpenGL_SmoothTextures)) ? YES : NO];
if ( (appliedState & NDSDISPLAYMODE_GROUPBITMASK_RENDERSCALING) != (_displayModeStatesApplied & NDSDISPLAYMODE_GROUPBITMASK_RENDERSCALING) )
{
[cdsGPU setGpuScale:_selectedRenderScaling];
[cdsGPU setRender3DTextureScalingFactor:_selectedTextureScaling];
}
if ( (appliedState & NDSDISPLAYMODE_GROUPBITMASK_TEXTURESCALING) != (_displayModeStatesApplied & NDSDISPLAYMODE_GROUPBITMASK_TEXTURESCALING) )
{
[cdsGPU setRender3DTextureScalingFactor:_selectedTextureScaling];
}
_displayModeStatesApplied = appliedState;
}
ClientDisplayPresenterProperties newProps;
UpdateDisplayPropertiesFromStates(appliedState, newProps);
newProps.clientWidth = _OEViewSize.width;
newProps.clientHeight = _OEViewSize.height;
_cdp->CommitPresenterProperties(newProps);
_cdp->SetupPresenterProperties();
_displayModeStatesApplied = _displayModeStatesPending;
_displayModeStatesPending = 0;
}
@ -740,7 +755,6 @@ void UpdateDisplayPropertiesFromStates(uint64_t displayModeStates, ClientDisplay
s = [self setDisplayModeState:s optionID:NDSDisplayOptionID_GPU_OpenGL_SmoothTextures state:[userDefaultsDisplayMode objectForKey:@NDSDISPLAYMODE_PREFKEY_GPU_OPENGL_SMOOTHTEXTURES]];
[self setNdsDisplayMode:s];
_displayModeStatesApplied = _displayModeStatesPending;
return isRomLoaded;
}
@ -907,7 +921,15 @@ void UpdateDisplayPropertiesFromStates(uint64_t displayModeStates, ClientDisplay
{
_canRespondToViewResize = YES;
_OEViewSize = size;
if (_displayModeStatesPending != 0)
{
[self setNdsDisplayMode:_displayModeStatesPending];
}
else
{
[self setNdsDisplayMode:_displayModeStatesApplied];
}
return YES;
}