OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_GL_DIRTY_TEXTURE_STATE_H_ |
| 6 #define UI_GL_DIRTY_TEXTURE_STATE_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "ui/gl/gl_bindings.h" |
| 12 #include "ui/gl/gl_export.h" |
| 13 |
| 14 namespace gfx { |
| 15 |
| 16 struct DirtyTextureBindings { |
| 17 bool binding_2d; |
| 18 bool binding_cube_map; |
| 19 bool binding_external_oes; |
| 20 bool binding_rectangle_arb; |
| 21 DirtyTextureBindings() : binding_2d(false), |
| 22 binding_cube_map(false), |
| 23 binding_external_oes(false), |
| 24 binding_rectangle_arb(false) { |
| 25 } |
| 26 }; |
| 27 |
| 28 class DirtyTextureState { |
| 29 public: |
| 30 DirtyTextureState(); |
| 31 ~DirtyTextureState(); |
| 32 |
| 33 void UpdateMaxTextureUnit(GLenum texture_unit); |
| 34 void AddBinding(GLuint current_unit, GLenum target); |
| 35 void Clear(); |
| 36 int GetMaxTextureUnitIndex() const { return max_texture_unit_ - GL_TEXTURE0; } |
| 37 bool IsBinding2DDirtyForUnit(GLuint unit) const { |
| 38 return bindings_[unit].binding_2d; |
| 39 } |
| 40 bool IsBindingCubeMapDirtyForUnit(GLuint unit) const { |
| 41 return bindings_[unit].binding_cube_map; |
| 42 } |
| 43 bool IsBindingExternalOesDirtyForUnit(GLuint unit) const { |
| 44 return bindings_[unit].binding_external_oes; |
| 45 } |
| 46 bool IsBindingRectangleArbDirtyForUnit(GLuint unit) const { |
| 47 return bindings_[unit].binding_rectangle_arb; |
| 48 } |
| 49 |
| 50 private: |
| 51 std::vector<DirtyTextureBindings> bindings_; |
| 52 GLenum max_texture_unit_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(DirtyTextureState); |
| 55 }; |
| 56 |
| 57 } // namespace gfx |
| 58 |
| 59 #endif // UI_GL_DIRTY_TEXTURE_STATE_H_ |
OLD | NEW |