| 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> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" | 16 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" |
| 17 #include "gpu/command_buffer/service/feature_info.h" | |
| 18 #include "gpu/command_buffer/service/gl_utils.h" | 17 #include "gpu/command_buffer/service/gl_utils.h" |
| 19 #include "gpu/command_buffer/service/memory_tracking.h" | 18 #include "gpu/command_buffer/service/memory_tracking.h" |
| 20 #include "gpu/gpu_export.h" | 19 #include "gpu/gpu_export.h" |
| 21 #include "ui/gfx/geometry/rect.h" | 20 #include "ui/gfx/geometry/rect.h" |
| 22 #include "ui/gl/gl_image.h" | 21 #include "ui/gl/gl_image.h" |
| 23 | 22 |
| 24 namespace gpu { | 23 namespace gpu { |
| 25 namespace gles2 { | 24 namespace gles2 { |
| 26 | 25 |
| 27 class GLES2Decoder; | 26 class GLES2Decoder; |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 GLint num_observers_; | 525 GLint num_observers_; |
| 527 | 526 |
| 528 DISALLOW_COPY_AND_ASSIGN(TextureRef); | 527 DISALLOW_COPY_AND_ASSIGN(TextureRef); |
| 529 }; | 528 }; |
| 530 | 529 |
| 531 // Holds data that is per gles2_cmd_decoder, but is related to to the | 530 // Holds data that is per gles2_cmd_decoder, but is related to to the |
| 532 // TextureManager. | 531 // TextureManager. |
| 533 struct DecoderTextureState { | 532 struct DecoderTextureState { |
| 534 // total_texture_upload_time automatically initialized to 0 in default | 533 // total_texture_upload_time automatically initialized to 0 in default |
| 535 // constructor. | 534 // constructor. |
| 536 explicit DecoderTextureState(const FeatureInfo::Workarounds& workarounds) | 535 explicit DecoderTextureState(bool texsubimage_faster_than_teximage) |
| 537 : tex_image_failed(false), | 536 : tex_image_failed(false), |
| 538 texture_upload_count(0), | 537 texture_upload_count(0), |
| 539 texsubimage_faster_than_teximage( | 538 texsubimage_faster_than_teximage(texsubimage_faster_than_teximage) {} |
| 540 workarounds.texsubimage_faster_than_teximage), | |
| 541 force_cube_map_positive_x_allocation( | |
| 542 workarounds.force_cube_map_positive_x_allocation) {} | |
| 543 | 539 |
| 544 // This indicates all the following texSubImage*D calls that are part of the | 540 // This indicates all the following texSubImage*D calls that are part of the |
| 545 // failed texImage*D call should be ignored. The client calls have a lock | 541 // failed texImage*D call should be ignored. The client calls have a lock |
| 546 // around them, so it will affect only a single texImage*D + texSubImage*D | 542 // around them, so it will affect only a single texImage*D + texSubImage*D |
| 547 // group. | 543 // group. |
| 548 bool tex_image_failed; | 544 bool tex_image_failed; |
| 549 | 545 |
| 550 // Command buffer stats. | 546 // Command buffer stats. |
| 551 int texture_upload_count; | 547 int texture_upload_count; |
| 552 base::TimeDelta total_texture_upload_time; | 548 base::TimeDelta total_texture_upload_time; |
| 553 | 549 |
| 554 bool texsubimage_faster_than_teximage; | 550 bool texsubimage_faster_than_teximage; |
| 555 bool force_cube_map_positive_x_allocation; | |
| 556 }; | 551 }; |
| 557 | 552 |
| 558 // This class keeps track of the textures and their sizes so we can do NPOT and | 553 // This class keeps track of the textures and their sizes so we can do NPOT and |
| 559 // texture complete checking. | 554 // texture complete checking. |
| 560 // | 555 // |
| 561 // NOTE: To support shared resources an instance of this class will need to be | 556 // NOTE: To support shared resources an instance of this class will need to be |
| 562 // shared by multiple GLES2Decoders. | 557 // shared by multiple GLES2Decoders. |
| 563 class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider { | 558 class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider { |
| 564 public: | 559 public: |
| 565 class GPU_EXPORT DestructionObserver { | 560 class GPU_EXPORT DestructionObserver { |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 GLuint* black_texture); | 881 GLuint* black_texture); |
| 887 | 882 |
| 888 void DoTexImage( | 883 void DoTexImage( |
| 889 DecoderTextureState* texture_state, | 884 DecoderTextureState* texture_state, |
| 890 ErrorState* error_state, | 885 ErrorState* error_state, |
| 891 DecoderFramebufferState* framebuffer_state, | 886 DecoderFramebufferState* framebuffer_state, |
| 892 const char* function_name, | 887 const char* function_name, |
| 893 TextureRef* texture_ref, | 888 TextureRef* texture_ref, |
| 894 const DoTexImageArguments& args); | 889 const DoTexImageArguments& args); |
| 895 | 890 |
| 896 bool DoTexImage2DCubeMapPositiveXIfNeeded( | |
| 897 DecoderTextureState* texture_state, | |
| 898 ErrorState* error_state, | |
| 899 DecoderFramebufferState* framebuffer_state, | |
| 900 const char* function_name, | |
| 901 TextureRef* texture_ref, | |
| 902 const DoTexImageArguments& args); | |
| 903 | |
| 904 void StartTracking(TextureRef* texture); | 891 void StartTracking(TextureRef* texture); |
| 905 void StopTracking(TextureRef* texture); | 892 void StopTracking(TextureRef* texture); |
| 906 | 893 |
| 907 void UpdateSafeToRenderFrom(int delta); | 894 void UpdateSafeToRenderFrom(int delta); |
| 908 void UpdateUnclearedMips(int delta); | 895 void UpdateUnclearedMips(int delta); |
| 909 void UpdateCanRenderCondition(Texture::CanRenderCondition old_condition, | 896 void UpdateCanRenderCondition(Texture::CanRenderCondition old_condition, |
| 910 Texture::CanRenderCondition new_condition); | 897 Texture::CanRenderCondition new_condition); |
| 911 void UpdateNumImages(int delta); | 898 void UpdateNumImages(int delta); |
| 912 void IncFramebufferStateChangeCount(); | 899 void IncFramebufferStateChangeCount(); |
| 913 | 900 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 private: | 960 private: |
| 974 DecoderTextureState* texture_state_; | 961 DecoderTextureState* texture_state_; |
| 975 base::TimeTicks begin_time_; | 962 base::TimeTicks begin_time_; |
| 976 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 963 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
| 977 }; | 964 }; |
| 978 | 965 |
| 979 } // namespace gles2 | 966 } // namespace gles2 |
| 980 } // namespace gpu | 967 } // namespace gpu |
| 981 | 968 |
| 982 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 969 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| OLD | NEW |