Merge pull request #11205 from TellowKrinkle/AutoPresent

VideoBackends:Metal: Default to presentDrawable when vsync is on
This commit is contained in:
Pierre Bourdon 2023-01-30 09:01:18 +01:00 committed by GitHub
commit a2f4606d33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 6 deletions

View File

@ -97,8 +97,8 @@ const Info<bool> GFX_CPU_CULL{{System::GFX, "Settings", "CPUCull"}, false};
const Info<TriState> GFX_MTL_MANUALLY_UPLOAD_BUFFERS{
{System::GFX, "Settings", "ManuallyUploadBuffers"}, TriState::Auto};
const Info<bool> GFX_MTL_USE_PRESENT_DRAWABLE{{System::GFX, "Settings", "MTLUsePresentDrawable"},
false};
const Info<TriState> GFX_MTL_USE_PRESENT_DRAWABLE{
{System::GFX, "Settings", "MTLUsePresentDrawable"}, TriState::Auto};
const Info<bool> GFX_SW_DUMP_OBJECTS{{System::GFX, "Settings", "SWDumpObjects"}, false};
const Info<bool> GFX_SW_DUMP_TEV_STAGES{{System::GFX, "Settings", "SWDumpTevStages"}, false};

View File

@ -85,7 +85,7 @@ extern const Info<bool> GFX_PREFER_VS_FOR_LINE_POINT_EXPANSION;
extern const Info<bool> GFX_CPU_CULL;
extern const Info<TriState> GFX_MTL_MANUALLY_UPLOAD_BUFFERS;
extern const Info<bool> GFX_MTL_USE_PRESENT_DRAWABLE;
extern const Info<TriState> GFX_MTL_USE_PRESENT_DRAWABLE;
extern const Info<bool> GFX_SW_DUMP_OBJECTS;
extern const Info<bool> GFX_SW_DUMP_TEV_STAGES;

View File

@ -459,7 +459,9 @@ void Metal::Renderer::PresentBackbuffer()
// when windowed (or fullscreen with vsync enabled, but that's more understandable).
// On the other hand, it helps Xcode's GPU captures start and stop on frame boundaries
// which is convenient. Put it here as a default-off config, which we can override in Xcode.
if (g_ActiveConfig.bUsePresentDrawable)
// It also seems to improve frame pacing, so enable it by default with vsync
if (g_ActiveConfig.iUsePresentDrawable == TriState::On ||
(g_ActiveConfig.iUsePresentDrawable == TriState::Auto && g_ActiveConfig.bVSyncActive))
[g_state_tracker->GetRenderCmdBuf() presentDrawable:m_drawable];
else
[g_state_tracker->GetRenderCmdBuf()

View File

@ -56,7 +56,7 @@ void VideoConfig::Refresh()
bVSync = Config::Get(Config::GFX_VSYNC);
iAdapter = Config::Get(Config::GFX_ADAPTER);
iManuallyUploadBuffers = Config::Get(Config::GFX_MTL_MANUALLY_UPLOAD_BUFFERS);
bUsePresentDrawable = Config::Get(Config::GFX_MTL_USE_PRESENT_DRAWABLE);
iUsePresentDrawable = Config::Get(Config::GFX_MTL_USE_PRESENT_DRAWABLE);
bWidescreenHack = Config::Get(Config::GFX_WIDESCREEN_HACK);
aspect_mode = Config::Get(Config::GFX_ASPECT_RATIO);

View File

@ -177,7 +177,7 @@ struct VideoConfig final
// Metal only config
TriState iManuallyUploadBuffers = TriState::Auto;
bool bUsePresentDrawable = false;
TriState iUsePresentDrawable = TriState::Auto;
// Enable API validation layers, currently only supported with Vulkan.
bool bEnableValidationLayer = false;