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 <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <algorithm> | 11 #include <algorithm> |
9 #include <list> | 12 #include <list> |
10 #include <set> | 13 #include <set> |
11 #include <string> | 14 #include <string> |
12 #include <vector> | 15 #include <vector> |
13 #include "base/basictypes.h" | |
14 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
| 17 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
16 #include "gpu/command_buffer/service/feature_info.h" | 19 #include "gpu/command_buffer/service/feature_info.h" |
17 #include "gpu/command_buffer/service/gl_utils.h" | 20 #include "gpu/command_buffer/service/gl_utils.h" |
18 #include "gpu/command_buffer/service/memory_tracking.h" | 21 #include "gpu/command_buffer/service/memory_tracking.h" |
19 #include "gpu/gpu_export.h" | 22 #include "gpu/gpu_export.h" |
20 #include "ui/gfx/geometry/rect.h" | 23 #include "ui/gfx/geometry/rect.h" |
21 #include "ui/gl/gl_image.h" | 24 #include "ui/gl/gl_image.h" |
22 | 25 |
23 namespace gpu { | 26 namespace gpu { |
24 namespace gles2 { | 27 namespace gles2 { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 105 } |
103 | 106 |
104 GLint max_level() const { | 107 GLint max_level() const { |
105 return max_level_; | 108 return max_level_; |
106 } | 109 } |
107 | 110 |
108 int num_uncleared_mips() const { | 111 int num_uncleared_mips() const { |
109 return num_uncleared_mips_; | 112 return num_uncleared_mips_; |
110 } | 113 } |
111 | 114 |
112 uint32 estimated_size() const { | 115 uint32_t estimated_size() const { return estimated_size_; } |
113 return estimated_size_; | |
114 } | |
115 | 116 |
116 bool CanRenderTo() const { | 117 bool CanRenderTo() const { |
117 return target_ != GL_TEXTURE_EXTERNAL_OES; | 118 return target_ != GL_TEXTURE_EXTERNAL_OES; |
118 } | 119 } |
119 | 120 |
120 // The service side OpenGL id of the texture. | 121 // The service side OpenGL id of the texture. |
121 GLuint service_id() const { | 122 GLuint service_id() const { |
122 return service_id_; | 123 return service_id_; |
123 } | 124 } |
124 | 125 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 GLint level; | 259 GLint level; |
259 GLenum internal_format; | 260 GLenum internal_format; |
260 GLsizei width; | 261 GLsizei width; |
261 GLsizei height; | 262 GLsizei height; |
262 GLsizei depth; | 263 GLsizei depth; |
263 GLint border; | 264 GLint border; |
264 GLenum format; | 265 GLenum format; |
265 GLenum type; | 266 GLenum type; |
266 scoped_refptr<gl::GLImage> image; | 267 scoped_refptr<gl::GLImage> image; |
267 ImageState image_state; | 268 ImageState image_state; |
268 uint32 estimated_size; | 269 uint32_t estimated_size; |
269 }; | 270 }; |
270 | 271 |
271 struct FaceInfo { | 272 struct FaceInfo { |
272 FaceInfo(); | 273 FaceInfo(); |
273 ~FaceInfo(); | 274 ~FaceInfo(); |
274 | 275 |
275 // This is relative to base_level and max_level of a texture. | 276 // This is relative to base_level and max_level of a texture. |
276 GLsizei num_mip_levels; | 277 GLsizei num_mip_levels; |
277 // This contains slots for all levels starting at 0. | 278 // This contains slots for all levels starting at 0. |
278 std::vector<LevelInfo> level_infos; | 279 std::vector<LevelInfo> level_infos; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 int framebuffer_attachment_count_; | 491 int framebuffer_attachment_count_; |
491 | 492 |
492 // Whether the texture is immutable and no further changes to the format | 493 // Whether the texture is immutable and no further changes to the format |
493 // or dimensions of the texture object can be made. | 494 // or dimensions of the texture object can be made. |
494 bool immutable_; | 495 bool immutable_; |
495 | 496 |
496 // Whether or not this texture has images. | 497 // Whether or not this texture has images. |
497 bool has_images_; | 498 bool has_images_; |
498 | 499 |
499 // Size in bytes this texture is assumed to take in memory. | 500 // Size in bytes this texture is assumed to take in memory. |
500 uint32 estimated_size_; | 501 uint32_t estimated_size_; |
501 | 502 |
502 // Cache of the computed CanRenderCondition flag. | 503 // Cache of the computed CanRenderCondition flag. |
503 CanRenderCondition can_render_condition_; | 504 CanRenderCondition can_render_condition_; |
504 | 505 |
505 // Whether we have initialized TEXTURE_MAX_ANISOTROPY to 1. | 506 // Whether we have initialized TEXTURE_MAX_ANISOTROPY to 1. |
506 bool texture_max_anisotropy_initialized_; | 507 bool texture_max_anisotropy_initialized_; |
507 | 508 |
508 DISALLOW_COPY_AND_ASSIGN(Texture); | 509 DISALLOW_COPY_AND_ASSIGN(Texture); |
509 }; | 510 }; |
510 | 511 |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 GLenum target; | 853 GLenum target; |
853 GLint level; | 854 GLint level; |
854 GLenum internal_format; | 855 GLenum internal_format; |
855 GLsizei width; | 856 GLsizei width; |
856 GLsizei height; | 857 GLsizei height; |
857 GLsizei depth; | 858 GLsizei depth; |
858 GLint border; | 859 GLint border; |
859 GLenum format; | 860 GLenum format; |
860 GLenum type; | 861 GLenum type; |
861 const void* pixels; | 862 const void* pixels; |
862 uint32 pixels_size; | 863 uint32_t pixels_size; |
863 TexImageCommandType command_type; | 864 TexImageCommandType command_type; |
864 }; | 865 }; |
865 | 866 |
866 bool ValidateTexImage( | 867 bool ValidateTexImage( |
867 ContextState* state, | 868 ContextState* state, |
868 const char* function_name, | 869 const char* function_name, |
869 const DoTexImageArguments& args, | 870 const DoTexImageArguments& args, |
870 // Pointer to TextureRef filled in if validation successful. | 871 // Pointer to TextureRef filled in if validation successful. |
871 // Presumes the pointer is valid. | 872 // Presumes the pointer is valid. |
872 TextureRef** texture_ref); | 873 TextureRef** texture_ref); |
873 | 874 |
874 void ValidateAndDoTexImage( | 875 void ValidateAndDoTexImage( |
875 DecoderTextureState* texture_state, | 876 DecoderTextureState* texture_state, |
876 ContextState* state, | 877 ContextState* state, |
877 DecoderFramebufferState* framebuffer_state, | 878 DecoderFramebufferState* framebuffer_state, |
878 const char* function_name, | 879 const char* function_name, |
879 const DoTexImageArguments& args); | 880 const DoTexImageArguments& args); |
880 | 881 |
881 struct DoTexSubImageArguments { | 882 struct DoTexSubImageArguments { |
882 GLenum target; | 883 GLenum target; |
883 GLint level; | 884 GLint level; |
884 GLint xoffset; | 885 GLint xoffset; |
885 GLint yoffset; | 886 GLint yoffset; |
886 GLsizei width; | 887 GLsizei width; |
887 GLsizei height; | 888 GLsizei height; |
888 GLenum format; | 889 GLenum format; |
889 GLenum type; | 890 GLenum type; |
890 const void* pixels; | 891 const void* pixels; |
891 uint32 pixels_size; | 892 uint32_t pixels_size; |
892 // TODO(kkinnunen): currently this is used only for TexSubImage2D. | 893 // TODO(kkinnunen): currently this is used only for TexSubImage2D. |
893 }; | 894 }; |
894 | 895 |
895 bool ValidateTexSubImage( | 896 bool ValidateTexSubImage( |
896 ContextState* state, | 897 ContextState* state, |
897 const char* function_name, | 898 const char* function_name, |
898 const DoTexSubImageArguments& args, | 899 const DoTexSubImageArguments& args, |
899 // Pointer to TextureRef filled in if validation successful. | 900 // Pointer to TextureRef filled in if validation successful. |
900 // Presumes the pointer is valid. | 901 // Presumes the pointer is valid. |
901 TextureRef** texture_ref); | 902 TextureRef** texture_ref); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 private: | 1020 private: |
1020 DecoderTextureState* texture_state_; | 1021 DecoderTextureState* texture_state_; |
1021 base::TimeTicks begin_time_; | 1022 base::TimeTicks begin_time_; |
1022 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 1023 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
1023 }; | 1024 }; |
1024 | 1025 |
1025 } // namespace gles2 | 1026 } // namespace gles2 |
1026 } // namespace gpu | 1027 } // namespace gpu |
1027 | 1028 |
1028 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 1029 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
OLD | NEW |