| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 glPauseTransformFeedback(); | 305 glPauseTransformFeedback(); |
| 306 } | 306 } |
| 307 } | 307 } |
| 308 if (bound_transform_feedback.get()) { | 308 if (bound_transform_feedback.get()) { |
| 309 bound_transform_feedback->DoBindTransformFeedback(GL_TRANSFORM_FEEDBACK); | 309 bound_transform_feedback->DoBindTransformFeedback(GL_TRANSFORM_FEEDBACK); |
| 310 } else { | 310 } else { |
| 311 glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0); | 311 glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0); |
| 312 } | 312 } |
| 313 } | 313 } |
| 314 | 314 |
| 315 void ContextState::RestoreIndexedUniformBufferBindings( |
| 316 const ContextState* prev_state) { |
| 317 if (!feature_info_->IsES3Capable()) |
| 318 return; |
| 319 indexed_uniform_buffer_bindings->RestoreBindings( |
| 320 prev_state ? prev_state->indexed_uniform_buffer_bindings.get() : nullptr); |
| 321 } |
| 322 |
| 315 void ContextState::RestoreActiveTexture() const { | 323 void ContextState::RestoreActiveTexture() const { |
| 316 glActiveTexture(GL_TEXTURE0 + active_texture_unit); | 324 glActiveTexture(GL_TEXTURE0 + active_texture_unit); |
| 317 } | 325 } |
| 318 | 326 |
| 319 void ContextState::RestoreAllTextureUnitBindings( | 327 void ContextState::RestoreAllTextureUnitBindings( |
| 320 const ContextState* prev_state) const { | 328 const ContextState* prev_state) const { |
| 321 // Restore Texture state. | 329 // Restore Texture state. |
| 322 for (size_t ii = 0; ii < texture_units.size(); ++ii) { | 330 for (size_t ii = 0; ii < texture_units.size(); ++ii) { |
| 323 RestoreTextureUnitBindings(ii, prev_state); | 331 RestoreTextureUnitBindings(ii, prev_state); |
| 324 } | 332 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 InitState(prev_state); | 447 InitState(prev_state); |
| 440 } | 448 } |
| 441 | 449 |
| 442 void ContextState::RestoreState(const ContextState* prev_state) { | 450 void ContextState::RestoreState(const ContextState* prev_state) { |
| 443 RestoreAllTextureUnitBindings(prev_state); | 451 RestoreAllTextureUnitBindings(prev_state); |
| 444 RestoreVertexAttribs(); | 452 RestoreVertexAttribs(); |
| 445 RestoreBufferBindings(); | 453 RestoreBufferBindings(); |
| 446 RestoreRenderbufferBindings(); | 454 RestoreRenderbufferBindings(); |
| 447 RestoreProgramBindings(); | 455 RestoreProgramBindings(); |
| 448 RestoreTransformFeedbackBindings(prev_state); | 456 RestoreTransformFeedbackBindings(prev_state); |
| 457 RestoreIndexedUniformBufferBindings(prev_state); |
| 449 RestoreGlobalState(prev_state); | 458 RestoreGlobalState(prev_state); |
| 450 } | 459 } |
| 451 | 460 |
| 452 ErrorState* ContextState::GetErrorState() { | 461 ErrorState* ContextState::GetErrorState() { |
| 453 return error_state_.get(); | 462 return error_state_.get(); |
| 454 } | 463 } |
| 455 | 464 |
| 456 void ContextState::EnableDisable(GLenum pname, bool enable) const { | 465 void ContextState::EnableDisable(GLenum pname, bool enable) const { |
| 457 if (pname == GL_PRIMITIVE_RESTART_FIXED_INDEX && | 466 if (pname == GL_PRIMITIVE_RESTART_FIXED_INDEX && |
| 458 feature_info_->feature_flags().emulate_primitive_restart_fixed_index) { | 467 feature_info_->feature_flags().emulate_primitive_restart_fixed_index) { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 UpdateUnpackParameters(); | 652 UpdateUnpackParameters(); |
| 644 } | 653 } |
| 645 | 654 |
| 646 // Include the auto-generated part of this file. We split this because it means | 655 // Include the auto-generated part of this file. We split this because it means |
| 647 // we can easily edit the non-auto generated parts right here in this file | 656 // we can easily edit the non-auto generated parts right here in this file |
| 648 // instead of having to edit some template or the code generator. | 657 // instead of having to edit some template or the code generator. |
| 649 #include "gpu/command_buffer/service/context_state_impl_autogen.h" | 658 #include "gpu/command_buffer/service/context_state_impl_autogen.h" |
| 650 | 659 |
| 651 } // namespace gles2 | 660 } // namespace gles2 |
| 652 } // namespace gpu | 661 } // namespace gpu |
| OLD | NEW |