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

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

Issue 16240016: gpu: Make pack/unpack alignment part of autogenerated state (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sort states. Created 7 years, 6 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 | Annotate | Revision Log
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/error_state.h"
10 #include "gpu/command_buffer/service/framebuffer_manager.h" 10 #include "gpu/command_buffer/service/framebuffer_manager.h"
(...skipping 18 matching lines...) Expand all
29 } // anonymous namespace. 29 } // anonymous namespace.
30 30
31 TextureUnit::TextureUnit() 31 TextureUnit::TextureUnit()
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 : active_texture_unit(0),
40 unpack_alignment(4),
41 active_texture_unit(0),
42 pack_reverse_row_order(false), 40 pack_reverse_row_order(false),
43 fbo_binding_for_scissor_workaround_dirty_(false), 41 fbo_binding_for_scissor_workaround_dirty_(false),
44 feature_info_(feature_info), 42 feature_info_(feature_info),
45 error_state_(ErrorState::Create(logger)) { 43 error_state_(ErrorState::Create(logger)) {
46 Initialize(); 44 Initialize();
47 } 45 }
48 46
49 ContextState::~ContextState() { 47 ContextState::~ContextState() {
50 } 48 }
51 49
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } else { 127 } else {
130 glDisableVertexAttribArray(attrib_index); 128 glDisableVertexAttribArray(attrib_index);
131 } 129 }
132 } 130 }
133 glVertexAttrib4fv(attrib_index, attrib_values[attrib_index].v); 131 glVertexAttrib4fv(attrib_index, attrib_values[attrib_index].v);
134 } 132 }
135 133
136 void ContextState::RestoreGlobalState() const { 134 void ContextState::RestoreGlobalState() const {
137 InitCapabilities(); 135 InitCapabilities();
138 InitState(); 136 InitState();
139
140 glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment);
141 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment);
142 } 137 }
143 138
144 void ContextState::RestoreState() const { 139 void ContextState::RestoreState() const {
145 RestoreAllTextureUnitBindings(); 140 RestoreAllTextureUnitBindings();
146 141
147 // Restore Attrib State 142 // Restore Attrib State
148 // TODO: This if should not be needed. RestoreState is getting called 143 // TODO: This if should not be needed. RestoreState is getting called
149 // before GLES2Decoder::Initialize which is a bug. 144 // before GLES2Decoder::Initialize which is a bug.
150 if (vertex_attrib_manager) { 145 if (vertex_attrib_manager) {
151 // TODO(gman): Move this restoration to VertexAttribManager. 146 // TODO(gman): Move this restoration to VertexAttribManager.
(...skipping 15 matching lines...) Expand all
167 162
168 // Include the auto-generated part of this file. We split this because it means 163 // Include the auto-generated part of this file. We split this because it means
169 // we can easily edit the non-auto generated parts right here in this file 164 // we can easily edit the non-auto generated parts right here in this file
170 // instead of having to edit some template or the code generator. 165 // instead of having to edit some template or the code generator.
171 #include "gpu/command_buffer/service/context_state_impl_autogen.h" 166 #include "gpu/command_buffer/service/context_state_impl_autogen.h"
172 167
173 } // namespace gles2 168 } // namespace gles2
174 } // namespace gpu 169 } // namespace gpu
175 170
176 171
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/service/context_state_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698