Discard blit buffer contents before blit.

This way the GPU doesn't think it needs to load anything, it's all being
overwritten.  If we're only using part of the framebuffer, the other parts
don't matter.
This commit is contained in:
Unknown W. Brackets 2016-01-04 20:57:54 -08:00
parent a6c64f74d1
commit 4e088aebb7

View file

@ -1274,18 +1274,16 @@ bool FramebufferManager::CreateDownloadTempBuffer(VirtualFramebuffer *nvfb) {
}
void FramebufferManager::UpdateDownloadTempBuffer(VirtualFramebuffer *nvfb) {
if (gl_extensions.IsGLES) {
if (nvfb->fbo) {
fbo_bind_as_render_target(nvfb->fbo);
}
_assert_msg_(G3D, nvfb->fbo, "Expecting a valid nvfb in UpdateDownloadTempBuffer");
// Some tiled mobile GPUs benefit IMMENSELY from clearing an FBO before rendering
// to it. This broke stuff before, so now it only clears on the first use of an
// FBO in a frame. This means that some games won't be able to avoid the on-some-GPUs
// performance-crushing framebuffer reloads from RAM, but we'll have to live with that.
if (nvfb->last_frame_render != gpuStats.numFlips) {
ClearBuffer();
}
// Discard the previous contents of this buffer where possible.
if (gl_extensions.GLES3 && glInvalidateFramebuffer != nullptr) {
fbo_bind_as_render_target(nvfb->fbo);
GLenum attachments[3] = { GL_COLOR_ATTACHMENT0, GL_STENCIL_ATTACHMENT, GL_DEPTH_ATTACHMENT };
glInvalidateFramebuffer(GL_FRAMEBUFFER, 3, attachments);
} else if (gl_extensions.IsGLES) {
fbo_bind_as_render_target(nvfb->fbo);
ClearBuffer();
}
}