| 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 // 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 <memory> | 10 #include <memory> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace gles2 { | 22 namespace gles2 { |
| 23 | 23 |
| 24 class Buffer; | 24 class Buffer; |
| 25 class ErrorState; | 25 class ErrorState; |
| 26 class ErrorStateClient; | 26 class ErrorStateClient; |
| 27 class FeatureInfo; | 27 class FeatureInfo; |
| 28 class Framebuffer; | 28 class Framebuffer; |
| 29 class Logger; | 29 class Logger; |
| 30 class Program; | 30 class Program; |
| 31 class Renderbuffer; | 31 class Renderbuffer; |
| 32 class TransformFeedback; |
| 32 | 33 |
| 33 // State associated with each texture unit. | 34 // State associated with each texture unit. |
| 34 struct GPU_EXPORT TextureUnit { | 35 struct GPU_EXPORT TextureUnit { |
| 35 TextureUnit(); | 36 TextureUnit(); |
| 36 TextureUnit(const TextureUnit& other); | 37 TextureUnit(const TextureUnit& other); |
| 37 ~TextureUnit(); | 38 ~TextureUnit(); |
| 38 | 39 |
| 39 // The last target that was bound to this texture unit. | 40 // The last target that was bound to this texture unit. |
| 40 GLenum bind_target; | 41 GLenum bind_target; |
| 41 | 42 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 void RestoreAllTextureUnitBindings(const ContextState* prev_state) const; | 182 void RestoreAllTextureUnitBindings(const ContextState* prev_state) const; |
| 182 void RestoreActiveTextureUnitBinding(unsigned int target) const; | 183 void RestoreActiveTextureUnitBinding(unsigned int target) const; |
| 183 void RestoreVertexAttribValues() const; | 184 void RestoreVertexAttribValues() const; |
| 184 void RestoreVertexAttribArrays( | 185 void RestoreVertexAttribArrays( |
| 185 const scoped_refptr<VertexAttribManager> attrib_manager) const; | 186 const scoped_refptr<VertexAttribManager> attrib_manager) const; |
| 186 void RestoreVertexAttribs() const; | 187 void RestoreVertexAttribs() const; |
| 187 void RestoreBufferBindings() const; | 188 void RestoreBufferBindings() const; |
| 188 void RestoreGlobalState(const ContextState* prev_state) const; | 189 void RestoreGlobalState(const ContextState* prev_state) const; |
| 189 void RestoreProgramBindings() const; | 190 void RestoreProgramBindings() const; |
| 190 void RestoreRenderbufferBindings(); | 191 void RestoreRenderbufferBindings(); |
| 192 void RestoreTransformFeedbackBindings(const ContextState* prev_state); |
| 191 void RestoreTextureUnitBindings( | 193 void RestoreTextureUnitBindings( |
| 192 GLuint unit, const ContextState* prev_state) const; | 194 GLuint unit, const ContextState* prev_state) const; |
| 193 | 195 |
| 194 // Helper for getting cached state. | 196 // Helper for getting cached state. |
| 195 bool GetStateAsGLint( | 197 bool GetStateAsGLint( |
| 196 GLenum pname, GLint* params, GLsizei* num_written) const; | 198 GLenum pname, GLint* params, GLsizei* num_written) const; |
| 197 bool GetStateAsGLfloat( | 199 bool GetStateAsGLfloat( |
| 198 GLenum pname, GLfloat* params, GLsizei* num_written) const; | 200 GLenum pname, GLfloat* params, GLsizei* num_written) const; |
| 199 bool GetEnabled(GLenum cap) const; | 201 bool GetEnabled(GLenum cap) const; |
| 200 | 202 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 scoped_refptr<Buffer> bound_pixel_unpack_buffer; | 268 scoped_refptr<Buffer> bound_pixel_unpack_buffer; |
| 267 scoped_refptr<Buffer> bound_transform_feedback_buffer; | 269 scoped_refptr<Buffer> bound_transform_feedback_buffer; |
| 268 scoped_refptr<Buffer> bound_uniform_buffer; | 270 scoped_refptr<Buffer> bound_uniform_buffer; |
| 269 | 271 |
| 270 // Which textures are bound to texture units through glActiveTexture. | 272 // Which textures are bound to texture units through glActiveTexture. |
| 271 std::vector<TextureUnit> texture_units; | 273 std::vector<TextureUnit> texture_units; |
| 272 | 274 |
| 273 // Which samplers are bound to each texture unit; | 275 // Which samplers are bound to each texture unit; |
| 274 std::vector<scoped_refptr<Sampler>> sampler_units; | 276 std::vector<scoped_refptr<Sampler>> sampler_units; |
| 275 | 277 |
| 278 // We create a transform feedback as the default one per ES3 enabled context |
| 279 // instead of using GL's default one to make context switching easier. |
| 280 // For other context, we will never change the default transform feedback's |
| 281 // states, so we can just use the GL's default one. |
| 282 scoped_refptr<TransformFeedback> default_transform_feedback; |
| 283 |
| 284 scoped_refptr<TransformFeedback> bound_transform_feedback; |
| 285 |
| 276 // The values for each attrib. | 286 // The values for each attrib. |
| 277 std::vector<Vec4> attrib_values; | 287 std::vector<Vec4> attrib_values; |
| 278 | 288 |
| 279 // Class that manages vertex attribs. | 289 // Class that manages vertex attribs. |
| 280 scoped_refptr<VertexAttribManager> vertex_attrib_manager; | 290 scoped_refptr<VertexAttribManager> vertex_attrib_manager; |
| 281 scoped_refptr<VertexAttribManager> default_vertex_attrib_manager; | 291 scoped_refptr<VertexAttribManager> default_vertex_attrib_manager; |
| 282 | 292 |
| 283 // The program in use by glUseProgram | 293 // The program in use by glUseProgram |
| 284 scoped_refptr<Program> current_program; | 294 scoped_refptr<Program> current_program; |
| 285 | 295 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 306 | 316 |
| 307 FeatureInfo* feature_info_; | 317 FeatureInfo* feature_info_; |
| 308 std::unique_ptr<ErrorState> error_state_; | 318 std::unique_ptr<ErrorState> error_state_; |
| 309 }; | 319 }; |
| 310 | 320 |
| 311 } // namespace gles2 | 321 } // namespace gles2 |
| 312 } // namespace gpu | 322 } // namespace gpu |
| 313 | 323 |
| 314 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 324 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
| 315 | 325 |
| OLD | NEW |