From b007b8e104fbf57bc5d92bc94ca7eb997edc6332 Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Sat, 28 Jan 2023 23:33:01 +1300 Subject: Replace BeginUI/EndUI --- Source/Core/VideoCommon/Present.cpp | 31 +++++-------------------------- Source/Core/VideoCommon/Present.h | 5 ----- Source/Core/VideoCommon/ShaderCache.cpp | 9 +++------ 3 files changed, 8 insertions(+), 37 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Present.cpp b/Source/Core/VideoCommon/Present.cpp index 55df419d0c..25d79f47ff 100644 --- a/Source/Core/VideoCommon/Present.cpp +++ b/Source/Core/VideoCommon/Present.cpp @@ -52,6 +52,9 @@ bool Presenter::Initialize() if (!m_onscreen_ui->Initialize(m_backbuffer_width, m_backbuffer_height, m_backbuffer_scale)) return false; + // Draw a blank frame (and complete OnScreenUI initialization) + g_gfx->BindBackbuffer({{0.0f, 0.0f, 0.0f, 1.0f}}); + g_gfx->PresentBackbuffer(); } return true; @@ -77,7 +80,8 @@ void Presenter::CheckForConfigChanges(u32 changed_bits) { // Check for post-processing shader changes. Done up here as it doesn't affect anything outside // the post-processor. Note that options are applied every frame, so no need to check those. - if (m_post_processor && m_post_processor->GetConfig()->GetShader() != g_ActiveConfig.sPostProcessingShader) + if (m_post_processor && + m_post_processor->GetConfig()->GetShader() != g_ActiveConfig.sPostProcessingShader) { // The existing shader must not be in use when it's destroyed g_gfx->WaitForGPUIdle(); @@ -96,31 +100,6 @@ void Presenter::CheckForConfigChanges(u32 changed_bits) } } -void Presenter::BeginUIFrame() -{ - if (g_gfx->IsHeadless()) - return; - - g_gfx->BeginUtilityDrawing(); - g_gfx->BindBackbuffer({0.0f, 0.0f, 0.0f, 1.0f}); -} - -void Presenter::EndUIFrame() -{ - m_onscreen_ui->Finalize(); - - if (g_gfx->IsHeadless()) - { - m_onscreen_ui->DrawImGui(); - - std::lock_guard guard(m_swap_mutex); - g_gfx->PresentBackbuffer(); - g_gfx->EndUtilityDrawing(); - } - - m_onscreen_ui->BeginImGuiFrame(m_backbuffer_width, m_backbuffer_height); -} - std::tuple, MathUtil::Rectangle> Presenter::ConvertStereoRectangle(const MathUtil::Rectangle& rc) const { diff --git a/Source/Core/VideoCommon/Present.h b/Source/Core/VideoCommon/Present.h index 3b99c3207d..507c5ee424 100644 --- a/Source/Core/VideoCommon/Present.h +++ b/Source/Core/VideoCommon/Present.h @@ -40,11 +40,6 @@ public: void CheckForConfigChanges(u32 changed_bits); - // Begins/presents a "UI frame". UI frames do not draw any of the console XFB, but this could - // change in the future. - void BeginUIFrame(); - void EndUIFrame(); - // Display resolution int GetBackbufferWidth() const { return m_backbuffer_width; } int GetBackbufferHeight() const { return m_backbuffer_height; } diff --git a/Source/Core/VideoCommon/ShaderCache.cpp b/Source/Core/VideoCommon/ShaderCache.cpp index b9876dc533..1e46f3527b 100644 --- a/Source/Core/VideoCommon/ShaderCache.cpp +++ b/Source/Core/VideoCommon/ShaderCache.cpp @@ -163,8 +163,6 @@ void ShaderCache::WaitForAsyncCompiler() bool running = true; constexpr auto update_ui_progress = [](size_t completed, size_t total) { - g_presenter->BeginUIFrame(); - const float center_x = ImGui::GetIO().DisplaySize.x * 0.5f; const float center_y = ImGui::GetIO().DisplaySize.y * 0.5f; const float scale = ImGui::GetIO().DisplayFramebufferScale.x; @@ -184,7 +182,7 @@ void ShaderCache::WaitForAsyncCompiler() } ImGui::End(); - g_presenter->EndUIFrame(); + g_presenter->Present(); }; while (running && @@ -195,9 +193,8 @@ void ShaderCache::WaitForAsyncCompiler() m_async_shader_compiler->RetrieveWorkItems(); } - // Just render nothing to clear the screen - g_presenter->BeginUIFrame(); - g_presenter->EndUIFrame(); + // An extra Present to clear the screen + g_presenter->Present(); } template -- cgit v1.2.3