| 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> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "gpu/command_buffer/service/memory_tracking.h" | 21 #include "gpu/command_buffer/service/memory_tracking.h" |
| 22 #include "gpu/command_buffer/service/sampler_manager.h" | 22 #include "gpu/command_buffer/service/sampler_manager.h" |
| 23 #include "gpu/gpu_export.h" | 23 #include "gpu/gpu_export.h" |
| 24 #include "ui/gfx/geometry/rect.h" | 24 #include "ui/gfx/geometry/rect.h" |
| 25 #include "ui/gl/gl_image.h" | 25 #include "ui/gl/gl_image.h" |
| 26 | 26 |
| 27 namespace gpu { | 27 namespace gpu { |
| 28 namespace gles2 { | 28 namespace gles2 { |
| 29 | 29 |
| 30 class GLES2Decoder; | 30 class GLES2Decoder; |
| 31 class GLStreamTextureImage; |
| 31 struct ContextState; | 32 struct ContextState; |
| 32 struct DecoderFramebufferState; | 33 struct DecoderFramebufferState; |
| 33 class Display; | 34 class Display; |
| 34 class ErrorState; | 35 class ErrorState; |
| 35 class FeatureInfo; | 36 class FeatureInfo; |
| 36 class FramebufferManager; | 37 class FramebufferManager; |
| 37 class MailboxManager; | 38 class MailboxManager; |
| 38 class TextureManager; | 39 class TextureManager; |
| 39 class TextureRef; | 40 class TextureRef; |
| 40 | 41 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // Get the type of a level. Returns false if level does not exist. | 161 // Get the type of a level. Returns false if level does not exist. |
| 161 bool GetLevelType( | 162 bool GetLevelType( |
| 162 GLint target, GLint level, GLenum* type, GLenum* internal_format) const; | 163 GLint target, GLint level, GLenum* type, GLenum* internal_format) const; |
| 163 | 164 |
| 164 // Set the image for a particular level. | 165 // Set the image for a particular level. |
| 165 void SetLevelImage(GLenum target, | 166 void SetLevelImage(GLenum target, |
| 166 GLint level, | 167 GLint level, |
| 167 gl::GLImage* image, | 168 gl::GLImage* image, |
| 168 ImageState state); | 169 ImageState state); |
| 169 | 170 |
| 171 // Set the GLStreamTextureImage for a particular level. This is identical |
| 172 // to SetLevelImage, but it also permits GetLevelStreamTextureImage to return |
| 173 // the image. |
| 174 void SetLevelStreamTextureImage(GLenum target, |
| 175 GLint level, |
| 176 GLStreamTextureImage* image, |
| 177 ImageState state); |
| 178 |
| 170 // Get the image associated with a particular level. Returns NULL if level | 179 // Get the image associated with a particular level. Returns NULL if level |
| 171 // does not exist. | 180 // does not exist. |
| 172 gl::GLImage* GetLevelImage(GLint target, | 181 gl::GLImage* GetLevelImage(GLint target, |
| 173 GLint level, | 182 GLint level, |
| 174 ImageState* state) const; | 183 ImageState* state) const; |
| 175 gl::GLImage* GetLevelImage(GLint target, GLint level) const; | 184 gl::GLImage* GetLevelImage(GLint target, GLint level) const; |
| 176 | 185 |
| 186 // Like GetLevelImage, but will return NULL if the image wasn't set via |
| 187 // a call to SetLevelStreamTextureImage. |
| 188 GLStreamTextureImage* GetLevelStreamTextureImage(GLint target, |
| 189 GLint level) const; |
| 190 |
| 177 bool HasImages() const { | 191 bool HasImages() const { |
| 178 return has_images_; | 192 return has_images_; |
| 179 } | 193 } |
| 180 | 194 |
| 181 // Returns true of the given dimensions are inside the dimensions of the | 195 // Returns true of the given dimensions are inside the dimensions of the |
| 182 // level. | 196 // level. |
| 183 bool ValidForTexture( | 197 bool ValidForTexture( |
| 184 GLint target, | 198 GLint target, |
| 185 GLint level, | 199 GLint level, |
| 186 GLint xoffset, | 200 GLint xoffset, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 GLenum target; | 283 GLenum target; |
| 270 GLint level; | 284 GLint level; |
| 271 GLenum internal_format; | 285 GLenum internal_format; |
| 272 GLsizei width; | 286 GLsizei width; |
| 273 GLsizei height; | 287 GLsizei height; |
| 274 GLsizei depth; | 288 GLsizei depth; |
| 275 GLint border; | 289 GLint border; |
| 276 GLenum format; | 290 GLenum format; |
| 277 GLenum type; | 291 GLenum type; |
| 278 scoped_refptr<gl::GLImage> image; | 292 scoped_refptr<gl::GLImage> image; |
| 293 scoped_refptr<GLStreamTextureImage> stream_texture_image; |
| 279 ImageState image_state; | 294 ImageState image_state; |
| 280 uint32_t estimated_size; | 295 uint32_t estimated_size; |
| 281 bool internal_workaround; | 296 bool internal_workaround; |
| 282 }; | 297 }; |
| 283 | 298 |
| 284 struct FaceInfo { | 299 struct FaceInfo { |
| 285 FaceInfo(); | 300 FaceInfo(); |
| 286 ~FaceInfo(); | 301 ~FaceInfo(); |
| 287 | 302 |
| 288 // This is relative to base_level and max_level of a texture. | 303 // This is relative to base_level and max_level of a texture. |
| 289 GLsizei num_mip_levels; | 304 GLsizei num_mip_levels; |
| 290 // This contains slots for all levels starting at 0. | 305 // This contains slots for all levels starting at 0. |
| 291 std::vector<LevelInfo> level_infos; | 306 std::vector<LevelInfo> level_infos; |
| 292 }; | 307 }; |
| 293 | 308 |
| 309 // Helper for SetLevel*Image. |stream_texture_image| may be null. |
| 310 void SetLevelImageInternal(GLenum target, |
| 311 GLint level, |
| 312 gl::GLImage* image, |
| 313 GLStreamTextureImage* stream_texture_image, |
| 314 ImageState state); |
| 315 |
| 316 // Helper for GetLevel*Image. Returns the LevelInfo for |target| and |level| |
| 317 // if it's set, else NULL. |
| 318 const LevelInfo* GetLevelInfo(GLint target, GLint level) const; |
| 319 |
| 294 // Set the info for a particular level. | 320 // Set the info for a particular level. |
| 295 void SetLevelInfo(GLenum target, | 321 void SetLevelInfo(GLenum target, |
| 296 GLint level, | 322 GLint level, |
| 297 GLenum internal_format, | 323 GLenum internal_format, |
| 298 GLsizei width, | 324 GLsizei width, |
| 299 GLsizei height, | 325 GLsizei height, |
| 300 GLsizei depth, | 326 GLsizei depth, |
| 301 GLint border, | 327 GLint border, |
| 302 GLenum format, | 328 GLenum format, |
| 303 GLenum type, | 329 GLenum type, |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 size_t mem_represented() const { | 870 size_t mem_represented() const { |
| 845 return memory_type_tracker_->GetMemRepresented(); | 871 return memory_type_tracker_->GetMemRepresented(); |
| 846 } | 872 } |
| 847 | 873 |
| 848 void SetLevelImage(TextureRef* ref, | 874 void SetLevelImage(TextureRef* ref, |
| 849 GLenum target, | 875 GLenum target, |
| 850 GLint level, | 876 GLint level, |
| 851 gl::GLImage* image, | 877 gl::GLImage* image, |
| 852 Texture::ImageState state); | 878 Texture::ImageState state); |
| 853 | 879 |
| 880 void SetLevelStreamTextureImage(TextureRef* ref, |
| 881 GLenum target, |
| 882 GLint level, |
| 883 GLStreamTextureImage* image, |
| 884 Texture::ImageState state); |
| 885 |
| 854 size_t GetSignatureSize() const; | 886 size_t GetSignatureSize() const; |
| 855 | 887 |
| 856 void AddToSignature( | 888 void AddToSignature( |
| 857 TextureRef* ref, | 889 TextureRef* ref, |
| 858 GLenum target, | 890 GLenum target, |
| 859 GLint level, | 891 GLint level, |
| 860 std::string* signature) const; | 892 std::string* signature) const; |
| 861 | 893 |
| 862 void AddObserver(DestructionObserver* observer) { | 894 void AddObserver(DestructionObserver* observer) { |
| 863 destruction_observers_.push_back(observer); | 895 destruction_observers_.push_back(observer); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 private: | 1095 private: |
| 1064 DecoderTextureState* texture_state_; | 1096 DecoderTextureState* texture_state_; |
| 1065 base::TimeTicks begin_time_; | 1097 base::TimeTicks begin_time_; |
| 1066 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 1098 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
| 1067 }; | 1099 }; |
| 1068 | 1100 |
| 1069 } // namespace gles2 | 1101 } // namespace gles2 |
| 1070 } // namespace gpu | 1102 } // namespace gpu |
| 1071 | 1103 |
| 1072 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 1104 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| OLD | NEW |