summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-20 00:34:52 +0000
committerzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-20 00:34:52 +0000
commitc070108aaa0a5cce0bd0452ad197c9dab0ddac92 (patch)
treeca76ff972b19b82853343db0e654d8b48ec5b8b4
parent3634ebdfa7de8a927219b290e285fdcc45100ef7 (diff)
downloadchromium_src-c070108aaa0a5cce0bd0452ad197c9dab0ddac92.zip
chromium_src-c070108aaa0a5cce0bd0452ad197c9dab0ddac92.tar.gz
chromium_src-c070108aaa0a5cce0bd0452ad197c9dab0ddac92.tar.bz2
Chrome displays the wrong thing if FBO is left bound in WebGL.
Fix a webgl bug in command buffer: if a user created fbo is bound, compositor doesn't get the correct frame. The issue is that currently multisampled framebuffer blit is incorrectly skipped if a user created fbo is bound. BUG=79750 TEST=bots green, test case attached in bug 79750 behaves correctly. Review URL: http://codereview.chromium.org/6873099 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82201 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 42f9a2b..65b2e56 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -173,11 +173,12 @@ class ScopedFrameBufferBinder {
};
// Temporarily changes a decoder's bound frame buffer to a resolved version of
-// the multisampled offscreen render buffer if and only if that buffer is
-// currently bound and is multisampled.
+// the multisampled offscreen render buffer if that buffer is multisampled, and,
+// if it is bound or enforce_internal_framebuffer is true.
class ScopedResolvedFrameBufferBinder {
public:
- explicit ScopedResolvedFrameBufferBinder(GLES2DecoderImpl* decoder);
+ explicit ScopedResolvedFrameBufferBinder(GLES2DecoderImpl* decoder,
+ bool enforce_internal_framebuffer);
~ScopedResolvedFrameBufferBinder();
private:
@@ -1527,10 +1528,12 @@ ScopedFrameBufferBinder::~ScopedFrameBufferBinder() {
}
ScopedResolvedFrameBufferBinder::ScopedResolvedFrameBufferBinder(
- GLES2DecoderImpl* decoder) : decoder_(decoder) {
+ GLES2DecoderImpl* decoder, bool enforce_internal_framebuffer)
+ : decoder_(decoder) {
resolve_and_bind_ = (decoder_->offscreen_target_frame_buffer_.get() &&
decoder_->IsOffscreenBufferMultisampled() &&
- !decoder_->bound_read_framebuffer_.get());
+ (!decoder_->bound_read_framebuffer_.get() ||
+ enforce_internal_framebuffer));
if (!resolve_and_bind_)
return;
@@ -4961,7 +4964,7 @@ error::Error GLES2DecoderImpl::HandleReadPixels(
CopyRealGLErrorsToWrapper();
- ScopedResolvedFrameBufferBinder binder(this);
+ ScopedResolvedFrameBufferBinder binder(this, false);
// Get the size of the current fbo or backbuffer.
gfx::Size max_size = GetBoundReadFrameBufferSize();
@@ -5731,7 +5734,7 @@ void GLES2DecoderImpl::DoCopyTexImage2D(
}
CopyRealGLErrorsToWrapper();
- ScopedResolvedFrameBufferBinder binder(this);
+ ScopedResolvedFrameBufferBinder binder(this, false);
gfx::Size size = GetBoundReadFrameBufferSize();
// Clip to size to source dimensions
@@ -5815,7 +5818,7 @@ void GLES2DecoderImpl::DoCopyTexSubImage2D(
return;
}
- ScopedResolvedFrameBufferBinder binder(this);
+ ScopedResolvedFrameBufferBinder binder(this, false);
gfx::Size size = GetBoundReadFrameBufferSize();
GLint copyX = 0;
GLint copyY = 0;
@@ -6337,7 +6340,7 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
if (IsOffscreenBufferMultisampled()) {
// For multisampled buffers, bind the resolved frame buffer so that
// callbacks can call ReadPixels or CopyTexImage2D.
- ScopedResolvedFrameBufferBinder binder(this);
+ ScopedResolvedFrameBufferBinder binder(this, true);
if (swap_buffers_callback_.get()) {
swap_buffers_callback_->Run();
}