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

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

Issue 12717013: Add reference-counting for mailbox textures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add optional 'pool' reference while textures are in mailbox Created 7 years, 8 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 | Annotate | Revision Log
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 <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/hash_tables.h" 12 #include "base/hash_tables.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "gpu/command_buffer/service/gl_utils.h" 15 #include "gpu/command_buffer/service/gl_utils.h"
16 #include "gpu/command_buffer/service/memory_tracking.h" 16 #include "gpu/command_buffer/service/memory_tracking.h"
17 #include "gpu/command_buffer/service/texture_definition.h"
17 #include "gpu/gpu_export.h" 18 #include "gpu/gpu_export.h"
18 #include "ui/gl/async_pixel_transfer_delegate.h" 19 #include "ui/gl/async_pixel_transfer_delegate.h"
19 #include "ui/gl/gl_image.h" 20 #include "ui/gl/gl_image.h"
20 21
21 namespace gpu { 22 namespace gpu {
22 namespace gles2 { 23 namespace gles2 {
23 24
24 class GLES2Decoder; 25 class GLES2Decoder;
25 class Display; 26 class Display;
26 class FeatureInfo; 27 class FeatureInfo;
27 class TextureDefinition;
28 class TextureManager; 28 class TextureManager;
29 29
30 // Info about Textures currently in the system. 30 // Info about Textures currently in the system.
31 class GPU_EXPORT Texture : public base::RefCounted<Texture> { 31 class GPU_EXPORT Texture : public base::RefCounted<Texture>,
32 private TextureDefinition::Client {
32 public: 33 public:
33 Texture(TextureManager* manager, GLuint service_id); 34 Texture(TextureManager* manager, GLuint service_id);
34 35
35 GLenum min_filter() const { 36 GLenum min_filter() const {
36 return min_filter_; 37 return min_filter_;
37 } 38 }
38 39
39 GLenum mag_filter() const { 40 GLenum mag_filter() const {
40 return mag_filter_; 41 return mag_filter_;
41 } 42 }
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 const FeatureInfo* feature_info, 284 const FeatureInfo* feature_info,
284 GLenum target, 285 GLenum target,
285 GLint level, 286 GLint level,
286 gfx::GLImage* image); 287 gfx::GLImage* image);
287 288
288 // Appends a signature for the given level. 289 // Appends a signature for the given level.
289 void AddToSignature( 290 void AddToSignature(
290 const FeatureInfo* feature_info, 291 const FeatureInfo* feature_info,
291 GLenum target, GLint level, std::string* signature) const; 292 GLenum target, GLint level, std::string* signature) const;
292 293
294 virtual void StartUsingSharedTexture(TextureDefinition* definition) OVERRIDE;
295 virtual bool StopUsingSharedTexture(bool have_context) OVERRIDE;
296
293 // Info about each face and level of texture. 297 // Info about each face and level of texture.
294 std::vector<std::vector<LevelInfo> > level_infos_; 298 std::vector<std::vector<LevelInfo> > level_infos_;
295 299
296 // The texture manager that manages this Texture. 300 // The texture manager that manages this Texture.
297 TextureManager* manager_; 301 TextureManager* manager_;
298 302
299 // The id of the texure 303 // The id of the texure
300 GLuint service_id_; 304 GLuint service_id_;
301 305
302 // Whether this texture has been deleted. 306 // Whether this texture has been deleted.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // State to facilitate async transfers on this texture. 350 // State to facilitate async transfers on this texture.
347 scoped_ptr<gfx::AsyncPixelTransferState> async_transfer_state_; 351 scoped_ptr<gfx::AsyncPixelTransferState> async_transfer_state_;
348 352
349 // Whether the texture is immutable and no further changes to the format 353 // Whether the texture is immutable and no further changes to the format
350 // or dimensions of the texture object can be made. 354 // or dimensions of the texture object can be made.
351 bool immutable_; 355 bool immutable_;
352 356
353 // Size in bytes this texture is assumed to take in memory. 357 // Size in bytes this texture is assumed to take in memory.
354 uint32 estimated_size_; 358 uint32 estimated_size_;
355 359
360 // A reference to a shared texture, keeping it from being deleted.
361 TextureDefinition* shared_texture_;
362
356 DISALLOW_COPY_AND_ASSIGN(Texture); 363 DISALLOW_COPY_AND_ASSIGN(Texture);
357 }; 364 };
358 365
359 // This class keeps track of the textures and their sizes so we can do NPOT and 366 // This class keeps track of the textures and their sizes so we can do NPOT and
360 // texture complete checking. 367 // texture complete checking.
361 // 368 //
362 // NOTE: To support shared resources an instance of this class will need to be 369 // NOTE: To support shared resources an instance of this class will need to be
363 // shared by multiple GLES2Decoders. 370 // shared by multiple GLES2Decoders.
364 class GPU_EXPORT TextureManager { 371 class GPU_EXPORT TextureManager {
365 public: 372 public:
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 // The default textures for each target (texture name = 0) 615 // The default textures for each target (texture name = 0)
609 scoped_refptr<Texture> default_textures_[kNumDefaultTextures]; 616 scoped_refptr<Texture> default_textures_[kNumDefaultTextures];
610 617
611 DISALLOW_COPY_AND_ASSIGN(TextureManager); 618 DISALLOW_COPY_AND_ASSIGN(TextureManager);
612 }; 619 };
613 620
614 } // namespace gles2 621 } // namespace gles2
615 } // namespace gpu 622 } // namespace gpu
616 623
617 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ 624 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_definition.cc ('k') | gpu/command_buffer/service/texture_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698