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/feature_info.h" |
16 #include "gpu/command_buffer/service/gl_utils.h" | 17 #include "gpu/command_buffer/service/gl_utils.h" |
17 #include "gpu/command_buffer/service/memory_tracking.h" | 18 #include "gpu/command_buffer/service/memory_tracking.h" |
18 #include "gpu/gpu_export.h" | 19 #include "gpu/gpu_export.h" |
19 #include "ui/gfx/geometry/rect.h" | 20 #include "ui/gfx/geometry/rect.h" |
20 #include "ui/gl/gl_image.h" | 21 #include "ui/gl/gl_image.h" |
21 | 22 |
22 namespace gpu { | 23 namespace gpu { |
23 namespace gles2 { | 24 namespace gles2 { |
24 | 25 |
25 class GLES2Decoder; | 26 class GLES2Decoder; |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 GLint num_observers_; | 529 GLint num_observers_; |
529 | 530 |
530 DISALLOW_COPY_AND_ASSIGN(TextureRef); | 531 DISALLOW_COPY_AND_ASSIGN(TextureRef); |
531 }; | 532 }; |
532 | 533 |
533 // Holds data that is per gles2_cmd_decoder, but is related to to the | 534 // Holds data that is per gles2_cmd_decoder, but is related to to the |
534 // TextureManager. | 535 // TextureManager. |
535 struct DecoderTextureState { | 536 struct DecoderTextureState { |
536 // total_texture_upload_time automatically initialized to 0 in default | 537 // total_texture_upload_time automatically initialized to 0 in default |
537 // constructor. | 538 // constructor. |
538 explicit DecoderTextureState(bool texsubimage_faster_than_teximage) | 539 explicit DecoderTextureState(const FeatureInfo::Workarounds& workarounds) |
539 : tex_image_failed(false), | 540 : tex_image_failed(false), |
540 texture_upload_count(0), | 541 texture_upload_count(0), |
541 texsubimage_faster_than_teximage(texsubimage_faster_than_teximage) {} | 542 texsubimage_faster_than_teximage( |
| 543 workarounds.texsubimage_faster_than_teximage), |
| 544 force_cube_map_positive_x_allocation( |
| 545 workarounds.force_cube_map_positive_x_allocation), |
| 546 force_cube_complete(workarounds.force_cube_complete) {} |
542 | 547 |
543 // This indicates all the following texSubImage*D calls that are part of the | 548 // This indicates all the following texSubImage*D calls that are part of the |
544 // failed texImage*D call should be ignored. The client calls have a lock | 549 // failed texImage*D call should be ignored. The client calls have a lock |
545 // around them, so it will affect only a single texImage*D + texSubImage*D | 550 // around them, so it will affect only a single texImage*D + texSubImage*D |
546 // group. | 551 // group. |
547 bool tex_image_failed; | 552 bool tex_image_failed; |
548 | 553 |
549 // Command buffer stats. | 554 // Command buffer stats. |
550 int texture_upload_count; | 555 int texture_upload_count; |
551 base::TimeDelta total_texture_upload_time; | 556 base::TimeDelta total_texture_upload_time; |
552 | 557 |
553 bool texsubimage_faster_than_teximage; | 558 bool texsubimage_faster_than_teximage; |
| 559 bool force_cube_map_positive_x_allocation; |
| 560 bool force_cube_complete; |
554 }; | 561 }; |
555 | 562 |
556 // This class keeps track of the textures and their sizes so we can do NPOT and | 563 // This class keeps track of the textures and their sizes so we can do NPOT and |
557 // texture complete checking. | 564 // texture complete checking. |
558 // | 565 // |
559 // NOTE: To support shared resources an instance of this class will need to be | 566 // NOTE: To support shared resources an instance of this class will need to be |
560 // shared by multiple GLES2Decoders. | 567 // shared by multiple GLES2Decoders. |
561 class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider { | 568 class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider { |
562 public: | 569 public: |
563 class GPU_EXPORT DestructionObserver { | 570 class GPU_EXPORT DestructionObserver { |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 private: | 961 private: |
955 DecoderTextureState* texture_state_; | 962 DecoderTextureState* texture_state_; |
956 base::TimeTicks begin_time_; | 963 base::TimeTicks begin_time_; |
957 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 964 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
958 }; | 965 }; |
959 | 966 |
960 } // namespace gles2 | 967 } // namespace gles2 |
961 } // namespace gpu | 968 } // namespace gpu |
962 | 969 |
963 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 970 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
OLD | NEW |