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
3 // found in the LICENSE file.
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_
13 #include "base/basictypes.h"
14 #include "base/containers/hash_tables.h"
15 #include "base/memory/ref_counted.h"
16 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h"
17 #include "gpu/command_buffer/service/gl_utils.h"
18 #include "gpu/command_buffer/service/memory_tracking.h"
19 #include "gpu/gpu_export.h"
20 #include "ui/gfx/geometry/rect.h"
21 #include "ui/gl/gl_image.h"
28 struct DecoderFramebufferState
;
32 class FramebufferManager
;
37 // Info about Textures currently in the system.
38 // This class wraps a real GL texture, keeping track of its meta-data. It is
39 // jointly owned by possibly multiple TextureRef.
40 class GPU_EXPORT Texture
{
42 explicit Texture(GLuint service_id
);
44 GLenum
min_filter() const {
48 GLenum
mag_filter() const {
52 GLenum
wrap_r() const {
56 GLenum
wrap_s() const {
60 GLenum
wrap_t() const {
64 GLenum
usage() const {
72 GLenum
compare_func() const {
76 GLenum
compare_mode() const {
80 GLfloat
max_lod() const {
84 GLfloat
min_lod() const {
88 GLint
base_level() const {
92 GLint
max_level() const {
96 int num_uncleared_mips() const {
97 return num_uncleared_mips_
;
100 uint32
estimated_size() const {
101 return estimated_size_
;
104 bool CanRenderTo() const {
105 return target_
!= GL_TEXTURE_EXTERNAL_OES
;
108 // The service side OpenGL id of the texture.
109 GLuint
service_id() const {
113 void SetServiceId(GLuint service_id
) {
115 service_id_
= service_id
;
118 // Returns the target this texure was first bound to or 0 if it has not
119 // been bound. Once a texture is bound to a specific target it can never be
120 // bound to a different target.
121 GLenum
target() const {
125 bool SafeToRenderFrom() const {
129 // Get the width/height/depth for a particular level. Returns false if level
131 // |depth| is optional and can be nullptr.
133 GLint target
, GLint level
,
134 GLsizei
* width
, GLsizei
* height
, GLsizei
* depth
) const;
136 // Get the type of a level. Returns false if level does not exist.
138 GLint target
, GLint level
, GLenum
* type
, GLenum
* internal_format
) const;
140 // Get the image bound to a particular level. Returns NULL if level
142 gfx::GLImage
* GetLevelImage(GLint target
, GLint level
) const;
144 bool HasImages() const {
148 // Returns true of the given dimensions are inside the dimensions of the
149 // level and if the type matches the level.
150 bool ValidForTexture(
161 bool IsValid() const {
165 bool IsAttachedToFramebuffer() const {
166 return framebuffer_attachment_count_
!= 0;
169 void AttachToFramebuffer() {
170 ++framebuffer_attachment_count_
;
173 void DetachFromFramebuffer() {
174 DCHECK_GT(framebuffer_attachment_count_
, 0);
175 --framebuffer_attachment_count_
;
178 void SetImmutable(bool immutable
) {
179 immutable_
= immutable
;
182 bool IsImmutable() const {
186 // Get the cleared rectangle for a particular level. Returns an empty
187 // rectangle if level does not exist.
188 gfx::Rect
GetLevelClearedRect(GLenum target
, GLint level
) const;
190 // Whether a particular level/face is cleared.
191 bool IsLevelCleared(GLenum target
, GLint level
) const;
193 // Whether the texture has been defined
194 bool IsDefined() const {
195 return estimated_size() > 0;
198 // Initialize TEXTURE_MAX_ANISOTROPY to 1 if we haven't done so yet.
199 void InitTextureMaxAnisotropyIfNeeded(GLenum target
);
201 void OnWillModifyPixels();
202 void OnDidModifyPixels();
205 friend class MailboxManagerImpl
;
206 friend class MailboxManagerSync
;
207 friend class MailboxManagerTest
;
208 friend class TextureDefinition
;
209 friend class TextureManager
;
210 friend class TextureRef
;
211 friend class TextureTestHelper
;
214 void AddTextureRef(TextureRef
* ref
);
215 void RemoveTextureRef(TextureRef
* ref
, bool have_context
);
216 MemoryTypeTracker
* GetMemTracker();
218 // Condition on which this texture is renderable. Can be ONLY_IF_NPOT if it
219 // depends on context support for non-power-of-two textures (i.e. will be
220 // renderable if NPOT support is in the context, otherwise not, e.g. texture
221 // with a NPOT level). ALWAYS means it doesn't depend on context features
222 // (e.g. complete POT), NEVER means it's not renderable regardless (e.g.
224 enum CanRenderCondition
{
227 CAN_RENDER_ONLY_IF_NPOT
232 LevelInfo(const LevelInfo
& rhs
);
235 gfx::Rect cleared_rect
;
238 GLenum internal_format
;
245 scoped_refptr
<gfx::GLImage
> image
;
246 uint32 estimated_size
;
253 GLsizei num_mip_levels
;
254 std::vector
<LevelInfo
> level_infos
;
257 // Set the info for a particular level.
258 void SetLevelInfo(const FeatureInfo
* feature_info
,
261 GLenum internal_format
,
268 const gfx::Rect
& cleared_rect
);
270 // In GLES2 "texture complete" means it has all required mips for filtering
271 // down to a 1x1 pixel texture, they are in the correct order, they are all
273 bool texture_complete() const {
274 return texture_complete_
;
277 // In GLES2 "cube complete" means all 6 faces level 0 are defined, all the
278 // same format, all the same dimensions and all width = height.
279 bool cube_complete() const {
280 return cube_complete_
;
283 // Whether or not this texture is a non-power-of-two texture.
288 // Marks a |rect| of a particular level as cleared.
289 void SetLevelClearedRect(GLenum target
,
291 const gfx::Rect
& cleared_rect
);
293 // Marks a particular level as cleared or uncleared.
294 void SetLevelCleared(GLenum target
, GLint level
, bool cleared
);
296 // Updates the cleared flag for this texture by inspecting all the mips.
297 void UpdateCleared();
299 // Clears any renderable uncleared levels.
300 // Returns false if a GL error was generated.
301 bool ClearRenderableLevels(GLES2Decoder
* decoder
);
304 // Returns false if a GL error was generated.
305 bool ClearLevel(GLES2Decoder
* decoder
, GLenum target
, GLint level
);
307 // Sets a texture parameter.
308 // TODO(gman): Expand to SetParameteriv,fv
309 // Returns GL_NO_ERROR on success. Otherwise the error to generate.
310 GLenum
SetParameteri(
311 const FeatureInfo
* feature_info
, GLenum pname
, GLint param
);
312 GLenum
SetParameterf(
313 const FeatureInfo
* feature_info
, GLenum pname
, GLfloat param
);
315 // Makes each of the mip levels as though they were generated.
316 bool MarkMipmapsGenerated(const FeatureInfo
* feature_info
);
318 bool NeedsMips() const {
319 return min_filter_
!= GL_NEAREST
&& min_filter_
!= GL_LINEAR
;
322 // True if this texture meets all the GLES2 criteria for rendering.
323 // See section 3.8.2 of the GLES2 spec.
324 bool CanRender(const FeatureInfo
* feature_info
) const;
326 // Returns true if mipmaps can be generated by GL.
327 bool CanGenerateMipmaps(const FeatureInfo
* feature_info
) const;
329 // Returns true if any of the texture dimensions are not a power of two.
330 static bool TextureIsNPOT(GLsizei width
, GLsizei height
, GLsizei depth
);
332 // Returns true if texture face is complete relative to the first face.
333 static bool TextureFaceComplete(const Texture::LevelInfo
& first_face
,
336 GLenum internal_format
,
343 // Returns true if texture mip level is complete relative to first level.
344 static bool TextureMipComplete(const Texture::LevelInfo
& level0_face
,
347 GLenum internal_format
,
354 // Sets the Texture's target
356 // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP or
357 // GL_TEXTURE_EXTERNAL_OES or GL_TEXTURE_RECTANGLE_ARB
358 // GL_TEXTURE_2D_ARRAY or GL_TEXTURE_3D (for GLES3)
359 // max_levels: The maximum levels this type of target can have.
361 const FeatureInfo
* feature_info
, GLenum target
, GLint max_levels
);
363 // Update info about this texture.
364 void Update(const FeatureInfo
* feature_info
);
366 // Set the image for a particular level.
368 const FeatureInfo
* feature_info
,
371 gfx::GLImage
* image
);
373 // Appends a signature for the given level.
375 const FeatureInfo
* feature_info
,
376 GLenum target
, GLint level
, std::string
* signature
) const;
378 void SetMailboxManager(MailboxManager
* mailbox_manager
);
380 // Updates the unsafe textures count in all the managers referencing this
382 void UpdateSafeToRenderFrom(bool cleared
);
384 // Updates the uncleared mip count in all the managers referencing this
386 void UpdateMipCleared(LevelInfo
* info
,
389 const gfx::Rect
& cleared_rect
);
391 // Computes the CanRenderCondition flag.
392 CanRenderCondition
GetCanRenderCondition() const;
394 // Updates the unrenderable texture count in all the managers referencing this
396 void UpdateCanRenderCondition();
398 // Updates the images count in all the managers referencing this
400 void UpdateHasImages();
402 // Increment the framebuffer state change count in all the managers
403 // referencing this texture.
404 void IncAllFramebufferStateChangeCount();
406 MailboxManager
* mailbox_manager_
;
408 // Info about each face and level of texture.
409 std::vector
<FaceInfo
> face_infos_
;
411 // The texture refs that point to this Texture.
412 typedef std::set
<TextureRef
*> RefSet
;
415 // The single TextureRef that accounts for memory for this texture. Must be
417 TextureRef
* memory_tracking_ref_
;
419 // The id of the texure
422 // Whether all renderable mips of this texture have been cleared.
425 int num_uncleared_mips_
;
428 // The target. 0 if unset, otherwise GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP.
429 // Or GL_TEXTURE_2D_ARRAY or GL_TEXTURE_3D (for GLES3).
432 // Texture parameters.
440 GLenum compare_func_
;
441 GLenum compare_mode_
;
447 // The maximum level that has been set.
448 GLint max_level_set_
;
450 // Whether or not this texture is "texture complete"
451 bool texture_complete_
;
453 // Whether mip levels have changed and should be reverified.
454 bool texture_mips_dirty_
;
455 bool texture_mips_complete_
;
457 // Whether or not this texture is "cube complete"
460 // Whether any level 0 faces have changed and should be reverified.
461 bool texture_level0_dirty_
;
462 bool texture_level0_complete_
;
464 // Whether or not this texture is non-power-of-two
467 // Whether this texture has ever been bound.
468 bool has_been_bound_
;
470 // The number of framebuffers this texture is attached to.
471 int framebuffer_attachment_count_
;
473 // Whether the texture is immutable and no further changes to the format
474 // or dimensions of the texture object can be made.
477 // Whether or not this texture has images.
480 // Size in bytes this texture is assumed to take in memory.
481 uint32 estimated_size_
;
483 // Cache of the computed CanRenderCondition flag.
484 CanRenderCondition can_render_condition_
;
486 // Whether we have initialized TEXTURE_MAX_ANISOTROPY to 1.
487 bool texture_max_anisotropy_initialized_
;
489 DISALLOW_COPY_AND_ASSIGN(Texture
);
492 // This class represents a texture in a client context group. It's mostly 1:1
493 // with a client id, though it can outlive the client id if it's still bound to
494 // a FBO or another context when destroyed.
495 // Multiple TextureRef can point to the same texture with cross-context sharing.
496 class GPU_EXPORT TextureRef
: public base::RefCounted
<TextureRef
> {
498 TextureRef(TextureManager
* manager
, GLuint client_id
, Texture
* texture
);
499 static scoped_refptr
<TextureRef
> Create(TextureManager
* manager
,
503 void AddObserver() { num_observers_
++; }
504 void RemoveObserver() { num_observers_
--; }
506 const Texture
* texture() const { return texture_
; }
507 Texture
* texture() { return texture_
; }
508 GLuint
client_id() const { return client_id_
; }
509 GLuint
service_id() const { return texture_
->service_id(); }
510 GLint
num_observers() const { return num_observers_
; }
513 friend class base::RefCounted
<TextureRef
>;
514 friend class Texture
;
515 friend class TextureManager
;
518 const TextureManager
* manager() const { return manager_
; }
519 TextureManager
* manager() { return manager_
; }
520 void reset_client_id() { client_id_
= 0; }
522 TextureManager
* manager_
;
525 GLint num_observers_
;
527 DISALLOW_COPY_AND_ASSIGN(TextureRef
);
530 // Holds data that is per gles2_cmd_decoder, but is related to to the
532 struct DecoderTextureState
{
533 // total_texture_upload_time automatically initialized to 0 in default
535 explicit DecoderTextureState(bool texsubimage_faster_than_teximage
)
536 : tex_image_failed(false),
537 texture_upload_count(0),
538 texsubimage_faster_than_teximage(texsubimage_faster_than_teximage
) {}
540 // This indicates all the following texSubImage*D calls that are part of the
541 // failed texImage*D call should be ignored. The client calls have a lock
542 // around them, so it will affect only a single texImage*D + texSubImage*D
544 bool tex_image_failed
;
546 // Command buffer stats.
547 int texture_upload_count
;
548 base::TimeDelta total_texture_upload_time
;
550 bool texsubimage_faster_than_teximage
;
553 // This class keeps track of the textures and their sizes so we can do NPOT and
554 // texture complete checking.
556 // NOTE: To support shared resources an instance of this class will need to be
557 // shared by multiple GLES2Decoders.
558 class GPU_EXPORT TextureManager
{
560 class GPU_EXPORT DestructionObserver
{
562 DestructionObserver();
563 virtual ~DestructionObserver();
565 // Called in ~TextureManager.
566 virtual void OnTextureManagerDestroying(TextureManager
* manager
) = 0;
568 // Called via ~TextureRef.
569 virtual void OnTextureRefDestroying(TextureRef
* texture
) = 0;
572 DISALLOW_COPY_AND_ASSIGN(DestructionObserver
);
575 enum DefaultAndBlackTextures
{
583 TextureManager(MemoryTracker
* memory_tracker
,
584 FeatureInfo
* feature_info
,
585 GLsizei max_texture_size
,
586 GLsizei max_cube_map_texture_size
,
587 GLsizei max_rectangle_texture_size
,
588 GLsizei max_3d_texture_size
,
589 bool use_default_textures
);
592 void set_framebuffer_manager(FramebufferManager
* manager
) {
593 framebuffer_manager_
= manager
;
596 // Init the texture manager.
599 // Must call before destruction.
600 void Destroy(bool have_context
);
602 // Returns the maximum number of levels.
603 GLint
MaxLevelsForTarget(GLenum target
) const {
607 case GL_TEXTURE_RECTANGLE_ARB
:
608 case GL_TEXTURE_EXTERNAL_OES
:
611 case GL_TEXTURE_2D_ARRAY
:
612 return max_3d_levels_
;
614 return max_cube_map_levels_
;
618 // Returns the maximum size.
619 GLsizei
MaxSizeForTarget(GLenum target
) const {
622 case GL_TEXTURE_EXTERNAL_OES
:
623 return max_texture_size_
;
624 case GL_TEXTURE_RECTANGLE
:
625 return max_rectangle_texture_size_
;
627 case GL_TEXTURE_2D_ARRAY
:
628 return max_3d_texture_size_
;
630 return max_cube_map_texture_size_
;
634 // Returns the maxium number of levels a texture of the given size can have.
635 static GLsizei
ComputeMipMapCount(GLenum target
,
640 // Checks if a dimensions are valid for a given target.
642 GLenum target
, GLint level
,
643 GLsizei width
, GLsizei height
, GLsizei depth
);
645 // True if this texture meets all the GLES2 criteria for rendering.
646 // See section 3.8.2 of the GLES2 spec.
647 bool CanRender(const TextureRef
* ref
) const {
648 return ref
->texture()->CanRender(feature_info_
.get());
651 // Returns true if mipmaps can be generated by GL.
652 bool CanGenerateMipmaps(const TextureRef
* ref
) const {
653 return ref
->texture()->CanGenerateMipmaps(feature_info_
.get());
656 // Sets the Texture's target
658 // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP
659 // GL_TEXTURE_2D_ARRAY or GL_TEXTURE_3D (for GLES3)
660 // max_levels: The maximum levels this type of target can have.
665 // Set the info for a particular level in a TexureInfo.
666 void SetLevelInfo(TextureRef
* ref
,
669 GLenum internal_format
,
676 const gfx::Rect
& cleared_rect
);
678 // Adapter to call above function.
679 void SetLevelInfoFromParams(TextureRef
* ref
,
680 const gpu::AsyncTexImage2DParams
& params
) {
681 SetLevelInfo(ref
, params
.target
, params
.level
, params
.internal_format
,
682 params
.width
, params
.height
, 1 /* depth */, params
.border
,
683 params
.format
, params
.type
,
684 gfx::Rect(params
.width
, params
.height
) /* cleared_rect */);
687 Texture
* Produce(TextureRef
* ref
);
689 // Maps an existing texture into the texture manager, at a given client ID.
690 TextureRef
* Consume(GLuint client_id
, Texture
* texture
);
692 // Sets |rect| of mip as cleared.
693 void SetLevelClearedRect(TextureRef
* ref
,
696 const gfx::Rect
& cleared_rect
);
698 // Sets a mip as cleared.
699 void SetLevelCleared(TextureRef
* ref
, GLenum target
,
700 GLint level
, bool cleared
);
702 // Sets a texture parameter of a Texture
703 // Returns GL_NO_ERROR on success. Otherwise the error to generate.
704 // TODO(gman): Expand to SetParameteriv,fv
706 const char* function_name
, ErrorState
* error_state
,
707 TextureRef
* ref
, GLenum pname
, GLint param
);
709 const char* function_name
, ErrorState
* error_state
,
710 TextureRef
* ref
, GLenum pname
, GLfloat param
);
712 // Makes each of the mip levels as though they were generated.
713 // Returns false if that's not allowed for the given texture.
714 bool MarkMipmapsGenerated(TextureRef
* ref
);
716 // Clears any uncleared renderable levels.
717 bool ClearRenderableLevels(GLES2Decoder
* decoder
, TextureRef
* ref
);
719 // Clear a specific level.
720 bool ClearTextureLevel(
721 GLES2Decoder
* decoder
, TextureRef
* ref
, GLenum target
, GLint level
);
723 // Creates a new texture info.
724 TextureRef
* CreateTexture(GLuint client_id
, GLuint service_id
);
726 // Gets the texture info for the given texture.
727 TextureRef
* GetTexture(GLuint client_id
) const;
729 // Removes a texture info.
730 void RemoveTexture(GLuint client_id
);
732 // Gets a Texture for a given service id (note: it assumes the texture object
733 // is still mapped in this TextureManager).
734 Texture
* GetTextureForServiceId(GLuint service_id
) const;
736 TextureRef
* GetDefaultTextureInfo(GLenum target
) {
739 return default_textures_
[kTexture2D
].get();
740 case GL_TEXTURE_CUBE_MAP
:
741 return default_textures_
[kCubeMap
].get();
742 case GL_TEXTURE_EXTERNAL_OES
:
743 return default_textures_
[kExternalOES
].get();
744 case GL_TEXTURE_RECTANGLE_ARB
:
745 return default_textures_
[kRectangleARB
].get();
752 bool HaveUnrenderableTextures() const {
753 return num_unrenderable_textures_
> 0;
756 bool HaveUnsafeTextures() const {
757 return num_unsafe_textures_
> 0;
760 bool HaveUnclearedMips() const {
761 return num_uncleared_mips_
> 0;
764 bool HaveImages() const {
765 return num_images_
> 0;
768 GLuint
black_texture_id(GLenum target
) const {
771 return black_texture_ids_
[kTexture2D
];
772 case GL_SAMPLER_CUBE
:
773 return black_texture_ids_
[kCubeMap
];
774 case GL_SAMPLER_EXTERNAL_OES
:
775 return black_texture_ids_
[kExternalOES
];
776 case GL_SAMPLER_2D_RECT_ARB
:
777 return black_texture_ids_
[kRectangleARB
];
784 size_t mem_represented() const {
786 memory_tracker_managed_
->GetMemRepresented() +
787 memory_tracker_unmanaged_
->GetMemRepresented();
794 gfx::GLImage
* image
);
796 size_t GetSignatureSize() const;
802 std::string
* signature
) const;
804 void AddObserver(DestructionObserver
* observer
) {
805 destruction_observers_
.push_back(observer
);
808 void RemoveObserver(DestructionObserver
* observer
) {
809 for (unsigned int i
= 0; i
< destruction_observers_
.size(); i
++) {
810 if (destruction_observers_
[i
] == observer
) {
811 std::swap(destruction_observers_
[i
], destruction_observers_
.back());
812 destruction_observers_
.pop_back();
819 struct DoTexImageArguments
{
820 enum TexImageCommandType
{
827 GLenum internal_format
;
836 TexImageCommandType command_type
;
839 bool ValidateTexImage(
841 const char* function_name
,
842 const DoTexImageArguments
& args
,
843 // Pointer to TextureRef filled in if validation successful.
844 // Presumes the pointer is valid.
845 TextureRef
** texture_ref
);
847 void ValidateAndDoTexImage(
848 DecoderTextureState
* texture_state
,
850 DecoderFramebufferState
* framebuffer_state
,
851 const char* function_name
,
852 const DoTexImageArguments
& args
);
854 // TODO(kloveless): Make GetTexture* private once this is no longer called
855 // from gles2_cmd_decoder.
856 TextureRef
* GetTextureInfoForTarget(ContextState
* state
, GLenum target
);
857 TextureRef
* GetTextureInfoForTargetUnlessDefault(
858 ContextState
* state
, GLenum target
);
860 bool ValidateFormatAndTypeCombination(
861 ErrorState
* error_state
, const char* function_name
,
862 GLenum format
, GLenum type
);
864 // Note that internal_format is only checked in relation to the format
865 // parameter, so that this function may be used to validate texSubImage2D.
866 bool ValidateTextureParameters(
867 ErrorState
* error_state
, const char* function_name
,
868 GLenum format
, GLenum type
, GLenum internal_format
, GLint level
);
871 friend class Texture
;
872 friend class TextureRef
;
874 // Helper for Initialize().
875 scoped_refptr
<TextureRef
> CreateDefaultAndBlackTextures(
877 GLuint
* black_texture
);
880 DecoderTextureState
* texture_state
,
881 ErrorState
* error_state
,
882 DecoderFramebufferState
* framebuffer_state
,
883 const char* function_name
,
884 TextureRef
* texture_ref
,
885 const DoTexImageArguments
& args
);
887 void StartTracking(TextureRef
* texture
);
888 void StopTracking(TextureRef
* texture
);
890 void UpdateSafeToRenderFrom(int delta
);
891 void UpdateUnclearedMips(int delta
);
892 void UpdateCanRenderCondition(Texture::CanRenderCondition old_condition
,
893 Texture::CanRenderCondition new_condition
);
894 void UpdateNumImages(int delta
);
895 void IncFramebufferStateChangeCount();
897 GLenum
AdjustTexFormat(GLenum format
) const;
899 MemoryTypeTracker
* GetMemTracker(GLenum texture_pool
);
900 scoped_ptr
<MemoryTypeTracker
> memory_tracker_managed_
;
901 scoped_ptr
<MemoryTypeTracker
> memory_tracker_unmanaged_
;
903 scoped_refptr
<FeatureInfo
> feature_info_
;
905 FramebufferManager
* framebuffer_manager_
;
907 // Info for each texture in the system.
908 typedef base::hash_map
<GLuint
, scoped_refptr
<TextureRef
> > TextureMap
;
909 TextureMap textures_
;
911 GLsizei max_texture_size_
;
912 GLsizei max_cube_map_texture_size_
;
913 GLsizei max_rectangle_texture_size_
;
914 GLsizei max_3d_texture_size_
;
916 GLint max_cube_map_levels_
;
917 GLint max_3d_levels_
;
919 const bool use_default_textures_
;
921 int num_unrenderable_textures_
;
922 int num_unsafe_textures_
;
923 int num_uncleared_mips_
;
926 // Counts the number of Textures allocated with 'this' as its manager.
927 // Allows to check no Texture will outlive this.
928 unsigned int texture_count_
;
932 // Black (0,0,0,1) textures for when non-renderable textures are used.
933 // NOTE: There is no corresponding Texture for these textures.
934 // TextureInfos are only for textures the client side can access.
935 GLuint black_texture_ids_
[kNumDefaultTextures
];
937 // The default textures for each target (texture name = 0)
938 scoped_refptr
<TextureRef
> default_textures_
[kNumDefaultTextures
];
940 std::vector
<DestructionObserver
*> destruction_observers_
;
942 DISALLOW_COPY_AND_ASSIGN(TextureManager
);
945 // This class records texture upload time when in scope.
946 class ScopedTextureUploadTimer
{
948 explicit ScopedTextureUploadTimer(DecoderTextureState
* texture_state
);
949 ~ScopedTextureUploadTimer();
952 DecoderTextureState
* texture_state_
;
953 base::TimeTicks begin_time_
;
954 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer
);
960 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_