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

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

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: Fixed the remaining tests. Added mock ErrorState. 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
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 // This file contains the ContextState class. 5 // This file contains the ContextState class.
6 6
7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_
8 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ 8 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_
9 9
10 #include <vector> 10 #include <vector>
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "gpu/command_buffer/service/error_state.h"
12 #include "gpu/command_buffer/service/gl_utils.h" 13 #include "gpu/command_buffer/service/gl_utils.h"
13 #include "gpu/command_buffer/service/query_manager.h" 14 #include "gpu/command_buffer/service/query_manager.h"
14 #include "gpu/command_buffer/service/texture_manager.h" 15 #include "gpu/command_buffer/service/texture_manager.h"
15 #include "gpu/command_buffer/service/vertex_attrib_manager.h" 16 #include "gpu/command_buffer/service/vertex_attrib_manager.h"
16 #include "gpu/command_buffer/service/vertex_array_manager.h" 17 #include "gpu/command_buffer/service/vertex_array_manager.h"
17 #include "gpu/gpu_export.h" 18 #include "gpu/gpu_export.h"
18 19
19 namespace gpu { 20 namespace gpu {
20 namespace gles2 { 21 namespace gles2 {
21 22
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 Vec4() { 85 Vec4() {
85 v[0] = 0.0f; 86 v[0] = 0.0f;
86 v[1] = 0.0f; 87 v[1] = 0.0f;
87 v[2] = 0.0f; 88 v[2] = 0.0f;
88 v[3] = 1.0f; 89 v[3] = 1.0f;
89 } 90 }
90 float v[4]; 91 float v[4];
91 }; 92 };
92 93
93 struct GPU_EXPORT ContextState { 94 struct GPU_EXPORT ContextState {
94 explicit ContextState(FeatureInfo* feature_info); 95 ContextState(FeatureInfo* feature_info, Logger* logger);
95 ~ContextState(); 96 ~ContextState();
96 97
97 void Initialize(); 98 void Initialize();
98 99
99 void RestoreState() const; 100 void RestoreState() const;
100 void InitCapabilities() const; 101 void InitCapabilities() const;
101 void InitState() const; 102 void InitState() const;
102 103
103 void RestoreActiveTexture() const; 104 void RestoreActiveTexture() const;
104 void RestoreAttribute(GLuint index) const; 105 void RestoreAttribute(GLuint index) const;
105 void RestoreBufferBindings() const; 106 void RestoreBufferBindings() const;
106 void RestoreGlobalState() const; 107 void RestoreGlobalState() const;
107 void RestoreProgramBindings() const; 108 void RestoreProgramBindings() const;
108 void RestoreRenderbufferBindings() const; 109 void RestoreRenderbufferBindings() const;
109 void RestoreTextureUnitBindings(GLuint unit) const; 110 void RestoreTextureUnitBindings(GLuint unit) const;
110 111
111 // Helper for getting cached state. 112 // Helper for getting cached state.
112 bool GetStateAsGLint( 113 bool GetStateAsGLint(
113 GLenum pname, GLint* params, GLsizei* num_written) const; 114 GLenum pname, GLint* params, GLsizei* num_written) const;
114 bool GetStateAsGLfloat( 115 bool GetStateAsGLfloat(
115 GLenum pname, GLfloat* params, GLsizei* num_written) const; 116 GLenum pname, GLfloat* params, GLsizei* num_written) const;
116 bool GetEnabled(GLenum cap) const; 117 bool GetEnabled(GLenum cap) const;
117 118
119 ErrorState* GetErrorState();
120
118 #include "gpu/command_buffer/service/context_state_autogen.h" 121 #include "gpu/command_buffer/service/context_state_autogen.h"
119 122
120 EnableFlags enable_flags; 123 EnableFlags enable_flags;
121 124
122 // pack alignment as last set by glPixelStorei 125 // pack alignment as last set by glPixelStorei
123 GLint pack_alignment; 126 GLint pack_alignment;
124 127
125 // unpack alignment as last set by glPixelStorei 128 // unpack alignment as last set by glPixelStorei
126 GLint unpack_alignment; 129 GLint unpack_alignment;
127 130
(...skipping 26 matching lines...) Expand all
154 scoped_refptr<Renderbuffer> bound_renderbuffer; 157 scoped_refptr<Renderbuffer> bound_renderbuffer;
155 158
156 scoped_refptr<QueryManager::Query> current_query; 159 scoped_refptr<QueryManager::Query> current_query;
157 160
158 GLenum hint_generate_mipmap; 161 GLenum hint_generate_mipmap;
159 GLenum hint_fragment_shader_derivative; 162 GLenum hint_fragment_shader_derivative;
160 163
161 bool pack_reverse_row_order; 164 bool pack_reverse_row_order;
162 165
163 mutable bool fbo_binding_for_scissor_workaround_dirty_; 166 mutable bool fbo_binding_for_scissor_workaround_dirty_;
167 FeatureInfo* feature_info_;
164 168
165 FeatureInfo* feature_info_; 169 private:
170 ErrorStateImpl error_state_;
166 }; 171 };
167 172
168 } // namespace gles2 173 } // namespace gles2
169 } // namespace gpu 174 } // namespace gpu
170 175
171 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ 176 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_
172 177
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698