Skip to content

Commit

Permalink
EmuScreen: Use CLEAR instead of DONT_CARE to help the render pass mer…
Browse files Browse the repository at this point in the history
…ger.

Should fix #18720

We need to annotate store mode properly too, in order to merge passes
that load with DONT_CARE.

The reason it's a problem that we fail to merge renderpasses is that old
Mali drivers get things in a terribly wrong state if you submit an empty
renderpass.
  • Loading branch information
hrydgard committed Jan 18, 2024
1 parent 7627de4 commit 3967d07
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions UI/EmuScreen.cpp
Expand Up @@ -1497,7 +1497,7 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
if ((g_Config.bSkipBufferEffects && !g_Config.bSoftwareRendering) || Core_IsStepping()) {
// We need to clear here already so that drawing during the frame is done on a clean slate.
if (Core_IsStepping() && gpuStats.numFlips != 0) {
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::KEEP, RPAction::DONT_CARE, RPAction::DONT_CARE }, "EmuScreen_BackBuffer");
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::KEEP, RPAction::CLEAR, RPAction::CLEAR }, "EmuScreen_BackBuffer");
} else {
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR, 0xFF000000 }, "EmuScreen_BackBuffer");
}
Expand All @@ -1515,7 +1515,7 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
System_Notify(SystemNotification::KEEP_SCREEN_AWAKE);
} else if (!Core_ShouldRunBehind() && strcmp(screenManager()->topScreen()->tag(), "DevMenu") != 0) {
// Not on top. Let's not execute, only draw the image.
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::DONT_CARE, RPAction::DONT_CARE }, "EmuScreen_Stepping");
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR, }, "EmuScreen_Stepping");
// Just to make sure.
if (PSP_IsInited() && !g_Config.bSkipBufferEffects) {
PSP_BeginHostFrame();
Expand Down Expand Up @@ -1584,12 +1584,12 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
// Clear to blue background screen
bool dangerousSettings = !Reporting::IsSupported();
clearColor = dangerousSettings ? 0xFF900050 : 0xFF900000;
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::DONT_CARE, RPAction::DONT_CARE, clearColor }, "EmuScreen_RuntimeError");
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR, clearColor }, "EmuScreen_RuntimeError");
// The info is drawn later in renderUI
} else {
// If we're stepping, it's convenient not to clear the screen entirely, so we copy display to output.
// This won't work in non-buffered, but that's fine.
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::DONT_CARE, RPAction::DONT_CARE, clearColor }, "EmuScreen_Stepping");
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR, clearColor }, "EmuScreen_Stepping");
// Just to make sure.
if (PSP_IsInited()) {
gpu->CopyDisplayToOutput(true);
Expand Down Expand Up @@ -1629,7 +1629,7 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {

if (hasVisibleUI()) {
// In most cases, this should already be bound and a no-op.
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::KEEP, RPAction::DONT_CARE, RPAction::DONT_CARE }, "EmuScreen_UI");
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::KEEP, RPAction::CLEAR, RPAction::CLEAR }, "EmuScreen_UI");
draw->SetViewport(viewport);
cardboardDisableButton_->SetVisibility(g_Config.bEnableCardboardVR ? UI::V_VISIBLE : UI::V_GONE);
screenManager()->getUIContext()->BeginFrame();
Expand Down

0 comments on commit 3967d07

Please sign in to comment.