mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-04 11:45:18 +02:00
Merge pull request #17035 from unknownbrackets/cache-framebuffer-copy
GPU: Discard framebuffer copy when clearing
This commit is contained in:
@@ -204,7 +204,7 @@ bool FramebufferManagerCommon::ReadbackDepthbuffer(Draw::Framebuffer *fbo, int x
|
||||
}
|
||||
|
||||
shaderManager_->DirtyLastShader();
|
||||
auto *blitFBO = GetTempFBO(TempFBO::COPY, fbo->Width() * scaleX, fbo->Height() * scaleY);
|
||||
auto *blitFBO = GetTempFBO(TempFBO::Z_COPY, fbo->Width() * scaleX, fbo->Height() * scaleY);
|
||||
draw_->BindFramebufferAsRenderTarget(blitFBO, { RPAction::DONT_CARE, RPAction::DONT_CARE, RPAction::DONT_CARE }, "ReadbackDepthbufferSync");
|
||||
Draw::Viewport viewport = { 0.0f, 0.0f, (float)destW, (float)destH, 0.0f, 1.0f };
|
||||
draw_->SetViewport(viewport);
|
||||
|
||||
@@ -932,6 +932,7 @@ void FramebufferManagerCommon::DestroyFramebuf(VirtualFramebuffer *v) {
|
||||
}
|
||||
|
||||
// Wipe some pointers
|
||||
DiscardFramebufferCopy();
|
||||
if (currentRenderVfb_ == v)
|
||||
currentRenderVfb_ = nullptr;
|
||||
if (displayFramebuf_ == v)
|
||||
@@ -1450,6 +1451,7 @@ void FramebufferManagerCommon::DrawFramebufferToOutput(const u8 *srcPixels, int
|
||||
// PresentationCommon sets all kinds of state, we can't rely on anything.
|
||||
gstate_c.Dirty(DIRTY_ALL);
|
||||
|
||||
DiscardFramebufferCopy();
|
||||
currentRenderVfb_ = nullptr;
|
||||
}
|
||||
|
||||
@@ -1607,10 +1609,12 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) {
|
||||
// This may get called mid-draw if the game uses an immediate flip.
|
||||
// PresentationCommon sets all kinds of state, we can't rely on anything.
|
||||
gstate_c.Dirty(DIRTY_ALL);
|
||||
DiscardFramebufferCopy();
|
||||
currentRenderVfb_ = nullptr;
|
||||
}
|
||||
|
||||
void FramebufferManagerCommon::DecimateFBOs() {
|
||||
DiscardFramebufferCopy();
|
||||
currentRenderVfb_ = nullptr;
|
||||
|
||||
for (auto iter : fbosToDelete_) {
|
||||
@@ -1767,6 +1771,7 @@ void FramebufferManagerCommon::ResizeFramebufFBO(VirtualFramebuffer *vfb, int w,
|
||||
} else {
|
||||
draw_->BindFramebufferAsRenderTarget(vfb->fbo, { Draw::RPAction::CLEAR, Draw::RPAction::CLEAR, Draw::RPAction::CLEAR }, "ResizeFramebufFBO");
|
||||
}
|
||||
DiscardFramebufferCopy();
|
||||
currentRenderVfb_ = vfb;
|
||||
|
||||
if (!vfb->fbo) {
|
||||
@@ -2568,6 +2573,7 @@ void FramebufferManagerCommon::NotifyConfigChanged() {
|
||||
}
|
||||
|
||||
void FramebufferManagerCommon::DestroyAllFBOs() {
|
||||
DiscardFramebufferCopy();
|
||||
currentRenderVfb_ = nullptr;
|
||||
displayFramebuf_ = nullptr;
|
||||
prevDisplayFramebuf_ = nullptr;
|
||||
|
||||
@@ -217,6 +217,8 @@ enum class TempFBO {
|
||||
BLIT,
|
||||
// For copies of framebuffers (e.g. shader blending.)
|
||||
COPY,
|
||||
// Used for copies when setting color to depth.
|
||||
Z_COPY,
|
||||
// Used to copy stencil data, means we need a stencil backing.
|
||||
STENCIL,
|
||||
};
|
||||
|
||||
@@ -130,7 +130,7 @@ bool FramebufferManagerGLES::ReadbackStencilbuffer(Draw::Framebuffer *fbo, int x
|
||||
}
|
||||
|
||||
shaderManager_->DirtyLastShader();
|
||||
auto *blitFBO = GetTempFBO(TempFBO::COPY, fbo->Width(), fbo->Height());
|
||||
auto *blitFBO = GetTempFBO(TempFBO::Z_COPY, fbo->Width(), fbo->Height());
|
||||
draw_->BindFramebufferAsRenderTarget(blitFBO, { RPAction::DONT_CARE, RPAction::DONT_CARE, RPAction::DONT_CARE }, "ReadbackStencilbufferSync");
|
||||
Draw::Viewport viewport = { 0.0f, 0.0f, (float)fbo->Width(), (float)fbo->Height(), 0.0f, 1.0f };
|
||||
draw_->SetViewport(viewport);
|
||||
|
||||
Reference in New Issue
Block a user