Chromium Code Reviews| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 k3D | 159 k3D |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 ContextState(FeatureInfo* feature_info, | 162 ContextState(FeatureInfo* feature_info, |
| 163 ErrorStateClient* error_state_client, | 163 ErrorStateClient* error_state_client, |
| 164 Logger* logger); | 164 Logger* logger); |
| 165 ~ContextState(); | 165 ~ContextState(); |
| 166 | 166 |
| 167 void Initialize(); | 167 void Initialize(); |
| 168 | 168 |
| 169 void InitLineWidth(GLfloat min, GLfloat max); | |
|
piman
2016/11/07 22:34:40
nit: maybe SetLineWidthBounds ?
Lof
2016/11/08 20:11:58
Done.
| |
| 170 | |
| 169 void SetIgnoreCachedStateForTest(bool ignore) { | 171 void SetIgnoreCachedStateForTest(bool ignore) { |
| 170 ignore_cached_state = ignore; | 172 ignore_cached_state = ignore; |
| 171 } | 173 } |
| 172 | 174 |
| 173 void RestoreState(const ContextState* prev_state); | 175 void RestoreState(const ContextState* prev_state); |
| 174 void InitCapabilities(const ContextState* prev_state) const; | 176 void InitCapabilities(const ContextState* prev_state) const; |
| 175 void InitState(const ContextState* prev_state) const; | 177 void InitState(const ContextState* prev_state) const; |
| 176 | 178 |
| 177 void RestoreActiveTexture() const; | 179 void RestoreActiveTexture() const; |
| 178 void RestoreAllTextureUnitBindings(const ContextState* prev_state) const; | 180 void RestoreAllTextureUnitBindings(const ContextState* prev_state) const; |
| 179 void RestoreActiveTextureUnitBinding(unsigned int target) const; | 181 void RestoreActiveTextureUnitBinding(unsigned int target) const; |
| 180 void RestoreVertexAttribValues() const; | 182 void RestoreVertexAttribValues() const; |
| 181 void RestoreVertexAttribArrays( | 183 void RestoreVertexAttribArrays( |
| 182 const scoped_refptr<VertexAttribManager> attrib_manager) const; | 184 const scoped_refptr<VertexAttribManager> attrib_manager) const; |
| 183 void RestoreVertexAttribs() const; | 185 void RestoreVertexAttribs() const; |
| 184 void RestoreBufferBindings() const; | 186 void RestoreBufferBindings() const; |
| 185 void RestoreGlobalState(const ContextState* prev_state) const; | 187 void RestoreGlobalState(const ContextState* prev_state) const; |
| 186 void RestoreProgramSettings(const ContextState* prev_state, | 188 void RestoreProgramSettings(const ContextState* prev_state, |
| 187 bool restore_transform_feedback_bindings) const; | 189 bool restore_transform_feedback_bindings) const; |
| 188 void RestoreRenderbufferBindings(); | 190 void RestoreRenderbufferBindings(); |
| 189 void RestoreIndexedUniformBufferBindings(const ContextState* prev_state); | 191 void RestoreIndexedUniformBufferBindings(const ContextState* prev_state); |
| 190 void RestoreTextureUnitBindings( | 192 void RestoreTextureUnitBindings( |
| 191 GLuint unit, const ContextState* prev_state) const; | 193 GLuint unit, const ContextState* prev_state) const; |
| 192 | 194 |
| 193 void PushTextureDecompressionUnpackState() const; | 195 void PushTextureDecompressionUnpackState() const; |
| 194 void RestoreUnpackState() const; | 196 void RestoreUnpackState() const; |
| 197 void DoLineWidth(GLfloat width) const; | |
| 195 | 198 |
| 196 // Helper for getting cached state. | 199 // Helper for getting cached state. |
| 197 bool GetStateAsGLint( | 200 bool GetStateAsGLint( |
| 198 GLenum pname, GLint* params, GLsizei* num_written) const; | 201 GLenum pname, GLint* params, GLsizei* num_written) const; |
| 199 bool GetStateAsGLfloat( | 202 bool GetStateAsGLfloat( |
| 200 GLenum pname, GLfloat* params, GLsizei* num_written) const; | 203 GLenum pname, GLfloat* params, GLsizei* num_written) const; |
| 201 bool GetEnabled(GLenum cap) const; | 204 bool GetEnabled(GLenum cap) const; |
| 202 | 205 |
| 203 inline void SetDeviceColorMask(GLboolean red, | 206 inline void SetDeviceColorMask(GLboolean red, |
| 204 GLboolean green, | 207 GLboolean green, |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 341 | 344 |
| 342 void InitStateManual(const ContextState* prev_state) const; | 345 void InitStateManual(const ContextState* prev_state) const; |
| 343 | 346 |
| 344 bool framebuffer_srgb_; | 347 bool framebuffer_srgb_; |
| 345 | 348 |
| 346 // Generic vertex attrib base types: FLOAT, INT, or UINT. | 349 // Generic vertex attrib base types: FLOAT, INT, or UINT. |
| 347 // Each base type is encoded into 2 bits, the lowest 2 bits for location 0, | 350 // Each base type is encoded into 2 bits, the lowest 2 bits for location 0, |
| 348 // the highest 2 bits for location (max_vertex_attribs - 1). | 351 // the highest 2 bits for location (max_vertex_attribs - 1). |
| 349 std::vector<uint32_t> generic_attrib_base_type_mask_; | 352 std::vector<uint32_t> generic_attrib_base_type_mask_; |
| 350 | 353 |
| 354 GLfloat line_width_min_ = 0.0f; | |
| 355 GLfloat line_width_max_ = 1.0f; | |
| 356 | |
| 351 FeatureInfo* feature_info_; | 357 FeatureInfo* feature_info_; |
| 352 std::unique_ptr<ErrorState> error_state_; | 358 std::unique_ptr<ErrorState> error_state_; |
| 353 }; | 359 }; |
| 354 | 360 |
| 355 } // namespace gles2 | 361 } // namespace gles2 |
| 356 } // namespace gpu | 362 } // namespace gpu |
| 357 | 363 |
| 358 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 364 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
| 359 | 365 |
| OLD | NEW |