| 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 #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 <algorithm> | 8 #include <algorithm> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 GLenum format; | 242 GLenum format; |
| 243 GLenum type; | 243 GLenum type; |
| 244 scoped_refptr<gfx::GLImage> image; | 244 scoped_refptr<gfx::GLImage> image; |
| 245 uint32 estimated_size; | 245 uint32 estimated_size; |
| 246 }; | 246 }; |
| 247 | 247 |
| 248 struct FaceInfo { | 248 struct FaceInfo { |
| 249 FaceInfo(); | 249 FaceInfo(); |
| 250 ~FaceInfo(); | 250 ~FaceInfo(); |
| 251 | 251 |
| 252 // This is relative to base_level and max_level of a texture. |
| 252 GLsizei num_mip_levels; | 253 GLsizei num_mip_levels; |
| 254 // This contains slots for all levels starting at 0. |
| 253 std::vector<LevelInfo> level_infos; | 255 std::vector<LevelInfo> level_infos; |
| 254 }; | 256 }; |
| 255 | 257 |
| 256 // Set the info for a particular level. | 258 // Set the info for a particular level. |
| 257 void SetLevelInfo(const FeatureInfo* feature_info, | 259 void SetLevelInfo(const FeatureInfo* feature_info, |
| 258 GLenum target, | 260 GLenum target, |
| 259 GLint level, | 261 GLint level, |
| 260 GLenum internal_format, | 262 GLenum internal_format, |
| 261 GLsizei width, | 263 GLsizei width, |
| 262 GLsizei height, | 264 GLsizei height, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 static bool TextureFaceComplete(const Texture::LevelInfo& first_face, | 334 static bool TextureFaceComplete(const Texture::LevelInfo& first_face, |
| 333 size_t face_index, | 335 size_t face_index, |
| 334 GLenum target, | 336 GLenum target, |
| 335 GLenum internal_format, | 337 GLenum internal_format, |
| 336 GLsizei width, | 338 GLsizei width, |
| 337 GLsizei height, | 339 GLsizei height, |
| 338 GLsizei depth, | 340 GLsizei depth, |
| 339 GLenum format, | 341 GLenum format, |
| 340 GLenum type); | 342 GLenum type); |
| 341 | 343 |
| 342 // Returns true if texture mip level is complete relative to first level. | 344 // Returns true if texture mip level is complete relative to base level. |
| 343 static bool TextureMipComplete(const Texture::LevelInfo& level0_face, | 345 // Note that level_diff = level - base_level. |
| 346 static bool TextureMipComplete(const Texture::LevelInfo& base_level_face, |
| 344 GLenum target, | 347 GLenum target, |
| 345 GLint level, | 348 GLint level_diff, |
| 346 GLenum internal_format, | 349 GLenum internal_format, |
| 347 GLsizei width, | 350 GLsizei width, |
| 348 GLsizei height, | 351 GLsizei height, |
| 349 GLsizei depth, | 352 GLsizei depth, |
| 350 GLenum format, | 353 GLenum format, |
| 351 GLenum type); | 354 GLenum type); |
| 352 | 355 |
| 353 // Sets the Texture's target | 356 // Sets the Texture's target |
| 354 // Parameters: | 357 // Parameters: |
| 355 // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP or | 358 // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP or |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 void UpdateCanRenderCondition(); | 398 void UpdateCanRenderCondition(); |
| 396 | 399 |
| 397 // Updates the images count in all the managers referencing this | 400 // Updates the images count in all the managers referencing this |
| 398 // texture. | 401 // texture. |
| 399 void UpdateHasImages(); | 402 void UpdateHasImages(); |
| 400 | 403 |
| 401 // Increment the framebuffer state change count in all the managers | 404 // Increment the framebuffer state change count in all the managers |
| 402 // referencing this texture. | 405 // referencing this texture. |
| 403 void IncAllFramebufferStateChangeCount(); | 406 void IncAllFramebufferStateChangeCount(); |
| 404 | 407 |
| 408 void UpdateBaseLevel(GLint base_level); |
| 409 void UpdateMaxLevel(GLint max_level); |
| 410 void UpdateNumMipLevels(); |
| 411 |
| 405 MailboxManager* mailbox_manager_; | 412 MailboxManager* mailbox_manager_; |
| 406 | 413 |
| 407 // Info about each face and level of texture. | 414 // Info about each face and level of texture. |
| 408 std::vector<FaceInfo> face_infos_; | 415 std::vector<FaceInfo> face_infos_; |
| 409 | 416 |
| 410 // The texture refs that point to this Texture. | 417 // The texture refs that point to this Texture. |
| 411 typedef std::set<TextureRef*> RefSet; | 418 typedef std::set<TextureRef*> RefSet; |
| 412 RefSet refs_; | 419 RefSet refs_; |
| 413 | 420 |
| 414 // The single TextureRef that accounts for memory for this texture. Must be | 421 // The single TextureRef that accounts for memory for this texture. Must be |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 private: | 965 private: |
| 959 DecoderTextureState* texture_state_; | 966 DecoderTextureState* texture_state_; |
| 960 base::TimeTicks begin_time_; | 967 base::TimeTicks begin_time_; |
| 961 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 968 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
| 962 }; | 969 }; |
| 963 | 970 |
| 964 } // namespace gles2 | 971 } // namespace gles2 |
| 965 } // namespace gpu | 972 } // namespace gpu |
| 966 | 973 |
| 967 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 974 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| OLD | NEW |