| 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), |
| 543 force_cube_complete(workarounds.force_cube_complete) {} |
| 539 | 544 |
| 540 // This indicates all the following texSubImage*D calls that are part of the | 545 // 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 | 546 // 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 | 547 // around them, so it will affect only a single texImage*D + texSubImage*D |
| 543 // group. | 548 // group. |
| 544 bool tex_image_failed; | 549 bool tex_image_failed; |
| 545 | 550 |
| 546 // Command buffer stats. | 551 // Command buffer stats. |
| 547 int texture_upload_count; | 552 int texture_upload_count; |
| 548 base::TimeDelta total_texture_upload_time; | 553 base::TimeDelta total_texture_upload_time; |
| 549 | 554 |
| 550 bool texsubimage_faster_than_teximage; | 555 bool texsubimage_faster_than_teximage; |
| 556 bool force_cube_map_positive_x_allocation; |
| 557 bool force_cube_complete; |
| 551 }; | 558 }; |
| 552 | 559 |
| 553 // This class keeps track of the textures and their sizes so we can do NPOT and | 560 // This class keeps track of the textures and their sizes so we can do NPOT and |
| 554 // texture complete checking. | 561 // texture complete checking. |
| 555 // | 562 // |
| 556 // NOTE: To support shared resources an instance of this class will need to be | 563 // NOTE: To support shared resources an instance of this class will need to be |
| 557 // shared by multiple GLES2Decoders. | 564 // shared by multiple GLES2Decoders. |
| 558 class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider { | 565 class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider { |
| 559 public: | 566 public: |
| 560 class GPU_EXPORT DestructionObserver { | 567 class GPU_EXPORT DestructionObserver { |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 private: | 967 private: |
| 961 DecoderTextureState* texture_state_; | 968 DecoderTextureState* texture_state_; |
| 962 base::TimeTicks begin_time_; | 969 base::TimeTicks begin_time_; |
| 963 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 970 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
| 964 }; | 971 }; |
| 965 | 972 |
| 966 } // namespace gles2 | 973 } // namespace gles2 |
| 967 } // namespace gpu | 974 } // namespace gpu |
| 968 | 975 |
| 969 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 976 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| OLD | NEW |