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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 void InitCapabilities(const ContextState* prev_state) const; | 210 void InitCapabilities(const ContextState* prev_state) const; |
211 void InitState(const ContextState* prev_state) const; | 211 void InitState(const ContextState* prev_state) const; |
212 | 212 |
213 void RestoreActiveTexture() const; | 213 void RestoreActiveTexture() const; |
214 void RestoreAllTextureUnitBindings(const ContextState* prev_state) const; | 214 void RestoreAllTextureUnitBindings(const ContextState* prev_state) const; |
215 void RestoreActiveTextureUnitBinding(unsigned int target) const; | 215 void RestoreActiveTextureUnitBinding(unsigned int target) const; |
216 void RestoreVertexAttribValues() const; | 216 void RestoreVertexAttribValues() const; |
217 void RestoreVertexAttribArrays( | 217 void RestoreVertexAttribArrays( |
218 const scoped_refptr<VertexAttribManager> attrib_manager) const; | 218 const scoped_refptr<VertexAttribManager> attrib_manager) const; |
219 void RestoreVertexAttribs() const; | 219 void RestoreVertexAttribs() const; |
220 void RestoreBufferBinding(unsigned int target) const; | |
221 void RestoreBufferBindings() const; | 220 void RestoreBufferBindings() const; |
222 void RestoreGlobalState(const ContextState* prev_state) const; | 221 void RestoreGlobalState(const ContextState* prev_state) const; |
223 void RestoreProgramSettings(const ContextState* prev_state, | 222 void RestoreProgramSettings(const ContextState* prev_state, |
224 bool restore_transform_feedback_bindings) const; | 223 bool restore_transform_feedback_bindings) const; |
225 void RestoreRenderbufferBindings(); | 224 void RestoreRenderbufferBindings(); |
226 void RestoreIndexedUniformBufferBindings(const ContextState* prev_state); | 225 void RestoreIndexedUniformBufferBindings(const ContextState* prev_state); |
227 void RestoreTextureUnitBindings( | 226 void RestoreTextureUnitBindings( |
228 GLuint unit, const ContextState* prev_state) const; | 227 GLuint unit, const ContextState* prev_state) const; |
229 | 228 |
230 void PushTextureDecompressionUnpackState() const; | 229 void PushTextureDecompressionUnpackState() const; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 const std::vector<uint32_t>& generic_attrib_base_type_mask() const { | 302 const std::vector<uint32_t>& generic_attrib_base_type_mask() const { |
304 return generic_attrib_base_type_mask_; | 303 return generic_attrib_base_type_mask_; |
305 } | 304 } |
306 | 305 |
307 void UnbindTexture(TextureRef* texture); | 306 void UnbindTexture(TextureRef* texture); |
308 void UnbindSampler(Sampler* sampler); | 307 void UnbindSampler(Sampler* sampler); |
309 | 308 |
310 PixelStoreParams GetPackParams(); | 309 PixelStoreParams GetPackParams(); |
311 PixelStoreParams GetUnpackParams(Dimension dimension); | 310 PixelStoreParams GetUnpackParams(Dimension dimension); |
312 | 311 |
| 312 // If a buffer object is bound to PIXEL_PACK_BUFFER, set all pack parameters |
| 313 // user values; otherwise, set them to 0. |
| 314 void UpdatePackParameters() const; |
| 315 // If a buffer object is bound to PIXEL_UNPACK_BUFFER, set all unpack |
| 316 // parameters user values; otherwise, set them to 0. |
| 317 void UpdateUnpackParameters() const; |
| 318 |
313 void EnableDisableFramebufferSRGB(bool enable); | 319 void EnableDisableFramebufferSRGB(bool enable); |
314 | 320 |
315 #include "gpu/command_buffer/service/context_state_autogen.h" | 321 #include "gpu/command_buffer/service/context_state_autogen.h" |
316 | 322 |
317 EnableFlags enable_flags; | 323 EnableFlags enable_flags; |
318 | 324 |
319 // Current active texture by 0 - n index. | 325 // Current active texture by 0 - n index. |
320 // In other words, if we call glActiveTexture(GL_TEXTURE2) this value would | 326 // In other words, if we call glActiveTexture(GL_TEXTURE2) this value would |
321 // be 2. | 327 // be 2. |
322 GLuint active_texture_unit; | 328 GLuint active_texture_unit; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 bool bound_renderbuffer_valid; | 369 bool bound_renderbuffer_valid; |
364 | 370 |
365 bool pack_reverse_row_order; | 371 bool pack_reverse_row_order; |
366 bool ignore_cached_state; | 372 bool ignore_cached_state; |
367 | 373 |
368 mutable bool fbo_binding_for_scissor_workaround_dirty; | 374 mutable bool fbo_binding_for_scissor_workaround_dirty; |
369 | 375 |
370 private: | 376 private: |
371 void EnableDisable(GLenum pname, bool enable) const; | 377 void EnableDisable(GLenum pname, bool enable) const; |
372 | 378 |
373 // If a buffer object is bound to PIXEL_PACK_BUFFER, set all pack parameters | |
374 // user values; otherwise, set them to 0. | |
375 void UpdatePackParameters() const; | |
376 // If a buffer object is bound to PIXEL_UNPACK_BUFFER, set all unpack | |
377 // parameters user values; otherwise, set them to 0. | |
378 void UpdateUnpackParameters() const; | |
379 | |
380 void InitStateManual(const ContextState* prev_state) const; | 379 void InitStateManual(const ContextState* prev_state) const; |
381 | 380 |
382 // EnableDisableFramebufferSRGB is called at very high frequency. Cache the | 381 // EnableDisableFramebufferSRGB is called at very high frequency. Cache the |
383 // true value of FRAMEBUFFER_SRGB, if we know it, to elide some of these | 382 // true value of FRAMEBUFFER_SRGB, if we know it, to elide some of these |
384 // calls. | 383 // calls. |
385 bool framebuffer_srgb_valid_ = false; | 384 bool framebuffer_srgb_valid_ = false; |
386 bool framebuffer_srgb_ = false; | 385 bool framebuffer_srgb_ = false; |
387 | 386 |
388 // Generic vertex attrib base types: FLOAT, INT, or UINT. | 387 // Generic vertex attrib base types: FLOAT, INT, or UINT. |
389 // Each base type is encoded into 2 bits, the lowest 2 bits for location 0, | 388 // Each base type is encoded into 2 bits, the lowest 2 bits for location 0, |
390 // the highest 2 bits for location (max_vertex_attribs - 1). | 389 // the highest 2 bits for location (max_vertex_attribs - 1). |
391 std::vector<uint32_t> generic_attrib_base_type_mask_; | 390 std::vector<uint32_t> generic_attrib_base_type_mask_; |
392 | 391 |
393 GLfloat line_width_min_ = 0.0f; | 392 GLfloat line_width_min_ = 0.0f; |
394 GLfloat line_width_max_ = 1.0f; | 393 GLfloat line_width_max_ = 1.0f; |
395 | 394 |
396 FeatureInfo* feature_info_; | 395 FeatureInfo* feature_info_; |
397 std::unique_ptr<ErrorState> error_state_; | 396 std::unique_ptr<ErrorState> error_state_; |
398 }; | 397 }; |
399 | 398 |
400 } // namespace gles2 | 399 } // namespace gles2 |
401 } // namespace gpu | 400 } // namespace gpu |
402 | 401 |
403 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ | 402 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ |
OLD | NEW |