OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 4251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4262 state_.RestoreVertexAttribs(); | 4262 state_.RestoreVertexAttribs(); |
4263 } | 4263 } |
4264 | 4264 |
4265 void GLES2DecoderImpl::SetIgnoreCachedStateForTest(bool ignore) { | 4265 void GLES2DecoderImpl::SetIgnoreCachedStateForTest(bool ignore) { |
4266 state_.SetIgnoreCachedStateForTest(ignore); | 4266 state_.SetIgnoreCachedStateForTest(ignore); |
4267 } | 4267 } |
4268 | 4268 |
4269 void GLES2DecoderImpl::OnFboChanged() const { | 4269 void GLES2DecoderImpl::OnFboChanged() const { |
4270 if (workarounds().restore_scissor_on_fbo_change) | 4270 if (workarounds().restore_scissor_on_fbo_change) |
4271 state_.fbo_binding_for_scissor_workaround_dirty_ = true; | 4271 state_.fbo_binding_for_scissor_workaround_dirty_ = true; |
4272 | |
4273 if (workarounds().gl_begin_gl_end_on_fbo_change_to_backbuffer) { | |
4274 // Sometimes calling glBindFramebuffer doesn't seem to be enough to get | |
4275 // rendered contents to show up in the color attachment, if it's the | |
4276 // backbuffer. It appears that doing a glBegin/glEnd pair is enough to | |
4277 // tickle the driver into actually effect the binding. | |
4278 // http://crbug.com/435786 | |
4279 GLuint bound_fbo = -1; | |
4280 glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, (GLint*)&bound_fbo); | |
4281 if (bound_fbo == GetBackbufferServiceId()) { | |
4282 GLuint old_program = -1; | |
4283 glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&old_program); | |
4284 glUseProgram(0); | |
4285 GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); | |
4286 if (status == GL_FRAMEBUFFER_COMPLETE) { | |
4287 glBegin(GL_TRIANGLES); | |
4288 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'
| |
4289 } | |
4290 if (glIsProgram(old_program)) | |
4291 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.
| |
4292 } | |
4293 } | |
4272 } | 4294 } |
4273 | 4295 |
4274 // Called after the FBO is checked for completeness. | 4296 // Called after the FBO is checked for completeness. |
4275 void GLES2DecoderImpl::OnUseFramebuffer() const { | 4297 void GLES2DecoderImpl::OnUseFramebuffer() const { |
4276 if (state_.fbo_binding_for_scissor_workaround_dirty_) { | 4298 if (state_.fbo_binding_for_scissor_workaround_dirty_) { |
4277 state_.fbo_binding_for_scissor_workaround_dirty_ = false; | 4299 state_.fbo_binding_for_scissor_workaround_dirty_ = false; |
4278 // The driver forgets the correct scissor when modifying the FBO binding. | 4300 // The driver forgets the correct scissor when modifying the FBO binding. |
4279 glScissor(state_.scissor_x, | 4301 glScissor(state_.scissor_x, |
4280 state_.scissor_y, | 4302 state_.scissor_y, |
4281 state_.scissor_width, | 4303 state_.scissor_width, |
(...skipping 7250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11532 } | 11554 } |
11533 } | 11555 } |
11534 | 11556 |
11535 // Include the auto-generated part of this file. We split this because it means | 11557 // Include the auto-generated part of this file. We split this because it means |
11536 // we can easily edit the non-auto generated parts right here in this file | 11558 // we can easily edit the non-auto generated parts right here in this file |
11537 // instead of having to edit some template or the code generator. | 11559 // instead of having to edit some template or the code generator. |
11538 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 11560 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
11539 | 11561 |
11540 } // namespace gles2 | 11562 } // namespace gles2 |
11541 } // namespace gpu | 11563 } // namespace gpu |
OLD | NEW |