Vulkan: Better way to make sure we bind the backbuffer at some point.

This commit is contained in:
Henrik Rydgård 2017-11-06 23:48:47 +01:00
parent ea2fc55217
commit 944cc94630

View File

@ -991,10 +991,13 @@ void EmuScreen::postRender() {
void EmuScreen::render() {
using namespace Draw;
DrawContext *thin3d = screenManager()->getDrawContext();
if (invalid_) {
// It's possible this might be set outside PSP_RunLoopFor().
// In this case, we need to double check it here.
checkPowerDown();
thin3d->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR });
return;
}
@ -1024,22 +1027,19 @@ void EmuScreen::render() {
if (coreState == CORE_NEXTFRAME) {
// set back to running for the next frame
coreState = CORE_RUNNING;
} else {
// Didn't actually reach the end of the frame, ran out of the blockTicks cycles.
// In this case we need to bind and wipe the backbuffer, at least.
// It's possible we never ended up outputted anything - make sure we have the backbuffer cleared
thin3d->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR });
}
checkPowerDown();
PSP_EndHostFrame();
if (invalid_)
return;
// Here the backbuffer will always be bound.
if (!osm.IsEmpty() || g_Config.bShowDebugStats || g_Config.iShowFPSCounter || g_Config.bShowTouchControls || g_Config.bShowDeveloperMenu || g_Config.bShowAudioDebug || saveStatePreview_->GetVisibility() != UI::V_GONE || g_Config.bShowFrameProfiler) {
DrawContext *thin3d = screenManager()->getDrawContext();
// It's possible we never ended up outputted anything - make sure we have the backbuffer.
thin3d->BindFramebufferAsRenderTarget(nullptr, { RPAction::KEEP, RPAction::KEEP });
// This sets up some important states but not the viewport.
screenManager()->getUIContext()->Begin();