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

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: 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
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 "base/memory/scoped_ptr.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
22 class Buffer; 23 class Buffer;
24 class ErrorState;
23 class FeatureInfo; 25 class FeatureInfo;
24 class Framebuffer; 26 class Framebuffer;
25 class Program; 27 class Program;
26 class Renderbuffer; 28 class Renderbuffer;
27 29
28 // State associated with each texture unit. 30 // State associated with each texture unit.
29 struct GPU_EXPORT TextureUnit { 31 struct GPU_EXPORT TextureUnit {
30 TextureUnit(); 32 TextureUnit();
31 ~TextureUnit(); 33 ~TextureUnit();
32 34
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 Vec4() { 86 Vec4() {
85 v[0] = 0.0f; 87 v[0] = 0.0f;
86 v[1] = 0.0f; 88 v[1] = 0.0f;
87 v[2] = 0.0f; 89 v[2] = 0.0f;
88 v[3] = 1.0f; 90 v[3] = 1.0f;
89 } 91 }
90 float v[4]; 92 float v[4];
91 }; 93 };
92 94
93 struct GPU_EXPORT ContextState { 95 struct GPU_EXPORT ContextState {
94 explicit ContextState(FeatureInfo* feature_info); 96 ContextState(FeatureInfo* feature_info, Logger* logger);
95 ~ContextState(); 97 ~ContextState();
96 98
97 void Initialize(); 99 void Initialize();
98 100
99 void RestoreState() const; 101 void RestoreState() const;
100 void InitCapabilities() const; 102 void InitCapabilities() const;
101 void InitState() const; 103 void InitState() const;
102 104
103 void RestoreActiveTexture() const; 105 void RestoreActiveTexture() const;
104 void RestoreAttribute(GLuint index) const; 106 void RestoreAttribute(GLuint index) const;
105 void RestoreBufferBindings() const; 107 void RestoreBufferBindings() const;
106 void RestoreGlobalState() const; 108 void RestoreGlobalState() const;
107 void RestoreProgramBindings() const; 109 void RestoreProgramBindings() const;
108 void RestoreRenderbufferBindings() const; 110 void RestoreRenderbufferBindings() const;
109 void RestoreTextureUnitBindings(GLuint unit) const; 111 void RestoreTextureUnitBindings(GLuint unit) const;
110 112
111 // Helper for getting cached state. 113 // Helper for getting cached state.
112 bool GetStateAsGLint( 114 bool GetStateAsGLint(
113 GLenum pname, GLint* params, GLsizei* num_written) const; 115 GLenum pname, GLint* params, GLsizei* num_written) const;
114 bool GetStateAsGLfloat( 116 bool GetStateAsGLfloat(
115 GLenum pname, GLfloat* params, GLsizei* num_written) const; 117 GLenum pname, GLfloat* params, GLsizei* num_written) const;
116 bool GetEnabled(GLenum cap) const; 118 bool GetEnabled(GLenum cap) const;
117 119
120 ErrorState* GetErrorState();
121
118 #include "gpu/command_buffer/service/context_state_autogen.h" 122 #include "gpu/command_buffer/service/context_state_autogen.h"
119 123
120 EnableFlags enable_flags; 124 EnableFlags enable_flags;
121 125
122 // pack alignment as last set by glPixelStorei 126 // pack alignment as last set by glPixelStorei
123 GLint pack_alignment; 127 GLint pack_alignment;
124 128
125 // unpack alignment as last set by glPixelStorei 129 // unpack alignment as last set by glPixelStorei
126 GLint unpack_alignment; 130 GLint unpack_alignment;
127 131
(...skipping 26 matching lines...) Expand all
154 scoped_refptr<Renderbuffer> bound_renderbuffer; 158 scoped_refptr<Renderbuffer> bound_renderbuffer;
155 159
156 scoped_refptr<QueryManager::Query> current_query; 160 scoped_refptr<QueryManager::Query> current_query;
157 161
158 GLenum hint_generate_mipmap; 162 GLenum hint_generate_mipmap;
159 GLenum hint_fragment_shader_derivative; 163 GLenum hint_fragment_shader_derivative;
160 164
161 bool pack_reverse_row_order; 165 bool pack_reverse_row_order;
162 166
163 mutable bool fbo_binding_for_scissor_workaround_dirty_; 167 mutable bool fbo_binding_for_scissor_workaround_dirty_;
168 FeatureInfo* feature_info_;
164 169
165 FeatureInfo* feature_info_; 170 private:
171 scoped_ptr<ErrorState> error_state_;
166 }; 172 };
167 173
168 } // namespace gles2 174 } // namespace gles2
169 } // namespace gpu 175 } // namespace gpu
170 176
171 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ 177 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_
172 178
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/buffer_manager_unittest.cc ('k') | gpu/command_buffer/service/context_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698