Skip to content

Commit

Permalink
Merge pull request #5010 from unknownbrackets/depth-copy
Browse files Browse the repository at this point in the history
On desktop, blit depth when not cleared
  • Loading branch information
hrydgard committed Jan 4, 2014
2 parents 5398133 + 202842d commit ce8f98e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions GPU/GLES/Framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,17 @@ void FramebufferManager::SetRenderFrameBuffer() {
ClearBuffer();
}
#endif

#ifndef USING_GLES2
if (gl_extensions.FBO_ARB && currentRenderVfb_ != NULL && MaskedEqual(currentRenderVfb_->z_address, vfb->z_address)) {
// Let's only do this if not clearing.
if (!gstate.isModeClear() || !gstate.isClearModeDepthMask()) {
fbo_bind_for_read(currentRenderVfb_->fbo);
glBlitFramebuffer(0, 0, currentRenderVfb_->renderWidth, currentRenderVfb_->renderHeight, 0, 0, vfb->renderWidth, vfb->renderHeight, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
}
}
#endif

currentRenderVfb_ = vfb;
} else {
vfb->last_frame_render = gpuStats.numFlips;
Expand Down

5 comments on commit ce8f98e

@solarmystic
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@unknownbrackets @hrydgard
This particular commit, v0.9.6-334-gce8f98e (when combined with the necessary native update) causes Zack's shadow in FFVII CC (outside the Shinra building, as is the usual testing ground for the FFVII shadow issue) to become zebra striped for some reason, instead of the previously whole solid blob:-

screen00271

Previously correct behaviour in v0.9.6-331-g4d477f0 4d477f0 (the shadow is a one solid blob):-

screen00272

@hrydgard
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@unknownbrackets I don't think it makes sense to stretch depth buffers the way this does, instead we should either copy the upper left overlapping rectangle or ignore the copy if the buffer sizes are different.

@dbz400
Copy link
Contributor

@dbz400 dbz400 commented on ce8f98e Jan 5, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be AMD issue only ? i test it on my nvidia system with 0.9.6-338

screen00121

@unknownbrackets
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@unknownbrackets I don't think it makes sense to stretch depth buffers the way this does, instead we should either copy the upper left overlapping rectangle or ignore the copy if the buffer sizes are different.

Hadn't considered it when I wrote the code, since the address is the same, but that's probably right.

-[Unknown]

@hrydgard
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I committed a change that skips the copy if the sizes differ, which fixed this problem.

Please sign in to comment.