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

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

Issue 10543125: gpu: Add support for GLX_EXT_texture_from_pixmap extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add kGLImplementationMockGL case to gl_image_android.cc. Created 8 years, 2 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 <vector> 8 #include <vector>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "gpu/command_buffer/service/feature_info.h" 13 #include "gpu/command_buffer/service/feature_info.h"
14 #include "gpu/command_buffer/service/gl_utils.h" 14 #include "gpu/command_buffer/service/gl_utils.h"
15 #include "gpu/gpu_export.h" 15 #include "gpu/gpu_export.h"
16 #include "ui/gl/gl_image.h"
16 17
17 namespace gpu { 18 namespace gpu {
18 namespace gles2 { 19 namespace gles2 {
19 20
20 class GLES2Decoder; 21 class GLES2Decoder;
21 class Display; 22 class Display;
22 class TextureDefinition; 23 class TextureDefinition;
23 class MemoryTracker; 24 class MemoryTracker;
24 class MemoryTypeTracker; 25 class MemoryTypeTracker;
25 26
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 118
118 // Get the width and height for a particular level. Returns false if level 119 // Get the width and height for a particular level. Returns false if level
119 // does not exist. 120 // does not exist.
120 bool GetLevelSize( 121 bool GetLevelSize(
121 GLint face, GLint level, GLsizei* width, GLsizei* height) const; 122 GLint face, GLint level, GLsizei* width, GLsizei* height) const;
122 123
123 // Get the type of a level. Returns false if level does not exist. 124 // Get the type of a level. Returns false if level does not exist.
124 bool GetLevelType( 125 bool GetLevelType(
125 GLint face, GLint level, GLenum* type, GLenum* internal_format) const; 126 GLint face, GLint level, GLenum* type, GLenum* internal_format) const;
126 127
128 // Get the image bound to a particular level. Returns NULL if level
129 // does not exist.
130 gfx::GLImage* GetLevelImage(GLint face, GLint level) const;
131
127 bool IsDeleted() const { 132 bool IsDeleted() const {
128 return deleted_; 133 return deleted_;
129 } 134 }
130 135
131 // Returns true of the given dimensions are inside the dimensions of the 136 // Returns true of the given dimensions are inside the dimensions of the
132 // level and if the format and type match the level. 137 // level and if the format and type match the level.
133 bool ValidForTexture( 138 bool ValidForTexture(
134 GLint face, 139 GLint face,
135 GLint level, 140 GLint level,
136 GLint xoffset, 141 GLint xoffset,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 187
183 private: 188 private:
184 friend class TextureManager; 189 friend class TextureManager;
185 friend class base::RefCounted<TextureInfo>; 190 friend class base::RefCounted<TextureInfo>;
186 191
187 ~TextureInfo(); 192 ~TextureInfo();
188 193
189 struct LevelInfo { 194 struct LevelInfo {
190 LevelInfo(); 195 LevelInfo();
191 LevelInfo(const LevelInfo& rhs); 196 LevelInfo(const LevelInfo& rhs);
197 ~LevelInfo();
192 198
193 bool cleared; 199 bool cleared;
194 GLenum target; 200 GLenum target;
195 GLint level; 201 GLint level;
196 GLenum internal_format; 202 GLenum internal_format;
197 GLsizei width; 203 GLsizei width;
198 GLsizei height; 204 GLsizei height;
199 GLsizei depth; 205 GLsizei depth;
200 GLint border; 206 GLint border;
201 GLenum format; 207 GLenum format;
202 GLenum type; 208 GLenum type;
209 scoped_refptr<gfx::GLImage> image;
203 uint32 estimated_size; 210 uint32 estimated_size;
204 }; 211 };
205 212
206 // Set the info for a particular level. 213 // Set the info for a particular level.
207 void SetLevelInfo( 214 void SetLevelInfo(
208 const FeatureInfo* feature_info, 215 const FeatureInfo* feature_info,
209 GLenum target, 216 GLenum target,
210 GLint level, 217 GLint level,
211 GLenum internal_format, 218 GLenum internal_format,
212 GLsizei width, 219 GLsizei width,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // Sets the TextureInfo's target 265 // Sets the TextureInfo's target
259 // Parameters: 266 // Parameters:
260 // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP or 267 // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP or
261 // GL_TEXTURE_EXTERNAL_OES or GL_TEXTURE_RECTANGLE_ARB 268 // GL_TEXTURE_EXTERNAL_OES or GL_TEXTURE_RECTANGLE_ARB
262 // max_levels: The maximum levels this type of target can have. 269 // max_levels: The maximum levels this type of target can have.
263 void SetTarget(GLenum target, GLint max_levels); 270 void SetTarget(GLenum target, GLint max_levels);
264 271
265 // Update info about this texture. 272 // Update info about this texture.
266 void Update(const FeatureInfo* feature_info); 273 void Update(const FeatureInfo* feature_info);
267 274
275 // Set the image for a particular level.
276 void SetLevelImage(
277 const FeatureInfo* feature_info,
278 GLenum target,
279 GLint level,
280 gfx::GLImage* image);
281
268 // Info about each face and level of texture. 282 // Info about each face and level of texture.
269 std::vector<std::vector<LevelInfo> > level_infos_; 283 std::vector<std::vector<LevelInfo> > level_infos_;
270 284
271 // The texture manager that manages this TextureInfo. 285 // The texture manager that manages this TextureInfo.
272 TextureManager* manager_; 286 TextureManager* manager_;
273 287
274 // The id of the texure 288 // The id of the texure
275 GLuint service_id_; 289 GLuint service_id_;
276 290
277 // Whether this texture has been deleted. 291 // Whether this texture has been deleted.
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 default: 497 default:
484 NOTREACHED(); 498 NOTREACHED();
485 return 0; 499 return 0;
486 } 500 }
487 } 501 }
488 502
489 uint32 mem_represented() const { 503 uint32 mem_represented() const {
490 return mem_represented_; 504 return mem_represented_;
491 } 505 }
492 506
507 void SetLevelImage(
508 TextureInfo* info,
509 GLenum target,
510 GLint level,
511 gfx::GLImage* image);
512
493 private: 513 private:
494 // Helper for Initialize(). 514 // Helper for Initialize().
495 TextureInfo::Ref CreateDefaultAndBlackTextures( 515 TextureInfo::Ref CreateDefaultAndBlackTextures(
496 GLenum target, 516 GLenum target,
497 GLuint* black_texture); 517 GLuint* black_texture);
498 518
499 void UpdateMemRepresented(); 519 void UpdateMemRepresented();
500 520
501 void StartTracking(TextureInfo* info); 521 void StartTracking(TextureInfo* info);
502 void StopTracking(TextureInfo* info); 522 void StopTracking(TextureInfo* info);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 // The default textures for each target (texture name = 0) 554 // The default textures for each target (texture name = 0)
535 TextureInfo::Ref default_textures_[kNumDefaultTextures]; 555 TextureInfo::Ref default_textures_[kNumDefaultTextures];
536 556
537 DISALLOW_COPY_AND_ASSIGN(TextureManager); 557 DISALLOW_COPY_AND_ASSIGN(TextureManager);
538 }; 558 };
539 559
540 } // namespace gles2 560 } // namespace gles2
541 } // namespace gpu 561 } // namespace gpu
542 562
543 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ 563 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/image_manager.cc ('k') | gpu/command_buffer/service/texture_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698