summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc6
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc57
2 files changed, 33 insertions, 30 deletions
diff --git a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc
index c691b46..c08ba7c 100644
--- a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc
+++ b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc
@@ -484,7 +484,7 @@ DELEGATE_TO_GL_3(getProgramiv, GetProgramiv, WebGLId, unsigned long, int*)
WebKit::WebString WebGraphicsContext3DCommandBufferImpl::getProgramInfoLog(
WebGLId program) {
makeContextCurrent();
- GLint logLength;
+ GLint logLength = 0;
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &logLength);
if (!logLength)
return WebKit::WebString();
@@ -507,7 +507,7 @@ DELEGATE_TO_GL_3(getShaderiv, GetShaderiv, WebGLId, unsigned long, int*)
WebKit::WebString WebGraphicsContext3DCommandBufferImpl::getShaderInfoLog(
WebGLId shader) {
makeContextCurrent();
- GLint logLength;
+ GLint logLength = 0;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLength);
if (!logLength)
return WebKit::WebString();
@@ -525,7 +525,7 @@ WebKit::WebString WebGraphicsContext3DCommandBufferImpl::getShaderInfoLog(
WebKit::WebString WebGraphicsContext3DCommandBufferImpl::getShaderSource(
WebGLId shader) {
makeContextCurrent();
- GLint logLength;
+ GLint logLength = 0;
glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &logLength);
if (!logLength)
return WebKit::WebString();
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();
}