System: Combine VRR and Optimal Frame Pacing

GSync/FreeSync display users should:
 - DISABLE VSync.
 - ENABLE Optimal Frame Pacing.
This commit is contained in:
Stenzek
2024-04-11 21:26:50 +10:00
parent 2ad67ad3ee
commit 88270771da
26 changed files with 224 additions and 289 deletions

View File

@ -562,7 +562,7 @@ public:
virtual RenderAPI GetRenderAPI() const = 0;
bool Create(const std::string_view& adapter, const std::string_view& shader_cache_path, u32 shader_cache_version,
bool debug_device, DisplaySyncMode sync_mode, bool threaded_presentation,
bool debug_device, bool vsync, bool threaded_presentation,
std::optional<bool> exclusive_fullscreen_control, FeatureMask disabled_features, Error* error);
void Destroy();
@ -660,12 +660,8 @@ public:
/// Renders ImGui screen elements. Call before EndPresent().
void RenderImGui();
ALWAYS_INLINE DisplaySyncMode GetSyncMode() const { return m_sync_mode; }
ALWAYS_INLINE bool IsVSyncActive() const
{
return (m_sync_mode == DisplaySyncMode::VSync || m_sync_mode == DisplaySyncMode::VSyncRelaxed);
}
virtual void SetSyncMode(DisplaySyncMode mode);
ALWAYS_INLINE bool IsVSyncEnabled() const { return m_vsync_enabled; }
virtual void SetVSyncEnabled(bool enabled);
ALWAYS_INLINE bool IsDebugDevice() const { return m_debug_device; }
ALWAYS_INLINE size_t GetVRAMUsage() const { return s_total_vram_usage; }
@ -780,7 +776,7 @@ private:
protected:
static Statistics s_stats;
DisplaySyncMode m_sync_mode = DisplaySyncMode::Disabled;
bool m_vsync_enabled = false;
bool m_gpu_timing_enabled = false;
bool m_debug_device = false;
};