summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorTellowKrinkle <tellowkrinkle@gmail.com>2022-10-24 17:40:32 -0500
committerTellowKrinkle <tellowkrinkle@gmail.com>2022-10-24 17:55:30 -0500
commitfa8134dedab267a4efe4c9f64ca219a4b19dd8b5 (patch)
tree9ba4be1199a279c981bea94f38777fba5e379f2f /Source/Core
parentb66793194e7b9e34080764e5985d49055ccaa37d (diff)
VideoBackends:Metal: Default to presentDrawable when vsync is on
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Config/GraphicsSettings.cpp4
-rw-r--r--Source/Core/Core/Config/GraphicsSettings.h2
-rw-r--r--Source/Core/VideoBackends/Metal/MTLRenderer.mm4
-rw-r--r--Source/Core/VideoCommon/VideoConfig.cpp2
-rw-r--r--Source/Core/VideoCommon/VideoConfig.h2
5 files changed, 8 insertions, 6 deletions
diff --git a/Source/Core/Core/Config/GraphicsSettings.cpp b/Source/Core/Core/Config/GraphicsSettings.cpp
index beb2e6f017..593b23104a 100644
--- a/Source/Core/Core/Config/GraphicsSettings.cpp
+++ b/Source/Core/Core/Config/GraphicsSettings.cpp
@@ -89,8 +89,8 @@ const Info<bool> GFX_PREFER_VS_FOR_LINE_POINT_EXPANSION{
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};
diff --git a/Source/Core/Core/Config/GraphicsSettings.h b/Source/Core/Core/Config/GraphicsSettings.h
index 0eed7c88e2..7b60b18431 100644
--- a/Source/Core/Core/Config/GraphicsSettings.h
+++ b/Source/Core/Core/Config/GraphicsSettings.h
@@ -77,7 +77,7 @@ extern const Info<bool> GFX_SAVE_TEXTURE_CACHE_TO_STATE;
extern const Info<bool> GFX_PREFER_VS_FOR_LINE_POINT_EXPANSION;
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;
diff --git a/Source/Core/VideoBackends/Metal/MTLRenderer.mm b/Source/Core/VideoBackends/Metal/MTLRenderer.mm
index 7d6c583599..7e915f045a 100644
--- a/Source/Core/VideoBackends/Metal/MTLRenderer.mm
+++ b/Source/Core/VideoBackends/Metal/MTLRenderer.mm
@@ -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()
diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp
index 760e185304..1118d5ec04 100644
--- a/Source/Core/VideoCommon/VideoConfig.cpp
+++ b/Source/Core/VideoCommon/VideoConfig.cpp
@@ -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);
diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h
index 8b4cc40657..a86f69a57d 100644
--- a/Source/Core/VideoCommon/VideoConfig.h
+++ b/Source/Core/VideoCommon/VideoConfig.h
@@ -158,7 +158,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;