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 30 matching lines...) Expand all Loading... |
41 explicit Texture(GLuint service_id); | 41 explicit Texture(GLuint service_id); |
42 | 42 |
43 GLenum min_filter() const { | 43 GLenum min_filter() const { |
44 return min_filter_; | 44 return min_filter_; |
45 } | 45 } |
46 | 46 |
47 GLenum mag_filter() const { | 47 GLenum mag_filter() const { |
48 return mag_filter_; | 48 return mag_filter_; |
49 } | 49 } |
50 | 50 |
| 51 GLenum wrap_r() const { |
| 52 return wrap_r_; |
| 53 } |
| 54 |
51 GLenum wrap_s() const { | 55 GLenum wrap_s() const { |
52 return wrap_s_; | 56 return wrap_s_; |
53 } | 57 } |
54 | 58 |
55 GLenum wrap_t() const { | 59 GLenum wrap_t() const { |
56 return wrap_t_; | 60 return wrap_t_; |
57 } | 61 } |
58 | 62 |
59 GLenum usage() const { | 63 GLenum usage() const { |
60 return usage_; | 64 return usage_; |
61 } | 65 } |
62 | 66 |
63 GLenum pool() const { | 67 GLenum pool() const { |
64 return pool_; | 68 return pool_; |
65 } | 69 } |
66 | 70 |
| 71 GLenum compare_func() const { |
| 72 return compare_func_; |
| 73 } |
| 74 |
| 75 GLenum compare_mode() const { |
| 76 return compare_mode_; |
| 77 } |
| 78 |
| 79 GLfloat max_lod() const { |
| 80 return max_lod_; |
| 81 } |
| 82 |
| 83 GLfloat min_lod() const { |
| 84 return min_lod_; |
| 85 } |
| 86 |
| 87 GLint base_level() const { |
| 88 return base_level_; |
| 89 } |
| 90 |
| 91 GLint max_level() const { |
| 92 return max_level_; |
| 93 } |
| 94 |
67 int num_uncleared_mips() const { | 95 int num_uncleared_mips() const { |
68 return num_uncleared_mips_; | 96 return num_uncleared_mips_; |
69 } | 97 } |
70 | 98 |
71 uint32 estimated_size() const { | 99 uint32 estimated_size() const { |
72 return estimated_size_; | 100 return estimated_size_; |
73 } | 101 } |
74 | 102 |
75 bool CanRenderTo() const { | 103 bool CanRenderTo() const { |
76 return target_ != GL_TEXTURE_EXTERNAL_OES; | 104 return target_ != GL_TEXTURE_EXTERNAL_OES; |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 GLsizei width, | 339 GLsizei width, |
312 GLsizei height, | 340 GLsizei height, |
313 GLsizei depth, | 341 GLsizei depth, |
314 GLenum format, | 342 GLenum format, |
315 GLenum type); | 343 GLenum type); |
316 | 344 |
317 // Sets the Texture's target | 345 // Sets the Texture's target |
318 // Parameters: | 346 // Parameters: |
319 // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP or | 347 // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP or |
320 // GL_TEXTURE_EXTERNAL_OES or GL_TEXTURE_RECTANGLE_ARB | 348 // GL_TEXTURE_EXTERNAL_OES or GL_TEXTURE_RECTANGLE_ARB |
| 349 // GL_TEXTURE_2D_ARRAY or GL_TEXTURE_3D (for GLES3) |
321 // max_levels: The maximum levels this type of target can have. | 350 // max_levels: The maximum levels this type of target can have. |
322 void SetTarget( | 351 void SetTarget( |
323 const FeatureInfo* feature_info, GLenum target, GLint max_levels); | 352 const FeatureInfo* feature_info, GLenum target, GLint max_levels); |
324 | 353 |
325 // Update info about this texture. | 354 // Update info about this texture. |
326 void Update(const FeatureInfo* feature_info); | 355 void Update(const FeatureInfo* feature_info); |
327 | 356 |
328 // Set the image for a particular level. | 357 // Set the image for a particular level. |
329 void SetLevelImage( | 358 void SetLevelImage( |
330 const FeatureInfo* feature_info, | 359 const FeatureInfo* feature_info, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 // The id of the texure | 407 // The id of the texure |
379 GLuint service_id_; | 408 GLuint service_id_; |
380 | 409 |
381 // Whether all renderable mips of this texture have been cleared. | 410 // Whether all renderable mips of this texture have been cleared. |
382 bool cleared_; | 411 bool cleared_; |
383 | 412 |
384 int num_uncleared_mips_; | 413 int num_uncleared_mips_; |
385 int num_npot_faces_; | 414 int num_npot_faces_; |
386 | 415 |
387 // The target. 0 if unset, otherwise GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP. | 416 // The target. 0 if unset, otherwise GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP. |
| 417 // Or GL_TEXTURE_2D_ARRAY or GL_TEXTURE_3D (for GLES3). |
388 GLenum target_; | 418 GLenum target_; |
389 | 419 |
390 // Texture parameters. | 420 // Texture parameters. |
391 GLenum min_filter_; | 421 GLenum min_filter_; |
392 GLenum mag_filter_; | 422 GLenum mag_filter_; |
| 423 GLenum wrap_r_; |
393 GLenum wrap_s_; | 424 GLenum wrap_s_; |
394 GLenum wrap_t_; | 425 GLenum wrap_t_; |
395 GLenum usage_; | 426 GLenum usage_; |
396 GLenum pool_; | 427 GLenum pool_; |
| 428 GLenum compare_func_; |
| 429 GLenum compare_mode_; |
| 430 GLfloat max_lod_; |
| 431 GLfloat min_lod_; |
| 432 GLint base_level_; |
| 433 GLint max_level_; |
397 | 434 |
398 // The maximum level that has been set. | 435 // The maximum level that has been set. |
399 GLint max_level_set_; | 436 GLint max_level_set_; |
400 | 437 |
401 // Whether or not this texture is "texture complete" | 438 // Whether or not this texture is "texture complete" |
402 bool texture_complete_; | 439 bool texture_complete_; |
403 | 440 |
404 // Whether mip levels have changed and should be reverified. | 441 // Whether mip levels have changed and should be reverified. |
405 bool texture_mips_dirty_; | 442 bool texture_mips_dirty_; |
406 bool texture_mips_complete_; | 443 bool texture_mips_complete_; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 } | 635 } |
599 | 636 |
600 // Returns true if mipmaps can be generated by GL. | 637 // Returns true if mipmaps can be generated by GL. |
601 bool CanGenerateMipmaps(const TextureRef* ref) const { | 638 bool CanGenerateMipmaps(const TextureRef* ref) const { |
602 return ref->texture()->CanGenerateMipmaps(feature_info_.get()); | 639 return ref->texture()->CanGenerateMipmaps(feature_info_.get()); |
603 } | 640 } |
604 | 641 |
605 // Sets the Texture's target | 642 // Sets the Texture's target |
606 // Parameters: | 643 // Parameters: |
607 // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP | 644 // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP |
| 645 // GL_TEXTURE_2D_ARRAY or GL_TEXTURE_3D (for GLES3) |
608 // max_levels: The maximum levels this type of target can have. | 646 // max_levels: The maximum levels this type of target can have. |
609 void SetTarget( | 647 void SetTarget( |
610 TextureRef* ref, | 648 TextureRef* ref, |
611 GLenum target); | 649 GLenum target); |
612 | 650 |
613 // Set the info for a particular level in a TexureInfo. | 651 // Set the info for a particular level in a TexureInfo. |
614 void SetLevelInfo( | 652 void SetLevelInfo( |
615 TextureRef* ref, | 653 TextureRef* ref, |
616 GLenum target, | 654 GLenum target, |
617 GLint level, | 655 GLint level, |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 private: | 924 private: |
887 DecoderTextureState* texture_state_; | 925 DecoderTextureState* texture_state_; |
888 base::TimeTicks begin_time_; | 926 base::TimeTicks begin_time_; |
889 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 927 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
890 }; | 928 }; |
891 | 929 |
892 } // namespace gles2 | 930 } // namespace gles2 |
893 } // namespace gpu | 931 } // namespace gpu |
894 | 932 |
895 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 933 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
OLD | NEW |