Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: gpu/command_buffer/service/texture_manager.h

Issue 1256613002: Add tracing for GL texture objects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@browser_process_id
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 base::TimeDelta total_texture_upload_time; 548 base::TimeDelta total_texture_upload_time;
549 549
550 bool texsubimage_faster_than_teximage; 550 bool texsubimage_faster_than_teximage;
551 }; 551 };
552 552
553 // This class keeps track of the textures and their sizes so we can do NPOT and 553 // This class keeps track of the textures and their sizes so we can do NPOT and
554 // texture complete checking. 554 // texture complete checking.
555 // 555 //
556 // NOTE: To support shared resources an instance of this class will need to be 556 // NOTE: To support shared resources an instance of this class will need to be
557 // shared by multiple GLES2Decoders. 557 // shared by multiple GLES2Decoders.
558 class GPU_EXPORT TextureManager { 558 class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider {
559 public: 559 public:
560 class GPU_EXPORT DestructionObserver { 560 class GPU_EXPORT DestructionObserver {
561 public: 561 public:
562 DestructionObserver(); 562 DestructionObserver();
563 virtual ~DestructionObserver(); 563 virtual ~DestructionObserver();
564 564
565 // Called in ~TextureManager. 565 // Called in ~TextureManager.
566 virtual void OnTextureManagerDestroying(TextureManager* manager) = 0; 566 virtual void OnTextureManagerDestroying(TextureManager* manager) = 0;
567 567
568 // Called via ~TextureRef. 568 // Called via ~TextureRef.
(...skipping 11 matching lines...) Expand all
580 kNumDefaultTextures 580 kNumDefaultTextures
581 }; 581 };
582 582
583 TextureManager(MemoryTracker* memory_tracker, 583 TextureManager(MemoryTracker* memory_tracker,
584 FeatureInfo* feature_info, 584 FeatureInfo* feature_info,
585 GLsizei max_texture_size, 585 GLsizei max_texture_size,
586 GLsizei max_cube_map_texture_size, 586 GLsizei max_cube_map_texture_size,
587 GLsizei max_rectangle_texture_size, 587 GLsizei max_rectangle_texture_size,
588 GLsizei max_3d_texture_size, 588 GLsizei max_3d_texture_size,
589 bool use_default_textures); 589 bool use_default_textures);
590 ~TextureManager(); 590 ~TextureManager() override;
591 591
592 void set_framebuffer_manager(FramebufferManager* manager) { 592 void set_framebuffer_manager(FramebufferManager* manager) {
593 framebuffer_manager_ = manager; 593 framebuffer_manager_ = manager;
594 } 594 }
595 595
596 // Init the texture manager. 596 // Init the texture manager.
597 bool Initialize(); 597 bool Initialize();
598 598
599 // Must call before destruction. 599 // Must call before destruction.
600 void Destroy(bool have_context); 600 void Destroy(bool have_context);
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 bool ValidateFormatAndTypeCombination( 859 bool ValidateFormatAndTypeCombination(
860 ErrorState* error_state, const char* function_name, 860 ErrorState* error_state, const char* function_name,
861 GLenum format, GLenum type); 861 GLenum format, GLenum type);
862 862
863 // Note that internal_format is only checked in relation to the format 863 // Note that internal_format is only checked in relation to the format
864 // parameter, so that this function may be used to validate texSubImage2D. 864 // parameter, so that this function may be used to validate texSubImage2D.
865 bool ValidateTextureParameters( 865 bool ValidateTextureParameters(
866 ErrorState* error_state, const char* function_name, 866 ErrorState* error_state, const char* function_name,
867 GLenum format, GLenum type, GLenum internal_format, GLint level); 867 GLenum format, GLenum type, GLenum internal_format, GLint level);
868 868
869 // base::trace_event::MemoryDumpProvider implementation.
870 bool OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd) override;
871
869 private: 872 private:
870 friend class Texture; 873 friend class Texture;
871 friend class TextureRef; 874 friend class TextureRef;
872 875
873 // Helper for Initialize(). 876 // Helper for Initialize().
874 scoped_refptr<TextureRef> CreateDefaultAndBlackTextures( 877 scoped_refptr<TextureRef> CreateDefaultAndBlackTextures(
875 GLenum target, 878 GLenum target,
876 GLuint* black_texture); 879 GLuint* black_texture);
877 880
878 void DoTexImage( 881 void DoTexImage(
879 DecoderTextureState* texture_state, 882 DecoderTextureState* texture_state,
880 ErrorState* error_state, 883 ErrorState* error_state,
881 DecoderFramebufferState* framebuffer_state, 884 DecoderFramebufferState* framebuffer_state,
882 const char* function_name, 885 const char* function_name,
883 TextureRef* texture_ref, 886 TextureRef* texture_ref,
884 const DoTexImageArguments& args); 887 const DoTexImageArguments& args);
885 888
886 void StartTracking(TextureRef* texture); 889 void StartTracking(TextureRef* texture);
887 void StopTracking(TextureRef* texture); 890 void StopTracking(TextureRef* texture);
888 891
889 void UpdateSafeToRenderFrom(int delta); 892 void UpdateSafeToRenderFrom(int delta);
890 void UpdateUnclearedMips(int delta); 893 void UpdateUnclearedMips(int delta);
891 void UpdateCanRenderCondition(Texture::CanRenderCondition old_condition, 894 void UpdateCanRenderCondition(Texture::CanRenderCondition old_condition,
892 Texture::CanRenderCondition new_condition); 895 Texture::CanRenderCondition new_condition);
893 void UpdateNumImages(int delta); 896 void UpdateNumImages(int delta);
894 void IncFramebufferStateChangeCount(); 897 void IncFramebufferStateChangeCount();
895 898
896 GLenum AdjustTexFormat(GLenum format) const; 899 GLenum AdjustTexFormat(GLenum format) const;
897 900
901 // Helper function called by OnMemoryDump.
902 void DumpTextureRef(base::trace_event::ProcessMemoryDump* pmd,
903 TextureRef* ref);
904
898 MemoryTypeTracker* GetMemTracker(GLenum texture_pool); 905 MemoryTypeTracker* GetMemTracker(GLenum texture_pool);
899 scoped_ptr<MemoryTypeTracker> memory_tracker_managed_; 906 scoped_ptr<MemoryTypeTracker> memory_tracker_managed_;
900 scoped_ptr<MemoryTypeTracker> memory_tracker_unmanaged_; 907 scoped_ptr<MemoryTypeTracker> memory_tracker_unmanaged_;
908 MemoryTracker* memory_tracker_;
901 909
902 scoped_refptr<FeatureInfo> feature_info_; 910 scoped_refptr<FeatureInfo> feature_info_;
903 911
904 FramebufferManager* framebuffer_manager_; 912 FramebufferManager* framebuffer_manager_;
905 913
906 // Info for each texture in the system. 914 // Info for each texture in the system.
907 typedef base::hash_map<GLuint, scoped_refptr<TextureRef> > TextureMap; 915 typedef base::hash_map<GLuint, scoped_refptr<TextureRef> > TextureMap;
908 TextureMap textures_; 916 TextureMap textures_;
909 917
910 GLsizei max_texture_size_; 918 GLsizei max_texture_size_;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 private: 958 private:
951 DecoderTextureState* texture_state_; 959 DecoderTextureState* texture_state_;
952 base::TimeTicks begin_time_; 960 base::TimeTicks begin_time_;
953 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); 961 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer);
954 }; 962 };
955 963
956 } // namespace gles2 964 } // namespace gles2
957 } // namespace gpu 965 } // namespace gpu
958 966
959 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ 967 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698