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 <vector> | 10 #include <vector> |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "gpu/command_buffer/service/gl_utils.h" | 13 #include "gpu/command_buffer/service/gl_utils.h" |
14 #include "gpu/command_buffer/service/query_manager.h" | 14 #include "gpu/command_buffer/service/query_manager.h" |
15 #include "gpu/command_buffer/service/texture_manager.h" | 15 #include "gpu/command_buffer/service/texture_manager.h" |
16 #include "gpu/command_buffer/service/vertex_attrib_manager.h" | 16 #include "gpu/command_buffer/service/vertex_attrib_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/gpu_export.h" | 18 #include "gpu/gpu_export.h" |
19 | 19 |
| 20 namespace gfx { |
| 21 class DirtyTextureState; |
| 22 } |
| 23 |
20 namespace gpu { | 24 namespace gpu { |
21 namespace gles2 { | 25 namespace gles2 { |
22 | 26 |
23 class Buffer; | 27 class Buffer; |
24 class ErrorState; | 28 class ErrorState; |
25 class FeatureInfo; | 29 class FeatureInfo; |
26 class Framebuffer; | 30 class Framebuffer; |
27 class Program; | 31 class Program; |
28 class Renderbuffer; | 32 class Renderbuffer; |
29 | 33 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 95 } |
92 float v[4]; | 96 float v[4]; |
93 }; | 97 }; |
94 | 98 |
95 struct GPU_EXPORT ContextState { | 99 struct GPU_EXPORT ContextState { |
96 ContextState(FeatureInfo* feature_info, Logger* logger); | 100 ContextState(FeatureInfo* feature_info, Logger* logger); |
97 ~ContextState(); | 101 ~ContextState(); |
98 | 102 |
99 void Initialize(); | 103 void Initialize(); |
100 | 104 |
101 void RestoreState() const; | 105 void RestoreState(const gfx::DirtyTextureState* dirty_texture_state) const; |
102 void InitCapabilities() const; | 106 void InitCapabilities() const; |
103 void InitState() const; | 107 void InitState() const; |
104 | 108 |
105 void RestoreActiveTexture() const; | 109 void RestoreActiveTexture() const; |
106 void RestoreAllTextureUnitBindings() const; | 110 void RestoreAllTextureUnitBindings( |
| 111 const gfx::DirtyTextureState* dirty_texture_state) const; |
107 void RestoreAttribute(GLuint index) const; | 112 void RestoreAttribute(GLuint index) const; |
108 void RestoreBufferBindings() const; | 113 void RestoreBufferBindings() const; |
109 void RestoreGlobalState() const; | 114 void RestoreGlobalState() const; |
110 void RestoreProgramBindings() const; | 115 void RestoreProgramBindings() const; |
111 void RestoreRenderbufferBindings() const; | 116 void RestoreRenderbufferBindings() const; |
112 void RestoreTextureUnitBindings(GLuint unit) const; | 117 void RestoreTextureUnitBindings( |
| 118 GLuint unit, const gfx::DirtyTextureState* dirty_texture_state) const; |
113 | 119 |
114 // Helper for getting cached state. | 120 // Helper for getting cached state. |
115 bool GetStateAsGLint( | 121 bool GetStateAsGLint( |
116 GLenum pname, GLint* params, GLsizei* num_written) const; | 122 GLenum pname, GLint* params, GLsizei* num_written) const; |
117 bool GetStateAsGLfloat( | 123 bool GetStateAsGLfloat( |
118 GLenum pname, GLfloat* params, GLsizei* num_written) const; | 124 GLenum pname, GLfloat* params, GLsizei* num_written) const; |
119 bool GetEnabled(GLenum cap) const; | 125 bool GetEnabled(GLenum cap) const; |
120 | 126 |
121 ErrorState* GetErrorState(); | 127 ErrorState* GetErrorState(); |
122 | 128 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 163 |
158 private: | 164 private: |
159 scoped_ptr<ErrorState> error_state_; | 165 scoped_ptr<ErrorState> error_state_; |
160 }; | 166 }; |
161 | 167 |
162 } // namespace gles2 | 168 } // namespace gles2 |
163 } // namespace gpu | 169 } // namespace gpu |
164 | 170 |
165 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 171 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
166 | 172 |
OLD | NEW |