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

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

Issue 1949303003: Improve indexed gl state related GL commands. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tex
Patch Set: fix a DCHECK failure Created 4 years, 7 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
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/service/feature_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 glPauseTransformFeedback(); 308 glPauseTransformFeedback();
309 } 309 }
310 } 310 }
311 if (bound_transform_feedback.get()) { 311 if (bound_transform_feedback.get()) {
312 bound_transform_feedback->DoBindTransformFeedback(GL_TRANSFORM_FEEDBACK); 312 bound_transform_feedback->DoBindTransformFeedback(GL_TRANSFORM_FEEDBACK);
313 } else { 313 } else {
314 glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0); 314 glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
315 } 315 }
316 } 316 }
317 317
318 void ContextState::RestoreIndexedUniformBufferBindings(
319 const ContextState* prev_state) {
320 if (!feature_info_->IsES3Capable())
321 return;
322 indexed_uniform_buffer_bindings->RestoreBindings(
323 prev_state ? prev_state->indexed_uniform_buffer_bindings.get() : nullptr);
324 }
325
318 void ContextState::RestoreActiveTexture() const { 326 void ContextState::RestoreActiveTexture() const {
319 glActiveTexture(GL_TEXTURE0 + active_texture_unit); 327 glActiveTexture(GL_TEXTURE0 + active_texture_unit);
320 } 328 }
321 329
322 void ContextState::RestoreAllTextureUnitBindings( 330 void ContextState::RestoreAllTextureUnitBindings(
323 const ContextState* prev_state) const { 331 const ContextState* prev_state) const {
324 // Restore Texture state. 332 // Restore Texture state.
325 for (size_t ii = 0; ii < texture_units.size(); ++ii) { 333 for (size_t ii = 0; ii < texture_units.size(); ++ii) {
326 RestoreTextureUnitBindings(ii, prev_state); 334 RestoreTextureUnitBindings(ii, prev_state);
327 } 335 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 InitState(prev_state); 450 InitState(prev_state);
443 } 451 }
444 452
445 void ContextState::RestoreState(const ContextState* prev_state) { 453 void ContextState::RestoreState(const ContextState* prev_state) {
446 RestoreAllTextureUnitBindings(prev_state); 454 RestoreAllTextureUnitBindings(prev_state);
447 RestoreVertexAttribs(); 455 RestoreVertexAttribs();
448 RestoreBufferBindings(); 456 RestoreBufferBindings();
449 RestoreRenderbufferBindings(); 457 RestoreRenderbufferBindings();
450 RestoreProgramBindings(); 458 RestoreProgramBindings();
451 RestoreTransformFeedbackBindings(prev_state); 459 RestoreTransformFeedbackBindings(prev_state);
460 RestoreIndexedUniformBufferBindings(prev_state);
452 RestoreGlobalState(prev_state); 461 RestoreGlobalState(prev_state);
453 } 462 }
454 463
455 ErrorState* ContextState::GetErrorState() { 464 ErrorState* ContextState::GetErrorState() {
456 return error_state_.get(); 465 return error_state_.get();
457 } 466 }
458 467
459 void ContextState::EnableDisable(GLenum pname, bool enable) const { 468 void ContextState::EnableDisable(GLenum pname, bool enable) const {
460 if (pname == GL_PRIMITIVE_RESTART_FIXED_INDEX && 469 if (pname == GL_PRIMITIVE_RESTART_FIXED_INDEX &&
461 feature_info_->feature_flags().emulate_primitive_restart_fixed_index) { 470 feature_info_->feature_flags().emulate_primitive_restart_fixed_index) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 UpdateUnpackParameters(); 655 UpdateUnpackParameters();
647 } 656 }
648 657
649 // Include the auto-generated part of this file. We split this because it means 658 // Include the auto-generated part of this file. We split this because it means
650 // we can easily edit the non-auto generated parts right here in this file 659 // we can easily edit the non-auto generated parts right here in this file
651 // instead of having to edit some template or the code generator. 660 // instead of having to edit some template or the code generator.
652 #include "gpu/command_buffer/service/context_state_impl_autogen.h" 661 #include "gpu/command_buffer/service/context_state_impl_autogen.h"
653 662
654 } // namespace gles2 663 } // namespace gles2
655 } // namespace gpu 664 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/service/feature_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698