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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 kCubeMap, | 523 kCubeMap, |
524 kExternalOES, | 524 kExternalOES, |
525 kRectangleARB, | 525 kRectangleARB, |
526 kNumDefaultTextures | 526 kNumDefaultTextures |
527 }; | 527 }; |
528 | 528 |
529 TextureManager(MemoryTracker* memory_tracker, | 529 TextureManager(MemoryTracker* memory_tracker, |
530 FeatureInfo* feature_info, | 530 FeatureInfo* feature_info, |
531 GLsizei max_texture_size, | 531 GLsizei max_texture_size, |
532 GLsizei max_cube_map_texture_size, | 532 GLsizei max_cube_map_texture_size, |
| 533 GLsizei max_rectangle_texture_size, |
533 bool use_default_textures); | 534 bool use_default_textures); |
534 ~TextureManager(); | 535 ~TextureManager(); |
535 | 536 |
536 void set_framebuffer_manager(FramebufferManager* manager) { | 537 void set_framebuffer_manager(FramebufferManager* manager) { |
537 framebuffer_manager_ = manager; | 538 framebuffer_manager_ = manager; |
538 } | 539 } |
539 | 540 |
540 // Init the texture manager. | 541 // Init the texture manager. |
541 bool Initialize(); | 542 bool Initialize(); |
542 | 543 |
(...skipping 11 matching lines...) Expand all Loading... |
554 return max_cube_map_levels_; | 555 return max_cube_map_levels_; |
555 } | 556 } |
556 } | 557 } |
557 | 558 |
558 // Returns the maximum size. | 559 // Returns the maximum size. |
559 GLsizei MaxSizeForTarget(GLenum target) const { | 560 GLsizei MaxSizeForTarget(GLenum target) const { |
560 switch (target) { | 561 switch (target) { |
561 case GL_TEXTURE_2D: | 562 case GL_TEXTURE_2D: |
562 case GL_TEXTURE_EXTERNAL_OES: | 563 case GL_TEXTURE_EXTERNAL_OES: |
563 return max_texture_size_; | 564 return max_texture_size_; |
| 565 case GL_TEXTURE_RECTANGLE: |
| 566 return max_rectangle_texture_size_; |
564 default: | 567 default: |
565 return max_cube_map_texture_size_; | 568 return max_cube_map_texture_size_; |
566 } | 569 } |
567 } | 570 } |
568 | 571 |
569 // Returns the maxium number of levels a texture of the given size can have. | 572 // Returns the maxium number of levels a texture of the given size can have. |
570 static GLsizei ComputeMipMapCount(GLenum target, | 573 static GLsizei ComputeMipMapCount(GLenum target, |
571 GLsizei width, | 574 GLsizei width, |
572 GLsizei height, | 575 GLsizei height, |
573 GLsizei depth); | 576 GLsizei depth); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 scoped_refptr<FeatureInfo> feature_info_; | 827 scoped_refptr<FeatureInfo> feature_info_; |
825 | 828 |
826 FramebufferManager* framebuffer_manager_; | 829 FramebufferManager* framebuffer_manager_; |
827 | 830 |
828 // Info for each texture in the system. | 831 // Info for each texture in the system. |
829 typedef base::hash_map<GLuint, scoped_refptr<TextureRef> > TextureMap; | 832 typedef base::hash_map<GLuint, scoped_refptr<TextureRef> > TextureMap; |
830 TextureMap textures_; | 833 TextureMap textures_; |
831 | 834 |
832 GLsizei max_texture_size_; | 835 GLsizei max_texture_size_; |
833 GLsizei max_cube_map_texture_size_; | 836 GLsizei max_cube_map_texture_size_; |
| 837 GLsizei max_rectangle_texture_size_; |
834 GLint max_levels_; | 838 GLint max_levels_; |
835 GLint max_cube_map_levels_; | 839 GLint max_cube_map_levels_; |
836 | 840 |
837 const bool use_default_textures_; | 841 const bool use_default_textures_; |
838 | 842 |
839 int num_unrenderable_textures_; | 843 int num_unrenderable_textures_; |
840 int num_unsafe_textures_; | 844 int num_unsafe_textures_; |
841 int num_uncleared_mips_; | 845 int num_uncleared_mips_; |
842 int num_images_; | 846 int num_images_; |
843 | 847 |
(...skipping 25 matching lines...) Expand all Loading... |
869 private: | 873 private: |
870 DecoderTextureState* texture_state_; | 874 DecoderTextureState* texture_state_; |
871 base::TimeTicks begin_time_; | 875 base::TimeTicks begin_time_; |
872 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 876 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
873 }; | 877 }; |
874 | 878 |
875 } // namespace gles2 | 879 } // namespace gles2 |
876 } // namespace gpu | 880 } // namespace gpu |
877 | 881 |
878 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 882 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
OLD | NEW |