OLD | NEW |
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" |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 GLsizei width, GLsizei height, GLsizei depth); | 381 GLsizei width, GLsizei height, GLsizei depth); |
382 | 382 |
383 // Checks if a dimensions are valid for a given target. | 383 // Checks if a dimensions are valid for a given target. |
384 bool ValidForTarget( | 384 bool ValidForTarget( |
385 GLenum target, GLint level, | 385 GLenum target, GLint level, |
386 GLsizei width, GLsizei height, GLsizei depth); | 386 GLsizei width, GLsizei height, GLsizei depth); |
387 | 387 |
388 // True if this texture meets all the GLES2 criteria for rendering. | 388 // True if this texture meets all the GLES2 criteria for rendering. |
389 // See section 3.8.2 of the GLES2 spec. | 389 // See section 3.8.2 of the GLES2 spec. |
390 bool CanRender(const TextureInfo* texture) const { | 390 bool CanRender(const TextureInfo* texture) const { |
391 return texture->CanRender(feature_info_); | 391 return texture->CanRender(feature_info_.get()); |
392 } | 392 } |
393 | 393 |
394 // Returns true if mipmaps can be generated by GL. | 394 // Returns true if mipmaps can be generated by GL. |
395 bool CanGenerateMipmaps(const TextureInfo* texture) const { | 395 bool CanGenerateMipmaps(const TextureInfo* texture) const { |
396 return texture->CanGenerateMipmaps(feature_info_); | 396 return texture->CanGenerateMipmaps(feature_info_.get()); |
397 } | 397 } |
398 | 398 |
399 // Sets the TextureInfo's target | 399 // Sets the TextureInfo's target |
400 // Parameters: | 400 // Parameters: |
401 // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP | 401 // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP |
402 // max_levels: The maximum levels this type of target can have. | 402 // max_levels: The maximum levels this type of target can have. |
403 void SetInfoTarget( | 403 void SetInfoTarget( |
404 TextureInfo* info, | 404 TextureInfo* info, |
405 GLenum target); | 405 GLenum target); |
406 | 406 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 | 452 |
453 // Removes a texture info. | 453 // Removes a texture info. |
454 void RemoveTextureInfo(GLuint client_id); | 454 void RemoveTextureInfo(GLuint client_id); |
455 | 455 |
456 // Gets a client id for a given service id. | 456 // Gets a client id for a given service id. |
457 bool GetClientId(GLuint service_id, GLuint* client_id) const; | 457 bool GetClientId(GLuint service_id, GLuint* client_id) const; |
458 | 458 |
459 TextureInfo* GetDefaultTextureInfo(GLenum target) { | 459 TextureInfo* GetDefaultTextureInfo(GLenum target) { |
460 switch (target) { | 460 switch (target) { |
461 case GL_TEXTURE_2D: | 461 case GL_TEXTURE_2D: |
462 return default_textures_[kTexture2D]; | 462 return default_textures_[kTexture2D].get(); |
463 case GL_TEXTURE_CUBE_MAP: | 463 case GL_TEXTURE_CUBE_MAP: |
464 return default_textures_[kCubeMap]; | 464 return default_textures_[kCubeMap].get(); |
465 case GL_TEXTURE_EXTERNAL_OES: | 465 case GL_TEXTURE_EXTERNAL_OES: |
466 return default_textures_[kExternalOES]; | 466 return default_textures_[kExternalOES].get(); |
467 case GL_TEXTURE_RECTANGLE_ARB: | 467 case GL_TEXTURE_RECTANGLE_ARB: |
468 return default_textures_[kRectangleARB]; | 468 return default_textures_[kRectangleARB].get(); |
469 default: | 469 default: |
470 NOTREACHED(); | 470 NOTREACHED(); |
471 return NULL; | 471 return NULL; |
472 } | 472 } |
473 } | 473 } |
474 | 474 |
475 bool HaveUnrenderableTextures() const { | 475 bool HaveUnrenderableTextures() const { |
476 return num_unrenderable_textures_ > 0; | 476 return num_unrenderable_textures_ > 0; |
477 } | 477 } |
478 | 478 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 // The default textures for each target (texture name = 0) | 554 // The default textures for each target (texture name = 0) |
555 TextureInfo::Ref default_textures_[kNumDefaultTextures]; | 555 TextureInfo::Ref default_textures_[kNumDefaultTextures]; |
556 | 556 |
557 DISALLOW_COPY_AND_ASSIGN(TextureManager); | 557 DISALLOW_COPY_AND_ASSIGN(TextureManager); |
558 }; | 558 }; |
559 | 559 |
560 } // namespace gles2 | 560 } // namespace gles2 |
561 } // namespace gpu | 561 } // namespace gpu |
562 | 562 |
563 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 563 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
OLD | NEW |