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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 GLenum type; | 265 GLenum type; |
266 scoped_refptr<gl::GLImage> image; | 266 scoped_refptr<gl::GLImage> image; |
267 ImageState image_state; | 267 ImageState image_state; |
268 uint32 estimated_size; | 268 uint32 estimated_size; |
269 }; | 269 }; |
270 | 270 |
271 struct FaceInfo { | 271 struct FaceInfo { |
272 FaceInfo(); | 272 FaceInfo(); |
273 ~FaceInfo(); | 273 ~FaceInfo(); |
274 | 274 |
| 275 // This is relative to base_level and max_level of a texture. |
275 GLsizei num_mip_levels; | 276 GLsizei num_mip_levels; |
| 277 // This contains slots for all levels starting at 0. |
276 std::vector<LevelInfo> level_infos; | 278 std::vector<LevelInfo> level_infos; |
277 }; | 279 }; |
278 | 280 |
279 // Set the info for a particular level. | 281 // Set the info for a particular level. |
280 void SetLevelInfo(const FeatureInfo* feature_info, | 282 void SetLevelInfo(const FeatureInfo* feature_info, |
281 GLenum target, | 283 GLenum target, |
282 GLint level, | 284 GLint level, |
283 GLenum internal_format, | 285 GLenum internal_format, |
284 GLsizei width, | 286 GLsizei width, |
285 GLsizei height, | 287 GLsizei height, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 static bool TextureFaceComplete(const Texture::LevelInfo& first_face, | 357 static bool TextureFaceComplete(const Texture::LevelInfo& first_face, |
356 size_t face_index, | 358 size_t face_index, |
357 GLenum target, | 359 GLenum target, |
358 GLenum internal_format, | 360 GLenum internal_format, |
359 GLsizei width, | 361 GLsizei width, |
360 GLsizei height, | 362 GLsizei height, |
361 GLsizei depth, | 363 GLsizei depth, |
362 GLenum format, | 364 GLenum format, |
363 GLenum type); | 365 GLenum type); |
364 | 366 |
365 // Returns true if texture mip level is complete relative to first level. | 367 // Returns true if texture mip level is complete relative to base level. |
366 static bool TextureMipComplete(const Texture::LevelInfo& level0_face, | 368 // Note that level_diff = level - base_level. |
| 369 static bool TextureMipComplete(const Texture::LevelInfo& base_level_face, |
367 GLenum target, | 370 GLenum target, |
368 GLint level, | 371 GLint level_diff, |
369 GLenum internal_format, | 372 GLenum internal_format, |
370 GLsizei width, | 373 GLsizei width, |
371 GLsizei height, | 374 GLsizei height, |
372 GLsizei depth, | 375 GLsizei depth, |
373 GLenum format, | 376 GLenum format, |
374 GLenum type); | 377 GLenum type); |
375 | 378 |
376 // Sets the Texture's target | 379 // Sets the Texture's target |
377 // Parameters: | 380 // Parameters: |
378 // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP or | 381 // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP or |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 void UpdateCanRenderCondition(); | 414 void UpdateCanRenderCondition(); |
412 | 415 |
413 // Updates the images count in all the managers referencing this | 416 // Updates the images count in all the managers referencing this |
414 // texture. | 417 // texture. |
415 void UpdateHasImages(); | 418 void UpdateHasImages(); |
416 | 419 |
417 // Increment the framebuffer state change count in all the managers | 420 // Increment the framebuffer state change count in all the managers |
418 // referencing this texture. | 421 // referencing this texture. |
419 void IncAllFramebufferStateChangeCount(); | 422 void IncAllFramebufferStateChangeCount(); |
420 | 423 |
| 424 void UpdateBaseLevel(GLint base_level); |
| 425 void UpdateMaxLevel(GLint max_level); |
| 426 void UpdateNumMipLevels(); |
| 427 |
421 MailboxManager* mailbox_manager_; | 428 MailboxManager* mailbox_manager_; |
422 | 429 |
423 // Info about each face and level of texture. | 430 // Info about each face and level of texture. |
424 std::vector<FaceInfo> face_infos_; | 431 std::vector<FaceInfo> face_infos_; |
425 | 432 |
426 // The texture refs that point to this Texture. | 433 // The texture refs that point to this Texture. |
427 typedef std::set<TextureRef*> RefSet; | 434 typedef std::set<TextureRef*> RefSet; |
428 RefSet refs_; | 435 RefSet refs_; |
429 | 436 |
430 // The single TextureRef that accounts for memory for this texture. Must be | 437 // The single TextureRef that accounts for memory for this texture. Must be |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 private: | 1019 private: |
1013 DecoderTextureState* texture_state_; | 1020 DecoderTextureState* texture_state_; |
1014 base::TimeTicks begin_time_; | 1021 base::TimeTicks begin_time_; |
1015 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 1022 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
1016 }; | 1023 }; |
1017 | 1024 |
1018 } // namespace gles2 | 1025 } // namespace gles2 |
1019 } // namespace gpu | 1026 } // namespace gpu |
1020 | 1027 |
1021 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 1028 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
OLD | NEW |