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

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

Issue 1335873002: Initialize default texture for GL_TEXTURE_3D and GL_TEXTURE_2D_ARRAY (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gpu_unittests Created 5 years, 3 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 577
578 // Called via ~TextureRef. 578 // Called via ~TextureRef.
579 virtual void OnTextureRefDestroying(TextureRef* texture) = 0; 579 virtual void OnTextureRefDestroying(TextureRef* texture) = 0;
580 580
581 private: 581 private:
582 DISALLOW_COPY_AND_ASSIGN(DestructionObserver); 582 DISALLOW_COPY_AND_ASSIGN(DestructionObserver);
583 }; 583 };
584 584
585 enum DefaultAndBlackTextures { 585 enum DefaultAndBlackTextures {
586 kTexture2D, 586 kTexture2D,
587 kTexture3D,
588 kTexture2DArray,
587 kCubeMap, 589 kCubeMap,
588 kExternalOES, 590 kExternalOES,
589 kRectangleARB, 591 kRectangleARB,
590 kNumDefaultTextures 592 kNumDefaultTextures
591 }; 593 };
592 594
593 TextureManager(MemoryTracker* memory_tracker, 595 TextureManager(MemoryTracker* memory_tracker,
594 FeatureInfo* feature_info, 596 FeatureInfo* feature_info,
595 GLsizei max_texture_size, 597 GLsizei max_texture_size,
596 GLsizei max_cube_map_texture_size, 598 GLsizei max_cube_map_texture_size,
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 void RemoveTexture(GLuint client_id); 733 void RemoveTexture(GLuint client_id);
732 734
733 // Gets a Texture for a given service id (note: it assumes the texture object 735 // Gets a Texture for a given service id (note: it assumes the texture object
734 // is still mapped in this TextureManager). 736 // is still mapped in this TextureManager).
735 Texture* GetTextureForServiceId(GLuint service_id) const; 737 Texture* GetTextureForServiceId(GLuint service_id) const;
736 738
737 TextureRef* GetDefaultTextureInfo(GLenum target) { 739 TextureRef* GetDefaultTextureInfo(GLenum target) {
738 switch (target) { 740 switch (target) {
739 case GL_TEXTURE_2D: 741 case GL_TEXTURE_2D:
740 return default_textures_[kTexture2D].get(); 742 return default_textures_[kTexture2D].get();
743 case GL_TEXTURE_3D:
744 return default_textures_[kTexture3D].get();
745 case GL_TEXTURE_2D_ARRAY:
746 return default_textures_[kTexture2DArray].get();
741 case GL_TEXTURE_CUBE_MAP: 747 case GL_TEXTURE_CUBE_MAP:
742 return default_textures_[kCubeMap].get(); 748 return default_textures_[kCubeMap].get();
743 case GL_TEXTURE_EXTERNAL_OES: 749 case GL_TEXTURE_EXTERNAL_OES:
744 return default_textures_[kExternalOES].get(); 750 return default_textures_[kExternalOES].get();
745 case GL_TEXTURE_RECTANGLE_ARB: 751 case GL_TEXTURE_RECTANGLE_ARB:
746 return default_textures_[kRectangleARB].get(); 752 return default_textures_[kRectangleARB].get();
747 default: 753 default:
748 NOTREACHED(); 754 NOTREACHED();
749 return NULL; 755 return NULL;
750 } 756 }
(...skipping 12 matching lines...) Expand all
763 } 769 }
764 770
765 bool HaveImages() const { 771 bool HaveImages() const {
766 return num_images_ > 0; 772 return num_images_ > 0;
767 } 773 }
768 774
769 GLuint black_texture_id(GLenum target) const { 775 GLuint black_texture_id(GLenum target) const {
770 switch (target) { 776 switch (target) {
771 case GL_SAMPLER_2D: 777 case GL_SAMPLER_2D:
772 return black_texture_ids_[kTexture2D]; 778 return black_texture_ids_[kTexture2D];
779 case GL_SAMPLER_3D:
780 return black_texture_ids_[kTexture3D];
781 case GL_SAMPLER_2D_ARRAY:
782 return black_texture_ids_[kTexture2DArray];
773 case GL_SAMPLER_CUBE: 783 case GL_SAMPLER_CUBE:
774 return black_texture_ids_[kCubeMap]; 784 return black_texture_ids_[kCubeMap];
775 case GL_SAMPLER_EXTERNAL_OES: 785 case GL_SAMPLER_EXTERNAL_OES:
776 return black_texture_ids_[kExternalOES]; 786 return black_texture_ids_[kExternalOES];
777 case GL_SAMPLER_2D_RECT_ARB: 787 case GL_SAMPLER_2D_RECT_ARB:
778 return black_texture_ids_[kRectangleARB]; 788 return black_texture_ids_[kRectangleARB];
779 default: 789 default:
780 NOTREACHED(); 790 NOTREACHED();
781 return 0; 791 return 0;
782 } 792 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 private: 971 private:
962 DecoderTextureState* texture_state_; 972 DecoderTextureState* texture_state_;
963 base::TimeTicks begin_time_; 973 base::TimeTicks begin_time_;
964 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); 974 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer);
965 }; 975 };
966 976
967 } // namespace gles2 977 } // namespace gles2
968 } // namespace gpu 978 } // namespace gpu
969 979
970 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ 980 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698