| 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 <algorithm> | 8 #include <algorithm> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 GLint level, | 224 GLint level, |
| 225 GLenum internal_format, | 225 GLenum internal_format, |
| 226 GLsizei width, | 226 GLsizei width, |
| 227 GLsizei height, | 227 GLsizei height, |
| 228 GLsizei depth, | 228 GLsizei depth, |
| 229 GLint border, | 229 GLint border, |
| 230 GLenum format, | 230 GLenum format, |
| 231 GLenum type, | 231 GLenum type, |
| 232 bool cleared); | 232 bool cleared); |
| 233 | 233 |
| 234 void SetCompressedLevelInfo(const FeatureInfo* feature_info, |
| 235 GLenum target, |
| 236 GLint level, |
| 237 GLenum internal_format, |
| 238 GLsizei width, |
| 239 GLsizei height, |
| 240 GLsizei depth, |
| 241 GLint border, |
| 242 GLsizei image_size, |
| 243 bool cleared); |
| 244 |
| 245 void UpdateLevelInfo(Texture::LevelInfo& info, |
| 246 const FeatureInfo* feature_info, |
| 247 GLint level, |
| 248 bool cleared); |
| 249 |
| 234 // In GLES2 "texture complete" means it has all required mips for filtering | 250 // In GLES2 "texture complete" means it has all required mips for filtering |
| 235 // down to a 1x1 pixel texture, they are in the correct order, they are all | 251 // down to a 1x1 pixel texture, they are in the correct order, they are all |
| 236 // the same format. | 252 // the same format. |
| 237 bool texture_complete() const { | 253 bool texture_complete() const { |
| 238 return texture_complete_; | 254 return texture_complete_; |
| 239 } | 255 } |
| 240 | 256 |
| 241 // In GLES2 "cube complete" means all 6 faces level 0 are defined, all the | 257 // In GLES2 "cube complete" means all 6 faces level 0 are defined, all the |
| 242 // same format, all the same dimensions and all width = height. | 258 // same format, all the same dimensions and all width = height. |
| 243 bool cube_complete() const { | 259 bool cube_complete() const { |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 GLint level, | 619 GLint level, |
| 604 GLenum internal_format, | 620 GLenum internal_format, |
| 605 GLsizei width, | 621 GLsizei width, |
| 606 GLsizei height, | 622 GLsizei height, |
| 607 GLsizei depth, | 623 GLsizei depth, |
| 608 GLint border, | 624 GLint border, |
| 609 GLenum format, | 625 GLenum format, |
| 610 GLenum type, | 626 GLenum type, |
| 611 bool cleared); | 627 bool cleared); |
| 612 | 628 |
| 629 void SetCompressedLevelInfo(TextureRef* ref, |
| 630 GLenum target, |
| 631 GLint level, |
| 632 GLenum internal_format, |
| 633 GLsizei width, |
| 634 GLsizei height, |
| 635 GLsizei depth, |
| 636 GLint border, |
| 637 GLsizei image_size, |
| 638 bool cleared); |
| 639 |
| 613 // Adapter to call above function. | 640 // Adapter to call above function. |
| 614 void SetLevelInfoFromParams(TextureRef* ref, | 641 void SetLevelInfoFromParams(TextureRef* ref, |
| 615 const gpu::AsyncTexImage2DParams& params) { | 642 const gpu::AsyncTexImage2DParams& params) { |
| 616 SetLevelInfo( | 643 SetLevelInfo( |
| 617 ref, params.target, params.level, params.internal_format, | 644 ref, params.target, params.level, params.internal_format, |
| 618 params.width, params.height, 1 /* depth */, | 645 params.width, params.height, 1 /* depth */, |
| 619 params.border, params.format, | 646 params.border, params.format, |
| 620 params.type, true /* cleared */); | 647 params.type, true /* cleared */); |
| 621 } | 648 } |
| 622 | 649 |
| 650 void SetCompressedLevelInfoFromParams( |
| 651 TextureRef* ref, |
| 652 const gpu::AsyncCompressedTexImage2DParams& params) { |
| 653 SetCompressedLevelInfo(ref, params.target, params.level, |
| 654 params.internal_format, params.width, params.height, |
| 655 1 /* depth */, params.border, params.image_size, |
| 656 true /* cleared */); |
| 657 } |
| 658 |
| 623 Texture* Produce(TextureRef* ref); | 659 Texture* Produce(TextureRef* ref); |
| 624 | 660 |
| 625 // Maps an existing texture into the texture manager, at a given client ID. | 661 // Maps an existing texture into the texture manager, at a given client ID. |
| 626 TextureRef* Consume(GLuint client_id, Texture* texture); | 662 TextureRef* Consume(GLuint client_id, Texture* texture); |
| 627 | 663 |
| 628 // Sets a mip as cleared. | 664 // Sets a mip as cleared. |
| 629 void SetLevelCleared(TextureRef* ref, GLenum target, | 665 void SetLevelCleared(TextureRef* ref, GLenum target, |
| 630 GLint level, bool cleared); | 666 GLint level, bool cleared); |
| 631 | 667 |
| 632 // Sets a texture parameter of a Texture | 668 // Sets a texture parameter of a Texture |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 // Pointer to TextureRef filled in if validation successful. | 802 // Pointer to TextureRef filled in if validation successful. |
| 767 // Presumes the pointer is valid. | 803 // Presumes the pointer is valid. |
| 768 TextureRef** texture_ref); | 804 TextureRef** texture_ref); |
| 769 | 805 |
| 770 void ValidateAndDoTexImage2D( | 806 void ValidateAndDoTexImage2D( |
| 771 DecoderTextureState* texture_state, | 807 DecoderTextureState* texture_state, |
| 772 ContextState* state, | 808 ContextState* state, |
| 773 DecoderFramebufferState* framebuffer_state, | 809 DecoderFramebufferState* framebuffer_state, |
| 774 const DoTextImage2DArguments& args); | 810 const DoTextImage2DArguments& args); |
| 775 | 811 |
| 812 struct DoCompressedTexImage2DArguments { |
| 813 GLenum target; |
| 814 GLint level; |
| 815 GLenum internal_format; |
| 816 GLsizei width; |
| 817 GLsizei height; |
| 818 GLint border; |
| 819 GLsizei image_size; |
| 820 const void* pixels; |
| 821 }; |
| 822 |
| 823 bool ValidateCompressedTexImage2D( |
| 824 ContextState* state, |
| 825 const char* function_name, |
| 826 const DoCompressedTexImage2DArguments& args, |
| 827 // Pointer to TextureRef filled in if validation successful. |
| 828 // Presumes the pointer is valid. |
| 829 TextureRef** texture_ref); |
| 830 |
| 776 // TODO(kloveless): Make GetTexture* private once this is no longer called | 831 // TODO(kloveless): Make GetTexture* private once this is no longer called |
| 777 // from gles2_cmd_decoder. | 832 // from gles2_cmd_decoder. |
| 778 TextureRef* GetTextureInfoForTarget(ContextState* state, GLenum target); | 833 TextureRef* GetTextureInfoForTarget(ContextState* state, GLenum target); |
| 779 TextureRef* GetTextureInfoForTargetUnlessDefault( | 834 TextureRef* GetTextureInfoForTargetUnlessDefault( |
| 780 ContextState* state, GLenum target); | 835 ContextState* state, GLenum target); |
| 781 | 836 |
| 782 bool ValidateFormatAndTypeCombination( | 837 bool ValidateFormatAndTypeCombination( |
| 783 ErrorState* error_state, const char* function_name, | 838 ErrorState* error_state, const char* function_name, |
| 784 GLenum format, GLenum type); | 839 GLenum format, GLenum type); |
| 785 | 840 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 private: | 924 private: |
| 870 DecoderTextureState* texture_state_; | 925 DecoderTextureState* texture_state_; |
| 871 base::TimeTicks begin_time_; | 926 base::TimeTicks begin_time_; |
| 872 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 927 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
| 873 }; | 928 }; |
| 874 | 929 |
| 875 } // namespace gles2 | 930 } // namespace gles2 |
| 876 } // namespace gpu | 931 } // namespace gpu |
| 877 | 932 |
| 878 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 933 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| OLD | NEW |