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