Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
index f97710e86a61009ce7b6b54517f63040d5f8cb3b..fcce245ebb0af236a61e715e6964ebb495ce5bbf 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -4269,6 +4269,28 @@ void GLES2DecoderImpl::SetIgnoreCachedStateForTest(bool ignore) { |
void GLES2DecoderImpl::OnFboChanged() const { |
if (workarounds().restore_scissor_on_fbo_change) |
state_.fbo_binding_for_scissor_workaround_dirty_ = true; |
+ |
+ if (workarounds().gl_begin_gl_end_on_fbo_change_to_backbuffer) { |
+ // Sometimes calling glBindFramebuffer doesn't seem to be enough to get |
+ // rendered contents to show up in the color attachment, if it's the |
+ // backbuffer. It appears that doing a glBegin/glEnd pair is enough to |
+ // tickle the driver into actually effect the binding. |
+ // http://crbug.com/435786 |
+ GLuint bound_fbo = -1; |
+ glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, (GLint*)&bound_fbo); |
+ if (bound_fbo == GetBackbufferServiceId()) { |
+ GLuint old_program = -1; |
+ glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&old_program); |
+ glUseProgram(0); |
+ GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); |
+ if (status == GL_FRAMEBUFFER_COMPLETE) { |
+ glBegin(GL_TRIANGLES); |
+ glEnd(); |
Ken Russell (switch to Gerrit)
2014/12/11 07:06:37
I'm surprised this compiles. This file is supposed
ccameron
2014/12/11 09:57:31
Interesting! The command line is at the bottom. I'
|
+ } |
+ if (glIsProgram(old_program)) |
+ glUseProgram(old_program); |
Ken Russell (switch to Gerrit)
2014/12/11 07:06:37
Note: this isn't guaranteed to be able to fully re
ccameron
2014/12/11 09:57:31
Okay, I was curious about how this could fail. I'v
Ken Russell (switch to Gerrit)
2014/12/12 02:30:44
I think that should be sufficient.
|
+ } |
+ } |
} |
// Called after the FBO is checked for completeness. |