diff options
author | vangelis@chromium.org <vangelis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-22 19:26:51 +0000 |
---|---|---|
committer | vangelis@chromium.org <vangelis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-22 19:26:51 +0000 |
commit | e566b955d275ba9861728401260b99c532b3c586 (patch) | |
tree | 92f533304bf7aa91fd05f359fa3823dd21526bc1 /gpu/command_buffer | |
parent | fad49bcd98da9cbaae9852975270a3cb65328a1f (diff) | |
download | chromium_src-e566b955d275ba9861728401260b99c532b3c586.zip chromium_src-e566b955d275ba9861728401260b99c532b3c586.tar.gz chromium_src-e566b955d275ba9861728401260b99c532b3c586.tar.bz2 |
Clear the copy of the offscreen texture used by shared contexts after the DEPTH, STENCIL
attachments have been resized since FBOs don't work if the attachment texture sizes don't match.
BUG=47185
Review URL: http://codereview.chromium.org/2872010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50499 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer')
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 80eec9e..3f30647 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -1759,34 +1759,6 @@ bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() { if (offscreen_target_color_texture_->size() == pending_offscreen_size_) return true; - if (parent_) { - // Create the saved offscreen color texture (only accessible to parent). - offscreen_saved_color_texture_->AllocateStorage(pending_offscreen_size_); - - // Attach the saved offscreen color texture to a frame buffer so we can - // clear it with glClear. - offscreen_target_frame_buffer_->AttachRenderTexture( - offscreen_saved_color_texture_.get()); - if (offscreen_target_frame_buffer_->CheckStatus() != - GL_FRAMEBUFFER_COMPLETE) { - return false; - } - - // TODO(apatrick): Fix this once ANGLE supports shared contexts. - // Clear the saved offscreen color texture. Use default GL context - // to ensure clear is not affected by client set state. - if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { - ScopedDefaultGLContext scoped_context(this); - glBindFramebufferEXT(GL_FRAMEBUFFER, - offscreen_target_frame_buffer_->id()); - glClear(GL_COLOR_BUFFER_BIT); - glBindFramebufferEXT(GL_FRAMEBUFFER, 0); - - if (glGetError() != GL_NO_ERROR) - return false; - } - } - // Reallocate the offscreen target buffers. if (!offscreen_target_color_texture_->AllocateStorage( pending_offscreen_size_)) { @@ -1849,7 +1821,7 @@ bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() { } if (parent_) { - // Create the saved offscreen color texture (only accessible to parent). + // Adjust the saved offscreen color texture (only accessible to parent). offscreen_saved_color_texture_->AllocateStorage(pending_offscreen_size_); // Update the info about the offscreen saved color texture in the parent. @@ -1874,6 +1846,33 @@ bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() { GL_UNSIGNED_BYTE); } + // Attach the saved offscreen color texture to a frame buffer so we can + // clear it with glClear. + offscreen_target_frame_buffer_->AttachRenderTexture( + offscreen_saved_color_texture_.get()); + if (offscreen_target_frame_buffer_->CheckStatus() != + GL_FRAMEBUFFER_COMPLETE) { + return false; + } + + // TODO(apatrick): Fix this once ANGLE supports shared contexts. + // Clear the saved offscreen color texture. Use default GL context + // to ensure clear is not affected by client set state. + if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { + ScopedDefaultGLContext scoped_context(this); + glBindFramebufferEXT(GL_FRAMEBUFFER, + offscreen_target_frame_buffer_->id()); + glClear(GL_COLOR_BUFFER_BIT); + glBindFramebufferEXT(GL_FRAMEBUFFER, 0); + + if (glGetError() != GL_NO_ERROR) + return false; + } + + // Re-attach the offscreen render texture to the target frame buffer. + offscreen_target_frame_buffer_->AttachRenderTexture( + offscreen_target_color_texture_.get()); + return true; } |