| 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/error_state.h" | 9 #include "gpu/command_buffer/service/error_state.h" |
| 10 #include "gpu/command_buffer/service/framebuffer_manager.h" | 10 #include "gpu/command_buffer/service/framebuffer_manager.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 : bind_target(GL_TEXTURE_2D) { | 32 : bind_target(GL_TEXTURE_2D) { |
| 33 } | 33 } |
| 34 | 34 |
| 35 TextureUnit::~TextureUnit() { | 35 TextureUnit::~TextureUnit() { |
| 36 } | 36 } |
| 37 | 37 |
| 38 ContextState::ContextState(FeatureInfo* feature_info, Logger* logger) | 38 ContextState::ContextState(FeatureInfo* feature_info, Logger* logger) |
| 39 : pack_alignment(4), | 39 : pack_alignment(4), |
| 40 unpack_alignment(4), | 40 unpack_alignment(4), |
| 41 active_texture_unit(0), | 41 active_texture_unit(0), |
| 42 hint_generate_mipmap(GL_DONT_CARE), | |
| 43 hint_fragment_shader_derivative(GL_DONT_CARE), | |
| 44 pack_reverse_row_order(false), | 42 pack_reverse_row_order(false), |
| 45 fbo_binding_for_scissor_workaround_dirty_(false), | 43 fbo_binding_for_scissor_workaround_dirty_(false), |
| 46 feature_info_(feature_info), | 44 feature_info_(feature_info), |
| 47 error_state_(ErrorState::Create(logger)) { | 45 error_state_(ErrorState::Create(logger)) { |
| 48 Initialize(); | 46 Initialize(); |
| 49 } | 47 } |
| 50 | 48 |
| 51 ContextState::~ContextState() { | 49 ContextState::~ContextState() { |
| 52 } | 50 } |
| 53 | 51 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 132 } |
| 135 glVertexAttrib4fv(attrib_index, attrib_values[attrib_index].v); | 133 glVertexAttrib4fv(attrib_index, attrib_values[attrib_index].v); |
| 136 } | 134 } |
| 137 | 135 |
| 138 void ContextState::RestoreGlobalState() const { | 136 void ContextState::RestoreGlobalState() const { |
| 139 InitCapabilities(); | 137 InitCapabilities(); |
| 140 InitState(); | 138 InitState(); |
| 141 | 139 |
| 142 glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment); | 140 glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment); |
| 143 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment); | 141 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment); |
| 144 | |
| 145 glHint(GL_GENERATE_MIPMAP_HINT, hint_generate_mipmap); | |
| 146 // TODO: If OES_standard_derivatives is available | |
| 147 // restore GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES | |
| 148 } | 142 } |
| 149 | 143 |
| 150 void ContextState::RestoreState() const { | 144 void ContextState::RestoreState() const { |
| 151 RestoreAllTextureUnitBindings(); | 145 RestoreAllTextureUnitBindings(); |
| 152 | 146 |
| 153 // Restore Attrib State | 147 // Restore Attrib State |
| 154 // TODO: This if should not be needed. RestoreState is getting called | 148 // TODO: This if should not be needed. RestoreState is getting called |
| 155 // before GLES2Decoder::Initialize which is a bug. | 149 // before GLES2Decoder::Initialize which is a bug. |
| 156 if (vertex_attrib_manager) { | 150 if (vertex_attrib_manager) { |
| 157 // TODO(gman): Move this restoration to VertexAttribManager. | 151 // TODO(gman): Move this restoration to VertexAttribManager. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 173 | 167 |
| 174 // Include the auto-generated part of this file. We split this because it means | 168 // Include the auto-generated part of this file. We split this because it means |
| 175 // we can easily edit the non-auto generated parts right here in this file | 169 // we can easily edit the non-auto generated parts right here in this file |
| 176 // instead of having to edit some template or the code generator. | 170 // instead of having to edit some template or the code generator. |
| 177 #include "gpu/command_buffer/service/context_state_impl_autogen.h" | 171 #include "gpu/command_buffer/service/context_state_impl_autogen.h" |
| 178 | 172 |
| 179 } // namespace gles2 | 173 } // namespace gles2 |
| 180 } // namespace gpu | 174 } // namespace gpu |
| 181 | 175 |
| 182 | 176 |
| OLD | NEW |