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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 GLenum target; | 285 GLenum target; |
272 GLint level; | 286 GLint level; |
273 GLenum internal_format; | 287 GLenum internal_format; |
274 GLsizei width; | 288 GLsizei width; |
275 GLsizei height; | 289 GLsizei height; |
276 GLsizei depth; | 290 GLsizei depth; |
277 GLint border; | 291 GLint border; |
278 GLenum format; | 292 GLenum format; |
279 GLenum type; | 293 GLenum type; |
280 scoped_refptr<gl::GLImage> image; | 294 scoped_refptr<gl::GLImage> image; |
| 295 scoped_refptr<GLStreamTextureImage> stream_texture_image; |
281 ImageState image_state; | 296 ImageState image_state; |
282 uint32_t estimated_size; | 297 uint32_t estimated_size; |
283 bool internal_workaround; | 298 bool internal_workaround; |
284 }; | 299 }; |
285 | 300 |
286 struct FaceInfo { | 301 struct FaceInfo { |
287 FaceInfo(); | 302 FaceInfo(); |
288 ~FaceInfo(); | 303 ~FaceInfo(); |
289 | 304 |
290 // This is relative to base_level and max_level of a texture. | 305 // This is relative to base_level and max_level of a texture. |
291 GLsizei num_mip_levels; | 306 GLsizei num_mip_levels; |
292 // This contains slots for all levels starting at 0. | 307 // This contains slots for all levels starting at 0. |
293 std::vector<LevelInfo> level_infos; | 308 std::vector<LevelInfo> level_infos; |
294 }; | 309 }; |
295 | 310 |
| 311 // Helper for SetLevel*Image. |stream_texture_image| may be null. |
| 312 void SetLevelImageInternal(GLenum target, |
| 313 GLint level, |
| 314 gl::GLImage* image, |
| 315 GLStreamTextureImage* stream_texture_image, |
| 316 ImageState state); |
| 317 |
| 318 // Helper for GetLevel*Image. Returns the LevelInfo for |target| and |level| |
| 319 // if it's set, else NULL. |
| 320 const LevelInfo* GetLevelInfo(GLint target, GLint level) const; |
| 321 |
296 // Set the info for a particular level. | 322 // Set the info for a particular level. |
297 void SetLevelInfo(GLenum target, | 323 void SetLevelInfo(GLenum target, |
298 GLint level, | 324 GLint level, |
299 GLenum internal_format, | 325 GLenum internal_format, |
300 GLsizei width, | 326 GLsizei width, |
301 GLsizei height, | 327 GLsizei height, |
302 GLsizei depth, | 328 GLsizei depth, |
303 GLint border, | 329 GLint border, |
304 GLenum format, | 330 GLenum format, |
305 GLenum type, | 331 GLenum type, |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 size_t mem_represented() const { | 872 size_t mem_represented() const { |
847 return memory_type_tracker_->GetMemRepresented(); | 873 return memory_type_tracker_->GetMemRepresented(); |
848 } | 874 } |
849 | 875 |
850 void SetLevelImage(TextureRef* ref, | 876 void SetLevelImage(TextureRef* ref, |
851 GLenum target, | 877 GLenum target, |
852 GLint level, | 878 GLint level, |
853 gl::GLImage* image, | 879 gl::GLImage* image, |
854 Texture::ImageState state); | 880 Texture::ImageState state); |
855 | 881 |
| 882 void SetLevelStreamTextureImage(TextureRef* ref, |
| 883 GLenum target, |
| 884 GLint level, |
| 885 GLStreamTextureImage* image, |
| 886 Texture::ImageState state); |
| 887 |
856 size_t GetSignatureSize() const; | 888 size_t GetSignatureSize() const; |
857 | 889 |
858 void AddToSignature( | 890 void AddToSignature( |
859 TextureRef* ref, | 891 TextureRef* ref, |
860 GLenum target, | 892 GLenum target, |
861 GLint level, | 893 GLint level, |
862 std::string* signature) const; | 894 std::string* signature) const; |
863 | 895 |
864 void AddObserver(DestructionObserver* observer) { | 896 void AddObserver(DestructionObserver* observer) { |
865 destruction_observers_.push_back(observer); | 897 destruction_observers_.push_back(observer); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 private: | 1097 private: |
1066 DecoderTextureState* texture_state_; | 1098 DecoderTextureState* texture_state_; |
1067 base::TimeTicks begin_time_; | 1099 base::TimeTicks begin_time_; |
1068 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 1100 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
1069 }; | 1101 }; |
1070 | 1102 |
1071 } // namespace gles2 | 1103 } // namespace gles2 |
1072 } // namespace gpu | 1104 } // namespace gpu |
1073 | 1105 |
1074 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 1106 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
OLD | NEW |