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