| 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 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 // Presumes the pointer is valid. | 863 // Presumes the pointer is valid. |
| 864 TextureRef** texture_ref); | 864 TextureRef** texture_ref); |
| 865 | 865 |
| 866 void ValidateAndDoTexImage( | 866 void ValidateAndDoTexImage( |
| 867 DecoderTextureState* texture_state, | 867 DecoderTextureState* texture_state, |
| 868 ContextState* state, | 868 ContextState* state, |
| 869 DecoderFramebufferState* framebuffer_state, | 869 DecoderFramebufferState* framebuffer_state, |
| 870 const char* function_name, | 870 const char* function_name, |
| 871 const DoTexImageArguments& args); | 871 const DoTexImageArguments& args); |
| 872 | 872 |
| 873 struct DoTexSubImageArguments { | |
| 874 GLenum target; | |
| 875 GLint level; | |
| 876 GLint xoffset; | |
| 877 GLint yoffset; | |
| 878 GLsizei width; | |
| 879 GLsizei height; | |
| 880 GLenum format; | |
| 881 GLenum type; | |
| 882 const void* pixels; | |
| 883 uint32 pixels_size; | |
| 884 // TODO(kkinnunen): currently this is used only for TexSubImage2D. | |
| 885 }; | |
| 886 | |
| 887 bool ValidateTexSubImage( | |
| 888 ContextState* state, | |
| 889 const char* function_name, | |
| 890 const DoTexSubImageArguments& args, | |
| 891 // Pointer to TextureRef filled in if validation successful. | |
| 892 // Presumes the pointer is valid. | |
| 893 TextureRef** texture_ref); | |
| 894 | |
| 895 void ValidateAndDoTexSubImage(GLES2Decoder* decoder, | |
| 896 DecoderTextureState* texture_state, | |
| 897 ContextState* state, | |
| 898 DecoderFramebufferState* framebuffer_state, | |
| 899 const char* function_name, | |
| 900 const DoTexSubImageArguments& args); | |
| 901 | |
| 902 // TODO(kloveless): Make GetTexture* private once this is no longer called | 873 // TODO(kloveless): Make GetTexture* private once this is no longer called |
| 903 // from gles2_cmd_decoder. | 874 // from gles2_cmd_decoder. |
| 904 TextureRef* GetTextureInfoForTarget(ContextState* state, GLenum target); | 875 TextureRef* GetTextureInfoForTarget(ContextState* state, GLenum target); |
| 905 TextureRef* GetTextureInfoForTargetUnlessDefault( | 876 TextureRef* GetTextureInfoForTargetUnlessDefault( |
| 906 ContextState* state, GLenum target); | 877 ContextState* state, GLenum target); |
| 907 | 878 |
| 908 // Note that internal_format is only checked in relation to the format | 879 // Note that internal_format is only checked in relation to the format |
| 909 // parameter, so that this function may be used to validate texSubImage2D. | 880 // parameter, so that this function may be used to validate texSubImage2D. |
| 910 bool ValidateTextureParameters( | 881 bool ValidateTextureParameters( |
| 911 ErrorState* error_state, const char* function_name, | 882 ErrorState* error_state, const char* function_name, |
| 912 GLenum format, GLenum type, GLenum internal_format, GLint level); | 883 GLenum format, GLenum type, GLenum internal_format, GLint level); |
| 913 | 884 |
| 914 // base::trace_event::MemoryDumpProvider implementation. | 885 // base::trace_event::MemoryDumpProvider implementation. |
| 915 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 886 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
| 916 base::trace_event::ProcessMemoryDump* pmd) override; | 887 base::trace_event::ProcessMemoryDump* pmd) override; |
| 917 | 888 |
| 918 // Returns the union of |rect1| and |rect2| if one of the rectangles is empty, | |
| 919 // contains the other rectangle or shares an edge with the other rectangle. | |
| 920 // Part of the public interface because texture pixel data rectangle | |
| 921 // operations are also implemented in decoder at the moment. | |
| 922 static bool CombineAdjacentRects(const gfx::Rect& rect1, | |
| 923 const gfx::Rect& rect2, | |
| 924 gfx::Rect* result); | |
| 925 | |
| 926 private: | 889 private: |
| 927 friend class Texture; | 890 friend class Texture; |
| 928 friend class TextureRef; | 891 friend class TextureRef; |
| 929 | 892 |
| 930 // Helper for Initialize(). | 893 // Helper for Initialize(). |
| 931 scoped_refptr<TextureRef> CreateDefaultAndBlackTextures( | 894 scoped_refptr<TextureRef> CreateDefaultAndBlackTextures( |
| 932 GLenum target, | 895 GLenum target, |
| 933 GLuint* black_texture); | 896 GLuint* black_texture); |
| 934 | 897 |
| 935 void DoTexImage( | 898 void DoTexImage( |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 private: | 974 private: |
| 1012 DecoderTextureState* texture_state_; | 975 DecoderTextureState* texture_state_; |
| 1013 base::TimeTicks begin_time_; | 976 base::TimeTicks begin_time_; |
| 1014 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 977 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
| 1015 }; | 978 }; |
| 1016 | 979 |
| 1017 } // namespace gles2 | 980 } // namespace gles2 |
| 1018 } // namespace gpu | 981 } // namespace gpu |
| 1019 | 982 |
| 1020 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 983 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| OLD | NEW |