Skip to content

Commit

Permalink
Enable depth buffer copies on GLES3 devices without breaking any desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Jan 6, 2014
1 parent 32a1f1e commit 43a93f0
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions GPU/GLES/Framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -864,19 +864,24 @@ void FramebufferManager::SetRenderFrameBuffer() {
}
#endif

bool doDepthCopy =
currentRenderVfb_ != NULL &&
currentRenderVfb_->fbo != NULL &&
MaskedEqual(currentRenderVfb_->z_address, vfb->z_address) &&
currentRenderVfb_->renderWidth == vfb->renderWidth &&
currentRenderVfb_->renderHeight == vfb->renderHeight;

#ifndef USING_GLES2
if (gl_extensions.FBO_ARB && currentRenderVfb_ != NULL &&
currentRenderVfb_->fbo != NULL &&
MaskedEqual(currentRenderVfb_->z_address, vfb->z_address) &&
currentRenderVfb_->renderWidth == vfb->renderWidth &&
currentRenderVfb_->renderHeight == vfb->renderHeight) {
if (doDepthCopy && gl_extensions.FBO_ARB) {
#else
if (doDepthCopy && gl_extensions.GLES3) {
#endif
// 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 {
Expand Down

4 comments on commit 43a93f0

@dbz400
Copy link
Contributor

@dbz400 dbz400 commented on 43a93f0 Jan 6, 2014

Choose a reason for hiding this comment

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

Just tested on my Android 4.3 .It works beautifully and almost no performance penality (by company this build and the previous one)

Tested game :

  1. Saint Seiya Omega ,
  2. Ys Seven 7
  3. Jeanna D Arc

@unknownbrackets
Copy link
Collaborator

Choose a reason for hiding this comment

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

But #5028 (and also #5032, but I didn't mean that one, oops) could've been caused by these copies. I'm sure there's no major performance penalty in Jeanne d'Arc.

-[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.

At least this should work the same as on PC.

Maybe we need to make it an option after all, sigh..

Or we should try to track depth buffers separately from color buffers after all. The drawback with that is that stencil will be attached to the depth buffer rather than the color buffer...

@unknownbrackets
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the problems associated with the color and stencil buffers not being tracked together will be worse than the depth ones...

Well, I'd prefer to get it right. I'm guessing framebuffer sizing is messing with it now.

-[Unknown]

Please sign in to comment.