Merge pull request #17879 from hrydgard/move-present-out-of-screenmanager

Call draw->Begin/EndFrame from outside the screen manager.
This commit is contained in:
Henrik Rydgård 2023-08-10 09:43:54 +02:00 committed by GitHub
commit a246df40c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 11 deletions

View File

@ -191,10 +191,7 @@ void UIScreen::deviceRestored() {
void UIScreen::preRender() {
using namespace Draw;
Draw::DrawContext *draw = screenManager()->getDrawContext();
if (!draw) {
return;
}
draw->BeginFrame();
_dbg_assert_(draw != nullptr);
// Bind and clear the back buffer
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR, 0xFF000000 }, "UI");
screenManager()->getUIContext()->BeginFrame();
@ -211,12 +208,7 @@ void UIScreen::preRender() {
}
void UIScreen::postRender() {
Draw::DrawContext *draw = screenManager()->getDrawContext();
if (!draw) {
return;
}
screenManager()->getUIContext()->Flush();
draw->EndFrame();
}
void UIScreen::render() {

View File

@ -1355,7 +1355,6 @@ static void DrawFPS(UIContext *ctx, const Bounds &bounds) {
void EmuScreen::preRender() {
using namespace Draw;
DrawContext *draw = screenManager()->getDrawContext();
draw->BeginFrame();
// Here we do NOT bind the backbuffer or clear the screen, unless non-buffered.
// The emuscreen is different than the others - we really want to allow the game to render to framebuffers
// before we ever bind the backbuffer for rendering. On mobile GPUs, switching back and forth between render
@ -1389,7 +1388,6 @@ void EmuScreen::postRender() {
return;
if (stopRender_)
draw->WipeQueue();
draw->EndFrame();
}
void EmuScreen::render() {

View File

@ -1135,12 +1135,17 @@ void NativeFrame(GraphicsContext *graphicsContext) {
debugFlags |= Draw::DebugFlags::PROFILE_SCOPES;
g_screenManager->getDrawContext()->SetDebugFlags(debugFlags);
g_draw->BeginFrame();
// All actual rendering happen in here.
g_screenManager->render();
if (g_screenManager->getUIContext()->Text()) {
g_screenManager->getUIContext()->Text()->OncePerFrame();
}
// This triggers present.
g_draw->EndFrame();
if (resized) {
INFO_LOG(G3D, "Resized flag set - recalculating bounds");
resized = false;