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