| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 target_(0), | 35 target_(0), |
| 36 min_filter_(GL_NEAREST_MIPMAP_LINEAR), | 36 min_filter_(GL_NEAREST_MIPMAP_LINEAR), |
| 37 mag_filter_(GL_LINEAR), | 37 mag_filter_(GL_LINEAR), |
| 38 wrap_s_(GL_REPEAT), | 38 wrap_s_(GL_REPEAT), |
| 39 wrap_t_(GL_REPEAT), | 39 wrap_t_(GL_REPEAT), |
| 40 max_level_set_(-1), | 40 max_level_set_(-1), |
| 41 texture_complete_(false), | 41 texture_complete_(false), |
| 42 cube_complete_(false), | 42 cube_complete_(false), |
| 43 npot_(false), | 43 npot_(false), |
| 44 has_been_bound_(false), | 44 has_been_bound_(false), |
| 45 framebuffer_attachment_count_(0), | |
| 46 owned_(true) { | 45 owned_(true) { |
| 47 } | 46 } |
| 48 | 47 |
| 49 GLenum min_filter() const { | 48 GLenum min_filter() const { |
| 50 return min_filter_; | 49 return min_filter_; |
| 51 } | 50 } |
| 52 | 51 |
| 53 GLenum mag_filter() const { | 52 GLenum mag_filter() const { |
| 54 return mag_filter_; | 53 return mag_filter_; |
| 55 } | 54 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 GLenum type) const; | 124 GLenum type) const; |
| 126 | 125 |
| 127 bool IsValid() const { | 126 bool IsValid() const { |
| 128 return target() && !IsDeleted(); | 127 return target() && !IsDeleted(); |
| 129 } | 128 } |
| 130 | 129 |
| 131 void SetNotOwned() { | 130 void SetNotOwned() { |
| 132 owned_ = false; | 131 owned_ = false; |
| 133 } | 132 } |
| 134 | 133 |
| 135 bool IsAttachedToFramebuffer() const { | |
| 136 return framebuffer_attachment_count_ != 0; | |
| 137 } | |
| 138 | |
| 139 void AttachToFramebuffer() { | |
| 140 ++framebuffer_attachment_count_; | |
| 141 } | |
| 142 | |
| 143 void DetachFromFramebuffer() { | |
| 144 DCHECK(framebuffer_attachment_count_ > 0); | |
| 145 --framebuffer_attachment_count_; | |
| 146 } | |
| 147 | |
| 148 private: | 134 private: |
| 149 friend class TextureManager; | 135 friend class TextureManager; |
| 150 friend class base::RefCounted<TextureInfo>; | 136 friend class base::RefCounted<TextureInfo>; |
| 151 | 137 |
| 152 ~TextureInfo() { } | 138 ~TextureInfo() { } |
| 153 | 139 |
| 154 struct LevelInfo { | 140 struct LevelInfo { |
| 155 LevelInfo() | 141 LevelInfo() |
| 156 : valid(false), | 142 : valid(false), |
| 157 internal_format(0), | 143 internal_format(0), |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 233 |
| 248 // Whether or not this texture is "cube complete" | 234 // Whether or not this texture is "cube complete" |
| 249 bool cube_complete_; | 235 bool cube_complete_; |
| 250 | 236 |
| 251 // Whether or not this texture is non-power-of-two | 237 // Whether or not this texture is non-power-of-two |
| 252 bool npot_; | 238 bool npot_; |
| 253 | 239 |
| 254 // Whether this texture has ever been bound. | 240 // Whether this texture has ever been bound. |
| 255 bool has_been_bound_; | 241 bool has_been_bound_; |
| 256 | 242 |
| 257 // The number of framebuffers this texture is attached to. | |
| 258 int framebuffer_attachment_count_; | |
| 259 | |
| 260 // Whether the associated context group owns this texture and should delete | 243 // Whether the associated context group owns this texture and should delete |
| 261 // it. | 244 // it. |
| 262 bool owned_; | 245 bool owned_; |
| 263 | 246 |
| 264 DISALLOW_COPY_AND_ASSIGN(TextureInfo); | 247 DISALLOW_COPY_AND_ASSIGN(TextureInfo); |
| 265 }; | 248 }; |
| 266 | 249 |
| 267 TextureManager(GLsizei max_texture_size, | 250 TextureManager(GLsizei max_texture_size, |
| 268 GLsizei max_cube_map_texture_size); | 251 GLsizei max_cube_map_texture_size); |
| 269 ~TextureManager(); | 252 ~TextureManager(); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 TextureInfo::Ref default_texture_2d_; | 358 TextureInfo::Ref default_texture_2d_; |
| 376 TextureInfo::Ref default_texture_cube_map_; | 359 TextureInfo::Ref default_texture_cube_map_; |
| 377 | 360 |
| 378 DISALLOW_COPY_AND_ASSIGN(TextureManager); | 361 DISALLOW_COPY_AND_ASSIGN(TextureManager); |
| 379 }; | 362 }; |
| 380 | 363 |
| 381 } // namespace gles2 | 364 } // namespace gles2 |
| 382 } // namespace gpu | 365 } // namespace gpu |
| 383 | 366 |
| 384 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 367 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| OLD | NEW |