diff options
Diffstat (limited to 'gpu/command_buffer/service/gles2_cmd_decoder.cc')
-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; } |