Replace BeginUI/EndUI

This commit is contained in:
Scott Mansell 2023-01-28 23:33:01 +13:00
parent 18c799f0b6
commit b007b8e104
4 changed files with 8 additions and 42 deletions

View File

@ -540,11 +540,6 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
}
Common::ScopeGuard video_guard{[] { g_video_backend->Shutdown(); }};
// Render a single frame without anything on it to clear the screen.
// This avoids the game list being displayed while the core is finishing initializing.
g_presenter->BeginUIFrame();
g_presenter->EndUIFrame();
if (cpu_info.HTT)
Config::SetBaseOrCurrent(Config::MAIN_DSP_THREAD, cpu_info.num_cores > 4);
else

View File

@ -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<std::mutex> guard(m_swap_mutex);
g_gfx->PresentBackbuffer();
g_gfx->EndUtilityDrawing();
}
m_onscreen_ui->BeginImGuiFrame(m_backbuffer_width, m_backbuffer_height);
}
std::tuple<MathUtil::Rectangle<int>, MathUtil::Rectangle<int>>
Presenter::ConvertStereoRectangle(const MathUtil::Rectangle<int>& rc) const
{

View File

@ -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; }

View File

@ -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 <typename SerializedUidType, typename UidType>