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/context_state.h" | 5 #include "gpu/command_buffer/service/context_state.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 488 |
489 void ContextState::RestoreState(const ContextState* prev_state) { | 489 void ContextState::RestoreState(const ContextState* prev_state) { |
490 RestoreAllTextureUnitBindings(prev_state); | 490 RestoreAllTextureUnitBindings(prev_state); |
491 RestoreVertexAttribs(); | 491 RestoreVertexAttribs(); |
492 RestoreBufferBindings(); | 492 RestoreBufferBindings(); |
493 RestoreRenderbufferBindings(); | 493 RestoreRenderbufferBindings(); |
494 RestoreProgramSettings(prev_state, true); | 494 RestoreProgramSettings(prev_state, true); |
495 RestoreIndexedUniformBufferBindings(prev_state); | 495 RestoreIndexedUniformBufferBindings(prev_state); |
496 RestoreGlobalState(prev_state); | 496 RestoreGlobalState(prev_state); |
497 | 497 |
498 if (prev_state && framebuffer_srgb_ != prev_state->framebuffer_srgb_) { | 498 if (!prev_state) { |
| 499 if (feature_info_->feature_flags().desktop_srgb_support) { |
| 500 framebuffer_srgb_ = false; |
| 501 glDisable(GL_FRAMEBUFFER_SRGB); |
| 502 } |
| 503 } else if (framebuffer_srgb_ != prev_state->framebuffer_srgb_) { |
499 // FRAMEBUFFER_SRGB will be restored lazily at render time. | 504 // FRAMEBUFFER_SRGB will be restored lazily at render time. |
500 framebuffer_srgb_ = prev_state->framebuffer_srgb_; | 505 framebuffer_srgb_ = prev_state->framebuffer_srgb_; |
501 } | 506 } |
502 } | 507 } |
503 | 508 |
504 ErrorState* ContextState::GetErrorState() { | 509 ErrorState* ContextState::GetErrorState() { |
505 return error_state_.get(); | 510 return error_state_.get(); |
506 } | 511 } |
507 | 512 |
508 void ContextState::EnableDisable(GLenum pname, bool enable) const { | 513 void ContextState::EnableDisable(GLenum pname, bool enable) const { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 UpdateUnpackParameters(); | 707 UpdateUnpackParameters(); |
703 } | 708 } |
704 | 709 |
705 // Include the auto-generated part of this file. We split this because it means | 710 // Include the auto-generated part of this file. We split this because it means |
706 // we can easily edit the non-auto generated parts right here in this file | 711 // we can easily edit the non-auto generated parts right here in this file |
707 // instead of having to edit some template or the code generator. | 712 // instead of having to edit some template or the code generator. |
708 #include "gpu/command_buffer/service/context_state_impl_autogen.h" | 713 #include "gpu/command_buffer/service/context_state_impl_autogen.h" |
709 | 714 |
710 } // namespace gles2 | 715 } // namespace gles2 |
711 } // namespace gpu | 716 } // namespace gpu |
OLD | NEW |