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

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

Issue 14308014: Clean up of GLES2 Command Decoder by moving some of the error state into a separate class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix merge error. Created 7 years, 8 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/error_state.h » ('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 "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/framebuffer_manager.h" 10 #include "gpu/command_buffer/service/framebuffer_manager.h"
10 #include "gpu/command_buffer/service/program_manager.h" 11 #include "gpu/command_buffer/service/program_manager.h"
11 #include "gpu/command_buffer/service/renderbuffer_manager.h" 12 #include "gpu/command_buffer/service/renderbuffer_manager.h"
12 #include "ui/gl/gl_bindings.h" 13 #include "ui/gl/gl_bindings.h"
13 #include "ui/gl/gl_implementation.h" 14 #include "ui/gl/gl_implementation.h"
14 15
15 namespace gpu { 16 namespace gpu {
16 namespace gles2 { 17 namespace gles2 {
17 18
18 namespace { 19 namespace {
19 20
20 void EnableDisable(GLenum pname, bool enable) { 21 void EnableDisable(GLenum pname, bool enable) {
21 if (enable) { 22 if (enable) {
22 glEnable(pname); 23 glEnable(pname);
23 } else { 24 } else {
24 glDisable(pname); 25 glDisable(pname);
25 } 26 }
26 } 27 }
27 28
28 } // anonymous namespace. 29 } // anonymous namespace.
29 30
30 TextureUnit::TextureUnit() 31 TextureUnit::TextureUnit()
31 : bind_target(GL_TEXTURE_2D) { 32 : bind_target(GL_TEXTURE_2D) {
32 } 33 }
33 34
34 TextureUnit::~TextureUnit() { 35 TextureUnit::~TextureUnit() {
35 } 36 }
36 37
37 ContextState::ContextState(FeatureInfo* feature_info) 38 ContextState::ContextState(FeatureInfo* feature_info, Logger* logger)
38 : pack_alignment(4), 39 : pack_alignment(4),
39 unpack_alignment(4), 40 unpack_alignment(4),
40 active_texture_unit(0), 41 active_texture_unit(0),
41 hint_generate_mipmap(GL_DONT_CARE), 42 hint_generate_mipmap(GL_DONT_CARE),
42 hint_fragment_shader_derivative(GL_DONT_CARE), 43 hint_fragment_shader_derivative(GL_DONT_CARE),
43 pack_reverse_row_order(false), 44 pack_reverse_row_order(false),
44 fbo_binding_for_scissor_workaround_dirty_(false), 45 fbo_binding_for_scissor_workaround_dirty_(false),
45 feature_info_(feature_info) { 46 feature_info_(feature_info),
47 error_state_(ErrorState::Create(logger)) {
46 Initialize(); 48 Initialize();
47 } 49 }
48 50
49 ContextState::~ContextState() { 51 ContextState::~ContextState() {
50 } 52 }
51 53
52 void ContextState::RestoreTextureUnitBindings(GLuint unit) const { 54 void ContextState::RestoreTextureUnitBindings(GLuint unit) const {
53 DCHECK_LT(unit, texture_units.size()); 55 DCHECK_LT(unit, texture_units.size());
54 const TextureUnit& texture_unit = texture_units[unit]; 56 const TextureUnit& texture_unit = texture_units[unit];
55 glActiveTexture(GL_TEXTURE0 + unit); 57 glActiveTexture(GL_TEXTURE0 + unit);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 RestoreAttribute(attrib); 156 RestoreAttribute(attrib);
155 } 157 }
156 } 158 }
157 159
158 RestoreBufferBindings(); 160 RestoreBufferBindings();
159 RestoreRenderbufferBindings(); 161 RestoreRenderbufferBindings();
160 RestoreProgramBindings(); 162 RestoreProgramBindings();
161 RestoreGlobalState(); 163 RestoreGlobalState();
162 } 164 }
163 165
166 ErrorState* ContextState::GetErrorState() {
167 return error_state_.get();
168 }
169
164 // Include the auto-generated part of this file. We split this because it means 170 // 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 171 // 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. 172 // instead of having to edit some template or the code generator.
167 #include "gpu/command_buffer/service/context_state_impl_autogen.h" 173 #include "gpu/command_buffer/service/context_state_impl_autogen.h"
168 174
169 } // namespace gles2 175 } // namespace gles2
170 } // namespace gpu 176 } // namespace gpu
171 177
172 178
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/service/error_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698