| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "gpu/command_buffer/service/gl_utils.h" | 14 #include "gpu/command_buffer/service/gl_utils.h" |
| 15 #include "gpu/command_buffer/service/sampler_manager.h" | 15 #include "gpu/command_buffer/service/sampler_manager.h" |
| 16 #include "gpu/command_buffer/service/texture_manager.h" | 16 #include "gpu/command_buffer/service/texture_manager.h" |
| 17 #include "gpu/command_buffer/service/vertex_array_manager.h" | 17 #include "gpu/command_buffer/service/vertex_array_manager.h" |
| 18 #include "gpu/command_buffer/service/vertex_attrib_manager.h" | 18 #include "gpu/command_buffer/service/vertex_attrib_manager.h" |
| 19 #include "gpu/gpu_export.h" | 19 #include "gpu/gpu_export.h" |
| 20 | 20 |
| 21 namespace gpu { | 21 namespace gpu { |
| 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 IndexedBufferBindingHost; |
| 29 class Logger; | 30 class Logger; |
| 30 class Program; | 31 class Program; |
| 31 class Renderbuffer; | 32 class Renderbuffer; |
| 32 class TransformFeedback; | 33 class TransformFeedback; |
| 33 | 34 |
| 34 // State associated with each texture unit. | 35 // State associated with each texture unit. |
| 35 struct GPU_EXPORT TextureUnit { | 36 struct GPU_EXPORT TextureUnit { |
| 36 TextureUnit(); | 37 TextureUnit(); |
| 37 TextureUnit(const TextureUnit& other); | 38 TextureUnit(const TextureUnit& other); |
| 38 ~TextureUnit(); | 39 ~TextureUnit(); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 void RestoreActiveTextureUnitBinding(unsigned int target) const; | 184 void RestoreActiveTextureUnitBinding(unsigned int target) const; |
| 184 void RestoreVertexAttribValues() const; | 185 void RestoreVertexAttribValues() const; |
| 185 void RestoreVertexAttribArrays( | 186 void RestoreVertexAttribArrays( |
| 186 const scoped_refptr<VertexAttribManager> attrib_manager) const; | 187 const scoped_refptr<VertexAttribManager> attrib_manager) const; |
| 187 void RestoreVertexAttribs() const; | 188 void RestoreVertexAttribs() const; |
| 188 void RestoreBufferBindings() const; | 189 void RestoreBufferBindings() const; |
| 189 void RestoreGlobalState(const ContextState* prev_state) const; | 190 void RestoreGlobalState(const ContextState* prev_state) const; |
| 190 void RestoreProgramBindings() const; | 191 void RestoreProgramBindings() const; |
| 191 void RestoreRenderbufferBindings(); | 192 void RestoreRenderbufferBindings(); |
| 192 void RestoreTransformFeedbackBindings(const ContextState* prev_state); | 193 void RestoreTransformFeedbackBindings(const ContextState* prev_state); |
| 194 void RestoreIndexedUniformBufferBindings(const ContextState* prev_state); |
| 193 void RestoreTextureUnitBindings( | 195 void RestoreTextureUnitBindings( |
| 194 GLuint unit, const ContextState* prev_state) const; | 196 GLuint unit, const ContextState* prev_state) const; |
| 195 | 197 |
| 196 // Helper for getting cached state. | 198 // Helper for getting cached state. |
| 197 bool GetStateAsGLint( | 199 bool GetStateAsGLint( |
| 198 GLenum pname, GLint* params, GLsizei* num_written) const; | 200 GLenum pname, GLint* params, GLsizei* num_written) const; |
| 199 bool GetStateAsGLfloat( | 201 bool GetStateAsGLfloat( |
| 200 GLenum pname, GLfloat* params, GLsizei* num_written) const; | 202 GLenum pname, GLfloat* params, GLsizei* num_written) const; |
| 201 bool GetEnabled(GLenum cap) const; | 203 bool GetEnabled(GLenum cap) const; |
| 202 | 204 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 std::vector<scoped_refptr<Sampler>> sampler_units; | 278 std::vector<scoped_refptr<Sampler>> sampler_units; |
| 277 | 279 |
| 278 // We create a transform feedback as the default one per ES3 enabled context | 280 // 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. | 281 // 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 | 282 // For other context, we will never change the default transform feedback's |
| 281 // states, so we can just use the GL's default one. | 283 // states, so we can just use the GL's default one. |
| 282 scoped_refptr<TransformFeedback> default_transform_feedback; | 284 scoped_refptr<TransformFeedback> default_transform_feedback; |
| 283 | 285 |
| 284 scoped_refptr<TransformFeedback> bound_transform_feedback; | 286 scoped_refptr<TransformFeedback> bound_transform_feedback; |
| 285 | 287 |
| 288 scoped_refptr<IndexedBufferBindingHost> indexed_uniform_buffer_bindings; |
| 289 |
| 286 // The values for each attrib. | 290 // The values for each attrib. |
| 287 std::vector<Vec4> attrib_values; | 291 std::vector<Vec4> attrib_values; |
| 288 | 292 |
| 289 // Class that manages vertex attribs. | 293 // Class that manages vertex attribs. |
| 290 scoped_refptr<VertexAttribManager> vertex_attrib_manager; | 294 scoped_refptr<VertexAttribManager> vertex_attrib_manager; |
| 291 scoped_refptr<VertexAttribManager> default_vertex_attrib_manager; | 295 scoped_refptr<VertexAttribManager> default_vertex_attrib_manager; |
| 292 | 296 |
| 293 // The program in use by glUseProgram | 297 // The program in use by glUseProgram |
| 294 scoped_refptr<Program> current_program; | 298 scoped_refptr<Program> current_program; |
| 295 | 299 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 316 | 320 |
| 317 FeatureInfo* feature_info_; | 321 FeatureInfo* feature_info_; |
| 318 std::unique_ptr<ErrorState> error_state_; | 322 std::unique_ptr<ErrorState> error_state_; |
| 319 }; | 323 }; |
| 320 | 324 |
| 321 } // namespace gles2 | 325 } // namespace gles2 |
| 322 } // namespace gpu | 326 } // namespace gpu |
| 323 | 327 |
| 324 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 328 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
| 325 | 329 |
| OLD | NEW |