mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 15:45:42 +00:00
Frontend: Force powered-off screen through seperate render path
This commit is contained in:
parent
0b58f1facf
commit
d389fcaa13
|
@ -428,7 +428,6 @@ void SDLInterface::Render()
|
|||
{
|
||||
DrawImGui();
|
||||
|
||||
if (m_system)
|
||||
m_system->GetGPU()->ResetGraphicsAPIState();
|
||||
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
|
@ -447,10 +446,28 @@ void SDLInterface::Render()
|
|||
ImGui::NewFrame();
|
||||
|
||||
GL::Program::ResetLastProgram();
|
||||
if (m_system)
|
||||
m_system->GetGPU()->RestoreGraphicsAPIState();
|
||||
}
|
||||
|
||||
void SDLInterface::RenderPoweredOff()
|
||||
{
|
||||
DrawPoweredOffWindow();
|
||||
ImGui::Render();
|
||||
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
|
||||
SDL_GL_SwapWindow(m_window);
|
||||
|
||||
ImGui_ImplSDL2_NewFrame(m_window);
|
||||
ImGui_ImplOpenGL3_NewFrame();
|
||||
|
||||
ImGui::NewFrame();
|
||||
}
|
||||
|
||||
static std::tuple<int, int, int, int> CalculateDrawRect(int window_width, int window_height, float display_ratio)
|
||||
{
|
||||
const float window_ratio = float(window_width) / float(window_height);
|
||||
|
@ -503,10 +520,7 @@ void SDLInterface::DrawImGui()
|
|||
{
|
||||
DrawMainMenuBar();
|
||||
|
||||
if (m_system)
|
||||
m_system->DrawDebugWindows();
|
||||
else
|
||||
DrawPoweredOffWindow();
|
||||
|
||||
DrawOSDMessages();
|
||||
|
||||
|
@ -590,7 +604,7 @@ void SDLInterface::DrawMainMenuBar()
|
|||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (m_system && ImGui::BeginMenu("Debug"))
|
||||
if (ImGui::BeginMenu("Debug"))
|
||||
{
|
||||
m_system->DrawDebugMenus();
|
||||
ImGui::EndMenu();
|
||||
|
@ -827,13 +841,12 @@ void SDLInterface::Run()
|
|||
}
|
||||
|
||||
if (m_system)
|
||||
{
|
||||
m_system->RunFrame();
|
||||
|
||||
Render();
|
||||
|
||||
// update fps counter
|
||||
if (m_system)
|
||||
{
|
||||
const double time = m_fps_timer.GetTimeSeconds();
|
||||
if (time >= 0.25f)
|
||||
{
|
||||
|
@ -850,5 +863,9 @@ void SDLInterface::Run()
|
|||
m_fps_timer.Reset();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderPoweredOff();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ private:
|
|||
bool HandleSDLEvent(const SDL_Event* event);
|
||||
bool PassEventToImGui(const SDL_Event* event);
|
||||
void Render();
|
||||
void RenderPoweredOff();
|
||||
void RenderDisplay();
|
||||
void DrawMainMenuBar();
|
||||
void DrawPoweredOffWindow();
|
||||
|
|
Loading…
Reference in a new issue