| 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 "gpu/command_buffer/common/gles2_cmd_utils.h" | 7 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 8 #include "gpu/command_buffer/service/buffer_manager.h" | 8 #include "gpu/command_buffer/service/buffer_manager.h" |
| 9 #include "gpu/command_buffer/service/framebuffer_manager.h" | 9 #include "gpu/command_buffer/service/framebuffer_manager.h" |
| 10 #include "gpu/command_buffer/service/program_manager.h" | 10 #include "gpu/command_buffer/service/program_manager.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 } // anonymous namespace. | 28 } // anonymous namespace. |
| 29 | 29 |
| 30 TextureUnit::TextureUnit() | 30 TextureUnit::TextureUnit() |
| 31 : bind_target(GL_TEXTURE_2D) { | 31 : bind_target(GL_TEXTURE_2D) { |
| 32 } | 32 } |
| 33 | 33 |
| 34 TextureUnit::~TextureUnit() { | 34 TextureUnit::~TextureUnit() { |
| 35 } | 35 } |
| 36 | 36 |
| 37 ContextState::ContextState(FeatureInfo* feature_info) | 37 ContextState::ContextState(FeatureInfo* feature_info, Logger* logger) |
| 38 : pack_alignment(4), | 38 : pack_alignment(4), |
| 39 unpack_alignment(4), | 39 unpack_alignment(4), |
| 40 active_texture_unit(0), | 40 active_texture_unit(0), |
| 41 hint_generate_mipmap(GL_DONT_CARE), | 41 hint_generate_mipmap(GL_DONT_CARE), |
| 42 hint_fragment_shader_derivative(GL_DONT_CARE), | 42 hint_fragment_shader_derivative(GL_DONT_CARE), |
| 43 pack_reverse_row_order(false), | 43 pack_reverse_row_order(false), |
| 44 fbo_binding_for_scissor_workaround_dirty_(false), | 44 fbo_binding_for_scissor_workaround_dirty_(false), |
| 45 feature_info_(feature_info) { | 45 feature_info_(feature_info), |
| 46 error_state_(logger) { |
| 46 Initialize(); | 47 Initialize(); |
| 47 } | 48 } |
| 48 | 49 |
| 49 ContextState::~ContextState() { | 50 ContextState::~ContextState() { |
| 50 } | 51 } |
| 51 | 52 |
| 52 void ContextState::RestoreTextureUnitBindings(GLuint unit) const { | 53 void ContextState::RestoreTextureUnitBindings(GLuint unit) const { |
| 53 DCHECK_LT(unit, texture_units.size()); | 54 DCHECK_LT(unit, texture_units.size()); |
| 54 const TextureUnit& texture_unit = texture_units[unit]; | 55 const TextureUnit& texture_unit = texture_units[unit]; |
| 55 glActiveTexture(GL_TEXTURE0 + unit); | 56 glActiveTexture(GL_TEXTURE0 + unit); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 RestoreAttribute(attrib); | 155 RestoreAttribute(attrib); |
| 155 } | 156 } |
| 156 } | 157 } |
| 157 | 158 |
| 158 RestoreBufferBindings(); | 159 RestoreBufferBindings(); |
| 159 RestoreRenderbufferBindings(); | 160 RestoreRenderbufferBindings(); |
| 160 RestoreProgramBindings(); | 161 RestoreProgramBindings(); |
| 161 RestoreGlobalState(); | 162 RestoreGlobalState(); |
| 162 } | 163 } |
| 163 | 164 |
| 165 ErrorState* ContextState::GetErrorState() { |
| 166 return &error_state_; |
| 167 } |
| 168 |
| 164 // Include the auto-generated part of this file. We split this because it means | 169 // Include the auto-generated part of this file. We split this because it means |
| 165 // we can easily edit the non-auto generated parts right here in this file | 170 // we can easily edit the non-auto generated parts right here in this file |
| 166 // instead of having to edit some template or the code generator. | 171 // instead of having to edit some template or the code generator. |
| 167 #include "gpu/command_buffer/service/context_state_impl_autogen.h" | 172 #include "gpu/command_buffer/service/context_state_impl_autogen.h" |
| 168 | 173 |
| 169 } // namespace gles2 | 174 } // namespace gles2 |
| 170 } // namespace gpu | 175 } // namespace gpu |
| 171 | 176 |
| 172 | 177 |
| OLD | NEW |