summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-19 21:58:05 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-19 21:58:05 +0000
commitebcc462bff6e2328dbae1fb6a42a3ffc3d2f0e4a (patch)
tree7fbf6daacb8a0149462b65d4d53eb41bfc85f4bc /gpu
parent46da33beb42f48672659fed469da4b15ed927776 (diff)
downloadchromium_src-ebcc462bff6e2328dbae1fb6a42a3ffc3d2f0e4a.zip
chromium_src-ebcc462bff6e2328dbae1fb6a42a3ffc3d2f0e4a.tar.gz
chromium_src-ebcc462bff6e2328dbae1fb6a42a3ffc3d2f0e4a.tar.bz2
Reparenting of RendererGLContexts supports going from no parent to having a parent.
RendererGLContext::SetParent is a no-op if the parent did not change to avoid a redundant sync IPC. Added SetParentContext to WebGraphicsContext3DCommandBufferImpl. WebKit change to follow. Review URL: http://codereview.chromium.org/7237009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93106 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc59
1 files changed, 34 insertions, 25 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index d5bd745..1dcfd51 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -470,6 +470,7 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>,
uint32 parent_texture_id);
virtual void ResizeOffscreenFrameBuffer(const gfx::Size& size);
virtual bool UpdateOffscreenFrameBufferSize();
+ void UpdateParentTextureInfo();
virtual bool MakeCurrent();
virtual GLES2Util* GetGLES2Util() { return &util_; }
virtual gfx::GLContext* GetGLContext() { return context_.get(); }
@@ -2273,21 +2274,36 @@ bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() {
RestoreClearState();
}
- if (parent_ || IsOffscreenBufferMultisampled()) {
- DCHECK(offscreen_saved_color_format_);
- offscreen_saved_color_texture_->AllocateStorage(
- pending_offscreen_size_, offscreen_saved_color_format_);
+ // Allocate the offscreen saved color texture.
+ DCHECK(offscreen_saved_color_format_);
+ offscreen_saved_color_texture_->AllocateStorage(
+ pending_offscreen_size_, offscreen_saved_color_format_);
- offscreen_saved_frame_buffer_->AttachRenderTexture(
- offscreen_saved_color_texture_.get());
- if (offscreen_saved_frame_buffer_->CheckStatus() !=
- GL_FRAMEBUFFER_COMPLETE) {
- LOG(ERROR) << "GLES2DecoderImpl::UpdateOffscreenFrameBufferSize failed "
- << "because offscreen saved FBO was incomplete.";
- return false;
- }
+ offscreen_saved_frame_buffer_->AttachRenderTexture(
+ offscreen_saved_color_texture_.get());
+ if (offscreen_saved_frame_buffer_->CheckStatus() !=
+ GL_FRAMEBUFFER_COMPLETE) {
+ LOG(ERROR) << "GLES2DecoderImpl::UpdateOffscreenFrameBufferSize failed "
+ << "because offscreen saved FBO was incomplete.";
+ return false;
+ }
+
+ // Clear the offscreen color texture.
+ {
+ ScopedFrameBufferBinder binder(this, offscreen_saved_frame_buffer_->id());
+ glClearColor(0, 0, 0, 0);
+ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ glDisable(GL_SCISSOR_TEST);
+ glClear(GL_COLOR_BUFFER_BIT);
+ RestoreClearState();
}
+ UpdateParentTextureInfo();
+
+ return true;
+}
+
+void GLES2DecoderImpl::UpdateParentTextureInfo() {
if (parent_) {
// Update the info about the offscreen saved color texture in the parent.
// The reference to the parent is a weak pointer and will become null if the
@@ -2331,19 +2347,7 @@ bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() {
info,
GL_TEXTURE_WRAP_T,
GL_CLAMP_TO_EDGE);
-
- // Clear the offscreen color texture.
- {
- ScopedFrameBufferBinder binder(this, offscreen_saved_frame_buffer_->id());
- glClearColor(0, 0, 0, 0);
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- glDisable(GL_SCISSOR_TEST);
- glClear(GL_COLOR_BUFFER_BIT);
- RestoreClearState();
- }
}
-
- return true;
}
void GLES2DecoderImpl::SetResizeCallback(Callback1<gfx::Size>::Type* callback) {
@@ -2441,6 +2445,9 @@ void GLES2DecoderImpl::Destroy() {
bool GLES2DecoderImpl::SetParent(GLES2Decoder* new_parent,
uint32 new_parent_texture_id) {
+ if (!offscreen_saved_color_texture_.get())
+ return false;
+
// Remove the saved frame buffer mapping from the parent decoder. The
// parent pointer is a weak pointer so it will be null if the parent has
// already been destroyed.
@@ -2473,6 +2480,8 @@ bool GLES2DecoderImpl::SetParent(GLES2Decoder* new_parent,
new_parent_impl->texture_manager()->SetInfoTarget(info, GL_TEXTURE_2D);
parent_ = new_parent_impl->AsWeakPtr();
+
+ UpdateParentTextureInfo();
} else {
parent_.reset();
}
@@ -6485,7 +6494,7 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
ScopedFrameBufferBinder binder(this,
offscreen_target_frame_buffer_->id());
- if (parent_) {
+ if (surface_->IsOffscreen()) {
// Copy the target frame buffer to the saved offscreen texture.
offscreen_saved_color_texture_->Copy(
offscreen_saved_color_texture_->size(),