diff --git a/src/core/gpu.cpp b/src/core/gpu.cpp index 68677d94a..fbb07ee13 100644 --- a/src/core/gpu.cpp +++ b/src/core/gpu.cpp @@ -2063,8 +2063,7 @@ GPUDevice::PresentResult GPU::RenderDisplay(GPUTexture* target, const GSVector4i { if (target) g_gpu_device->SetRenderTarget(target); - else if (const GPUDevice::PresentResult pres = g_gpu_device->BeginPresent(false); - pres != GPUDevice::PresentResult::OK) + else if (const GPUDevice::PresentResult pres = g_gpu_device->BeginPresent(); pres != GPUDevice::PresentResult::OK) return pres; } diff --git a/src/core/imgui_overlays.cpp b/src/core/imgui_overlays.cpp index f70958296..12df14c8d 100644 --- a/src/core/imgui_overlays.cpp +++ b/src/core/imgui_overlays.cpp @@ -160,7 +160,7 @@ void Host::DisplayLoadingScreen(const char* message, int progress_min /*= -1*/, // TODO: Glass effect or something. - if (g_gpu_device->BeginPresent(false) == GPUDevice::PresentResult::OK) + if (g_gpu_device->BeginPresent() == GPUDevice::PresentResult::OK) { g_gpu_device->RenderImGui(); g_gpu_device->EndPresent(false); diff --git a/src/core/system.cpp b/src/core/system.cpp index c32b9c4d4..4083eb921 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -2166,7 +2166,7 @@ void System::FrameDone() const bool explicit_present = (throttle_before_present && g_gpu_device->GetFeatures().explicit_present); if (explicit_present) { - const bool do_present = PresentDisplay(false, true); + const bool do_present = PresentDisplay(true); Throttle(current_time); if (do_present) g_gpu_device->SubmitPresent(); @@ -2176,7 +2176,7 @@ void System::FrameDone() if (throttle_before_present) Throttle(current_time); - PresentDisplay(false, false); + PresentDisplay(false); if (!throttle_before_present && s_throttler_enabled && !IsExecutionInterrupted()) Throttle(current_time); @@ -5734,31 +5734,23 @@ void System::HostDisplayResized() g_gpu->UpdateResolutionScale(); } -bool System::PresentDisplay(bool skip_present, bool explicit_present) +bool System::PresentDisplay(bool explicit_present) { // acquire for IO.MousePos. std::atomic_thread_fence(std::memory_order_acquire); - if (!skip_present) - { - FullscreenUI::Render(); - ImGuiManager::RenderTextOverlays(); - ImGuiManager::RenderOSDMessages(); + FullscreenUI::Render(); + ImGuiManager::RenderTextOverlays(); + ImGuiManager::RenderOSDMessages(); - if (s_state == State::Running) - ImGuiManager::RenderSoftwareCursors(); - } + if (s_state == State::Running) + ImGuiManager::RenderSoftwareCursors(); // Debug windows are always rendered, otherwise mouse input breaks on skip. ImGuiManager::RenderOverlayWindows(); ImGuiManager::RenderDebugWindows(); - GPUDevice::PresentResult pres; - if (g_gpu && !skip_present) - pres = g_gpu->PresentDisplay(); - else - pres = g_gpu_device->BeginPresent(skip_present); - + const GPUDevice::PresentResult pres = g_gpu ? g_gpu->PresentDisplay() : g_gpu_device->BeginPresent(); if (pres == GPUDevice::PresentResult::OK) { g_gpu_device->RenderImGui(); @@ -5786,7 +5778,7 @@ bool System::PresentDisplay(bool skip_present, bool explicit_present) void System::InvalidateDisplay() { - PresentDisplay(false, false); + PresentDisplay(false); if (g_gpu) g_gpu->RestoreDeviceContext(); diff --git a/src/core/system.h b/src/core/system.h index 43084a36d..1a3a27936 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -448,7 +448,7 @@ void RequestDisplaySize(float scale = 0.0f); void HostDisplayResized(); /// Renders the display. -bool PresentDisplay(bool skip_present, bool explicit_present); +bool PresentDisplay(bool explicit_present); void InvalidateDisplay(); ////////////////////////////////////////////////////////////////////////// diff --git a/src/duckstation-qt/qthost.cpp b/src/duckstation-qt/qthost.cpp index a1afe02d0..c4016d09b 100644 --- a/src/duckstation-qt/qthost.cpp +++ b/src/duckstation-qt/qthost.cpp @@ -1798,7 +1798,7 @@ void EmuThread::run() System::Internal::IdlePollUpdate(); if (g_gpu_device) { - System::PresentDisplay(false, false); + System::PresentDisplay(false); if (!g_gpu_device->IsVSyncModeBlocking()) g_gpu_device->ThrottlePresentation(); } diff --git a/src/util/d3d11_device.cpp b/src/util/d3d11_device.cpp index c4bfe9967..923266131 100644 --- a/src/util/d3d11_device.cpp +++ b/src/util/d3d11_device.cpp @@ -639,11 +639,8 @@ void D3D11Device::SetVSyncMode(GPUVSyncMode mode, bool allow_present_throttle) } } -GPUDevice::PresentResult D3D11Device::BeginPresent(bool skip_present, u32 clear_color) +GPUDevice::PresentResult D3D11Device::BeginPresent(u32 clear_color) { - if (skip_present) - return PresentResult::SkipPresent; - if (!m_swap_chain) { // Note: Really slow on Intel... diff --git a/src/util/d3d11_device.h b/src/util/d3d11_device.h index 89afa16d5..c00caf911 100644 --- a/src/util/d3d11_device.h +++ b/src/util/d3d11_device.h @@ -104,7 +104,7 @@ public: bool SetGPUTimingEnabled(bool enabled) override; float GetAndResetAccumulatedGPUTime() override; - PresentResult BeginPresent(bool skip_present, u32 clear_color) override; + PresentResult BeginPresent(u32 clear_color) override; void EndPresent(bool explicit_present) override; void SubmitPresent() override; diff --git a/src/util/d3d12_device.cpp b/src/util/d3d12_device.cpp index 86330f5eb..84f0e95ff 100644 --- a/src/util/d3d12_device.cpp +++ b/src/util/d3d12_device.cpp @@ -1123,7 +1123,7 @@ void D3D12Device::SetVSyncMode(GPUVSyncMode mode, bool allow_present_throttle) } } -GPUDevice::PresentResult D3D12Device::BeginPresent(bool frame_skip, u32 clear_color) +GPUDevice::PresentResult D3D12Device::BeginPresent(u32 clear_color) { if (InRenderPass()) EndRenderPass(); @@ -1131,9 +1131,6 @@ GPUDevice::PresentResult D3D12Device::BeginPresent(bool frame_skip, u32 clear_co if (m_device_was_lost) [[unlikely]] return PresentResult::DeviceLost; - if (frame_skip) - return PresentResult::SkipPresent; - // If we're running surfaceless, kick the command buffer so we don't run out of descriptors. if (!m_swap_chain) { diff --git a/src/util/d3d12_device.h b/src/util/d3d12_device.h index 0f77b8f74..e19c5169c 100644 --- a/src/util/d3d12_device.h +++ b/src/util/d3d12_device.h @@ -126,7 +126,7 @@ public: bool SetGPUTimingEnabled(bool enabled) override; float GetAndResetAccumulatedGPUTime() override; - PresentResult BeginPresent(bool skip_present, u32 clear_color) override; + PresentResult BeginPresent(u32 clear_color) override; void EndPresent(bool explicit_present) override; void SubmitPresent() override; diff --git a/src/util/gpu_device.h b/src/util/gpu_device.h index cd76a1241..2a2f4d443 100644 --- a/src/util/gpu_device.h +++ b/src/util/gpu_device.h @@ -709,7 +709,7 @@ public: virtual void DrawIndexedWithBarrier(u32 index_count, u32 base_index, u32 base_vertex, DrawBarrier type) = 0; /// Returns false if the window was completely occluded. - virtual PresentResult BeginPresent(bool skip_present, u32 clear_color = DEFAULT_CLEAR_COLOR) = 0; + virtual PresentResult BeginPresent(u32 clear_color = DEFAULT_CLEAR_COLOR) = 0; virtual void EndPresent(bool explicit_submit) = 0; virtual void SubmitPresent() = 0; diff --git a/src/util/metal_device.h b/src/util/metal_device.h index 1d335f4ad..2ade415e4 100644 --- a/src/util/metal_device.h +++ b/src/util/metal_device.h @@ -265,7 +265,7 @@ public: void SetVSyncMode(GPUVSyncMode mode, bool allow_present_throttle) override; - PresentResult BeginPresent(bool skip_present, u32 clear_color) override; + PresentResult BeginPresent(u32 clear_color) override; void EndPresent(bool explicit_submit) override; void SubmitPresent() override; diff --git a/src/util/metal_device.mm b/src/util/metal_device.mm index 72ccae344..244c60bcc 100644 --- a/src/util/metal_device.mm +++ b/src/util/metal_device.mm @@ -2312,13 +2312,10 @@ id MetalDevice::GetBlitEncoder(bool is_inline) } } -GPUDevice::PresentResult MetalDevice::BeginPresent(bool skip_present, u32 clear_color) +GPUDevice::PresentResult MetalDevice::BeginPresent(u32 clear_color) { @autoreleasepool { - if (skip_present) - return PresentResult::SkipPresent; - if (m_layer == nil) { TrimTexturePool(); diff --git a/src/util/opengl_device.cpp b/src/util/opengl_device.cpp index ebc852e48..559105109 100644 --- a/src/util/opengl_device.cpp +++ b/src/util/opengl_device.cpp @@ -740,16 +740,12 @@ void OpenGLDevice::DestroyBuffers() m_vertex_buffer.reset(); } -GPUDevice::PresentResult OpenGLDevice::BeginPresent(bool skip_present, u32 clear_color) +GPUDevice::PresentResult OpenGLDevice::BeginPresent(u32 clear_color) { - if (skip_present || m_window_info.type == WindowInfo::Type::Surfaceless) + if (m_window_info.type == WindowInfo::Type::Surfaceless) { - if (!skip_present) - { - glFlush(); - TrimTexturePool(); - } - + glFlush(); + TrimTexturePool(); return PresentResult::SkipPresent; } diff --git a/src/util/opengl_device.h b/src/util/opengl_device.h index 7d2e1b772..3bbde6eaa 100644 --- a/src/util/opengl_device.h +++ b/src/util/opengl_device.h @@ -104,7 +104,7 @@ public: void SetVSyncMode(GPUVSyncMode mode, bool allow_present_throttle) override; - PresentResult BeginPresent(bool skip_present, u32 clear_color) override; + PresentResult BeginPresent(u32 clear_color) override; void EndPresent(bool explicit_present) override; void SubmitPresent() override; diff --git a/src/util/postprocessing_shader_fx.cpp b/src/util/postprocessing_shader_fx.cpp index daa856522..9474600e1 100644 --- a/src/util/postprocessing_shader_fx.cpp +++ b/src/util/postprocessing_shader_fx.cpp @@ -1784,7 +1784,7 @@ GPUDevice::PresentResult PostProcessing::ReShadeFXShader::Apply(GPUTexture* inpu if (pass.render_targets.size() == 1 && pass.render_targets[0] == OUTPUT_COLOR_TEXTURE && !final_target) { // Special case: drawing to final buffer. - if (const GPUDevice::PresentResult pres = g_gpu_device->BeginPresent(false); pres != GPUDevice::PresentResult::OK) + if (const GPUDevice::PresentResult pres = g_gpu_device->BeginPresent(); pres != GPUDevice::PresentResult::OK) { GL_POP(); return pres; diff --git a/src/util/postprocessing_shader_glsl.cpp b/src/util/postprocessing_shader_glsl.cpp index 8c3b3cb5a..e791dc4e3 100644 --- a/src/util/postprocessing_shader_glsl.cpp +++ b/src/util/postprocessing_shader_glsl.cpp @@ -177,7 +177,7 @@ GPUDevice::PresentResult PostProcessing::GLSLShader::Apply(GPUTexture* input_col // Assumes final stage has been cleared already. if (!final_target) { - if (const GPUDevice::PresentResult pres = g_gpu_device->BeginPresent(false); pres != GPUDevice::PresentResult::OK) + if (const GPUDevice::PresentResult pres = g_gpu_device->BeginPresent(); pres != GPUDevice::PresentResult::OK) return pres; } else diff --git a/src/util/vulkan_device.cpp b/src/util/vulkan_device.cpp index d6a18bf7d..e0fe549ad 100644 --- a/src/util/vulkan_device.cpp +++ b/src/util/vulkan_device.cpp @@ -2342,7 +2342,7 @@ void VulkanDevice::SetVSyncMode(GPUVSyncMode mode, bool allow_present_throttle) } } -GPUDevice::PresentResult VulkanDevice::BeginPresent(bool frame_skip, u32 clear_color) +GPUDevice::PresentResult VulkanDevice::BeginPresent(u32 clear_color) { if (InRenderPass()) EndRenderPass(); @@ -2350,9 +2350,6 @@ GPUDevice::PresentResult VulkanDevice::BeginPresent(bool frame_skip, u32 clear_c if (m_device_was_lost) [[unlikely]] return PresentResult::DeviceLost; - if (frame_skip) - return PresentResult::SkipPresent; - // If we're running surfaceless, kick the command buffer so we don't run out of descriptors. if (!m_swap_chain) { diff --git a/src/util/vulkan_device.h b/src/util/vulkan_device.h index 287541ddf..ef686312f 100644 --- a/src/util/vulkan_device.h +++ b/src/util/vulkan_device.h @@ -142,7 +142,7 @@ public: void SetVSyncMode(GPUVSyncMode mode, bool allow_present_throttle) override; - PresentResult BeginPresent(bool skip_present, u32 clear_color) override; + PresentResult BeginPresent(u32 clear_color) override; void EndPresent(bool explicit_present) override; void SubmitPresent() override;