| 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 GLint num_observers_; | 530 GLint num_observers_; |
| 530 | 531 |
| 531 DISALLOW_COPY_AND_ASSIGN(TextureRef); | 532 DISALLOW_COPY_AND_ASSIGN(TextureRef); |
| 532 }; | 533 }; |
| 533 | 534 |
| 534 // Holds data that is per gles2_cmd_decoder, but is related to to the | 535 // Holds data that is per gles2_cmd_decoder, but is related to to the |
| 535 // TextureManager. | 536 // TextureManager. |
| 536 struct DecoderTextureState { | 537 struct DecoderTextureState { |
| 537 // total_texture_upload_time automatically initialized to 0 in default | 538 // total_texture_upload_time automatically initialized to 0 in default |
| 538 // constructor. | 539 // constructor. |
| 539 explicit DecoderTextureState(bool texsubimage_faster_than_teximage) | 540 explicit DecoderTextureState(const FeatureInfo::Workarounds& workarounds) |
| 540 : tex_image_failed(false), | 541 : tex_image_failed(false), |
| 541 texture_upload_count(0), | 542 texture_upload_count(0), |
| 542 texsubimage_faster_than_teximage(texsubimage_faster_than_teximage) {} | 543 texsubimage_faster_than_teximage( |
| 544 workarounds.texsubimage_faster_than_teximage), |
| 545 force_cube_map_positive_x_allocation( |
| 546 workarounds.force_cube_map_positive_x_allocation), |
| 547 force_cube_complete(workarounds.force_cube_complete) {} |
| 543 | 548 |
| 544 // This indicates all the following texSubImage*D calls that are part of the | 549 // 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 | 550 // 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 | 551 // around them, so it will affect only a single texImage*D + texSubImage*D |
| 547 // group. | 552 // group. |
| 548 bool tex_image_failed; | 553 bool tex_image_failed; |
| 549 | 554 |
| 550 // Command buffer stats. | 555 // Command buffer stats. |
| 551 int texture_upload_count; | 556 int texture_upload_count; |
| 552 base::TimeDelta total_texture_upload_time; | 557 base::TimeDelta total_texture_upload_time; |
| 553 | 558 |
| 554 bool texsubimage_faster_than_teximage; | 559 bool texsubimage_faster_than_teximage; |
| 560 bool force_cube_map_positive_x_allocation; |
| 561 bool force_cube_complete; |
| 555 }; | 562 }; |
| 556 | 563 |
| 557 // This class keeps track of the textures and their sizes so we can do NPOT and | 564 // This class keeps track of the textures and their sizes so we can do NPOT and |
| 558 // texture complete checking. | 565 // texture complete checking. |
| 559 // | 566 // |
| 560 // NOTE: To support shared resources an instance of this class will need to be | 567 // NOTE: To support shared resources an instance of this class will need to be |
| 561 // shared by multiple GLES2Decoders. | 568 // shared by multiple GLES2Decoders. |
| 562 class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider { | 569 class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider { |
| 563 public: | 570 public: |
| 564 class GPU_EXPORT DestructionObserver { | 571 class GPU_EXPORT DestructionObserver { |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 private: | 971 private: |
| 965 DecoderTextureState* texture_state_; | 972 DecoderTextureState* texture_state_; |
| 966 base::TimeTicks begin_time_; | 973 base::TimeTicks begin_time_; |
| 967 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 974 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
| 968 }; | 975 }; |
| 969 | 976 |
| 970 } // namespace gles2 | 977 } // namespace gles2 |
| 971 } // namespace gpu | 978 } // namespace gpu |
| 972 | 979 |
| 973 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 980 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| OLD | NEW |