| 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 <list> | 9 #include <list> |
| 9 #include <set> | 10 #include <set> |
| 10 #include <string> | 11 #include <string> |
| 11 #include <vector> | 12 #include <vector> |
| 12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 13 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
| 14 #include "base/logging.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/gl_utils.h" | 17 #include "gpu/command_buffer/service/gl_utils.h" |
| 18 #include "gpu/command_buffer/service/memory_tracking.h" | 18 #include "gpu/command_buffer/service/memory_tracking.h" |
| 19 #include "gpu/gpu_export.h" | 19 #include "gpu/gpu_export.h" |
| 20 #include "ui/gl/gl_image.h" | 20 #include "ui/gl/gl_image.h" |
| 21 | 21 |
| 22 namespace gpu { | 22 namespace gpu { |
| 23 namespace gles2 { | 23 namespace gles2 { |
| 24 | 24 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 GLint num_observers_; | 429 GLint num_observers_; |
| 430 | 430 |
| 431 DISALLOW_COPY_AND_ASSIGN(TextureRef); | 431 DISALLOW_COPY_AND_ASSIGN(TextureRef); |
| 432 }; | 432 }; |
| 433 | 433 |
| 434 // Holds data that is per gles2_cmd_decoder, but is related to to the | 434 // Holds data that is per gles2_cmd_decoder, but is related to to the |
| 435 // TextureManager. | 435 // TextureManager. |
| 436 struct DecoderTextureState { | 436 struct DecoderTextureState { |
| 437 // total_texture_upload_time automatically initialized to 0 in default | 437 // total_texture_upload_time automatically initialized to 0 in default |
| 438 // constructor. | 438 // constructor. |
| 439 DecoderTextureState(bool texsubimage2d_faster_than_teximage2d) | 439 explicit DecoderTextureState(bool texsubimage2d_faster_than_teximage2d) |
| 440 : tex_image_2d_failed(false), | 440 : tex_image_2d_failed(false), |
| 441 texture_upload_count(0), | 441 texture_upload_count(0), |
| 442 texsubimage2d_faster_than_teximage2d( | 442 texsubimage2d_faster_than_teximage2d( |
| 443 texsubimage2d_faster_than_teximage2d) {} | 443 texsubimage2d_faster_than_teximage2d) {} |
| 444 | 444 |
| 445 // This indicates all the following texSubImage2D calls that are part of the | 445 // This indicates all the following texSubImage2D calls that are part of the |
| 446 // failed texImage2D call should be ignored. | 446 // failed texImage2D call should be ignored. |
| 447 bool tex_image_2d_failed; | 447 bool tex_image_2d_failed; |
| 448 | 448 |
| 449 // Command buffer stats. | 449 // Command buffer stats. |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 GLenum type, | 567 GLenum type, |
| 568 bool cleared); | 568 bool cleared); |
| 569 | 569 |
| 570 // Adapter to call above function. | 570 // Adapter to call above function. |
| 571 void SetLevelInfoFromParams(TextureRef* ref, | 571 void SetLevelInfoFromParams(TextureRef* ref, |
| 572 const gpu::AsyncTexImage2DParams& params) { | 572 const gpu::AsyncTexImage2DParams& params) { |
| 573 SetLevelInfo( | 573 SetLevelInfo( |
| 574 ref, params.target, params.level, params.internal_format, | 574 ref, params.target, params.level, params.internal_format, |
| 575 params.width, params.height, 1 /* depth */, | 575 params.width, params.height, 1 /* depth */, |
| 576 params.border, params.format, | 576 params.border, params.format, |
| 577 params.type, true /* cleared */ ); | 577 params.type, true /* cleared */); |
| 578 } | 578 } |
| 579 | 579 |
| 580 Texture* Produce(TextureRef* ref); | 580 Texture* Produce(TextureRef* ref); |
| 581 | 581 |
| 582 // Maps an existing texture into the texture manager, at a given client ID. | 582 // Maps an existing texture into the texture manager, at a given client ID. |
| 583 TextureRef* Consume(GLuint client_id, Texture* texture); | 583 TextureRef* Consume(GLuint client_id, Texture* texture); |
| 584 | 584 |
| 585 // Sets a mip as cleared. | 585 // Sets a mip as cleared. |
| 586 void SetLevelCleared(TextureRef* ref, GLenum target, | 586 void SetLevelCleared(TextureRef* ref, GLenum target, |
| 587 GLint level, bool cleared); | 587 GLint level, bool cleared); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 private: | 822 private: |
| 823 DecoderTextureState* texture_state_; | 823 DecoderTextureState* texture_state_; |
| 824 base::TimeTicks begin_time_; | 824 base::TimeTicks begin_time_; |
| 825 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 825 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
| 826 }; | 826 }; |
| 827 | 827 |
| 828 } // namespace gles2 | 828 } // namespace gles2 |
| 829 } // namespace gpu | 829 } // namespace gpu |
| 830 | 830 |
| 831 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 831 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| OLD | NEW |