summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorpathorn@chromium.org <pathorn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-25 17:36:39 +0000
committerpathorn@chromium.org <pathorn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-25 17:36:39 +0000
commit0c8c9d2e5bd3d153a5794238c6d5398cd4298331 (patch)
tree1abf6498d751f619e7dce488f211498875e828f5 /gpu
parentfbf3da1409dead368edeec9681cf0015f664eaa3 (diff)
downloadchromium_src-0c8c9d2e5bd3d153a5794238c6d5398cd4298331.zip
chromium_src-0c8c9d2e5bd3d153a5794238c6d5398cd4298331.tar.gz
chromium_src-0c8c9d2e5bd3d153a5794238c6d5398cd4298331.tar.bz2
Fix two webgl crashes.
Uninitialized variable in getProgramInfoLog and friends. Fix crash in GLES2DecoderImpl if resizing the <canvas> when parent_ is null. BUG=44590 TEST=64-bit chrome on Linux is able to run the o3d-webgl samples. Review URL: http://codereview.chromium.org/2819025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50861 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc57
1 files changed, 30 insertions, 27 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 3f30647..2cc4509a 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -1844,35 +1844,35 @@ bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() {
0, // border
GL_RGBA,
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;
- }
+ // 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);
+ // 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;
+ }
- 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());
}
- // Re-attach the offscreen render texture to the target frame buffer.
- offscreen_target_frame_buffer_->AttachRenderTexture(
- offscreen_target_color_texture_.get());
-
return true;
}
@@ -4714,9 +4714,12 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
if (!UpdateOffscreenFrameBufferSize())
return error::kLostContext;
- ScopedFrameBufferBinder binder(this, offscreen_target_frame_buffer_->id());
- offscreen_saved_color_texture_->Copy(
- offscreen_saved_color_texture_->size());
+ if (parent_) {
+ ScopedFrameBufferBinder binder(this,
+ offscreen_target_frame_buffer_->id());
+ offscreen_saved_color_texture_->Copy(
+ offscreen_saved_color_texture_->size());
+ }
} else {
context_->SwapBuffers();
}