Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: gpu/command_buffer/service/context_state.cc

Issue 2268503002: [Command Buffer] enable/disable FRAMEBUFFER_SRGB only when sRGB image is active (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: encapusulate some code to a function Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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) { 498 if (prev_state && framebuffer_srgb_ != prev_state->framebuffer_srgb_) {
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_) {
yunchao 2016/08/24 14:08:51 It is OK to keep Qiankun's code here. I just want
qiankun 2016/08/24 16:21:00 Agree with you.
504 // FRAMEBUFFER_SRGB will be restored lazily at render time. 499 // FRAMEBUFFER_SRGB will be restored lazily at render time.
qiankun 2016/08/24 16:22:13 This comment is wrong in your current implementati
yunchao 2016/08/25 16:29:51 That's true.
505 framebuffer_srgb_ = prev_state->framebuffer_srgb_; 500 framebuffer_srgb_ = prev_state->framebuffer_srgb_;
506 } 501 }
502 if (feature_info_->feature_flags().desktop_srgb_support) {
503 EnableDisable(GL_FRAMEBUFFER_SRGB, framebuffer_srgb_);
Zhenyao Mo 2016/08/25 00:39:37 That's what we try to avoid. If we use virtual co
yunchao 2016/08/25 16:29:51 You are correct. The original code is better.
504 }
507 } 505 }
508 506
509 ErrorState* ContextState::GetErrorState() { 507 ErrorState* ContextState::GetErrorState() {
510 return error_state_.get(); 508 return error_state_.get();
511 } 509 }
512 510
513 void ContextState::EnableDisable(GLenum pname, bool enable) const { 511 void ContextState::EnableDisable(GLenum pname, bool enable) const {
514 if (pname == GL_PRIMITIVE_RESTART_FIXED_INDEX && 512 if (pname == GL_PRIMITIVE_RESTART_FIXED_INDEX &&
515 feature_info_->feature_flags().emulate_primitive_restart_fixed_index) { 513 feature_info_->feature_flags().emulate_primitive_restart_fixed_index) {
516 // GLES2DecoderImpl::DoDrawElements can handle this situation 514 // GLES2DecoderImpl::DoDrawElements can handle this situation
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 UpdateUnpackParameters(); 705 UpdateUnpackParameters();
708 } 706 }
709 707
710 // Include the auto-generated part of this file. We split this because it means 708 // Include the auto-generated part of this file. We split this because it means
711 // we can easily edit the non-auto generated parts right here in this file 709 // we can easily edit the non-auto generated parts right here in this file
712 // instead of having to edit some template or the code generator. 710 // instead of having to edit some template or the code generator.
713 #include "gpu/command_buffer/service/context_state_impl_autogen.h" 711 #include "gpu/command_buffer/service/context_state_impl_autogen.h"
714 712
715 } // namespace gles2 713 } // namespace gles2
716 } // namespace gpu 714 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698