| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CC_RESOURCES_RESOURCE_PROVIDER_H_ | 5 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ | 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 ResourceProvider( | 81 ResourceProvider( |
| 82 ContextProvider* compositor_context_provider, | 82 ContextProvider* compositor_context_provider, |
| 83 SharedBitmapManager* shared_bitmap_manager, | 83 SharedBitmapManager* shared_bitmap_manager, |
| 84 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 84 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 85 BlockingTaskRunner* blocking_main_thread_task_runner, | 85 BlockingTaskRunner* blocking_main_thread_task_runner, |
| 86 size_t id_allocation_chunk_size, | 86 size_t id_allocation_chunk_size, |
| 87 bool delegated_sync_points_required, | 87 bool delegated_sync_points_required, |
| 88 bool use_gpu_memory_buffer_resources, | 88 bool use_gpu_memory_buffer_resources, |
| 89 bool enable_color_correct_rendering, | 89 bool enable_color_correct_rasterization, |
| 90 const BufferToTextureTargetMap& buffer_to_texture_target_map); | 90 const BufferToTextureTargetMap& buffer_to_texture_target_map); |
| 91 ~ResourceProvider() override; | 91 ~ResourceProvider() override; |
| 92 | 92 |
| 93 void Initialize(); | 93 void Initialize(); |
| 94 | 94 |
| 95 void DidLoseContextProvider() { lost_context_provider_ = true; } | 95 void DidLoseContextProvider() { lost_context_provider_ = true; } |
| 96 | 96 |
| 97 int max_texture_size() const { return settings_.max_texture_size; } | 97 int max_texture_size() const { return settings_.max_texture_size; } |
| 98 ResourceFormat best_texture_format() const { | 98 ResourceFormat best_texture_format() const { |
| 99 return settings_.best_texture_format; | 99 return settings_.best_texture_format; |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 void BindImageForSampling(Resource* resource); | 705 void BindImageForSampling(Resource* resource); |
| 706 // Binds the given GL resource to a texture target for sampling using the | 706 // Binds the given GL resource to a texture target for sampling using the |
| 707 // specified filter for both minification and magnification. Returns the | 707 // specified filter for both minification and magnification. Returns the |
| 708 // texture target used. The resource must be locked for reading. | 708 // texture target used. The resource must be locked for reading. |
| 709 GLenum BindForSampling(ResourceId resource_id, GLenum unit, GLenum filter); | 709 GLenum BindForSampling(ResourceId resource_id, GLenum unit, GLenum filter); |
| 710 | 710 |
| 711 // Returns null if we do not have a ContextProvider. | 711 // Returns null if we do not have a ContextProvider. |
| 712 gpu::gles2::GLES2Interface* ContextGL() const; | 712 gpu::gles2::GLES2Interface* ContextGL() const; |
| 713 bool IsGLContextLost() const; | 713 bool IsGLContextLost() const; |
| 714 | 714 |
| 715 // Returns null if |settings_.enable_color_correct_rendering| is false. | 715 // Returns null if |settings_.enable_color_correct_rasterization| is false. |
| 716 sk_sp<SkColorSpace> GetResourceSkColorSpace(const Resource* resource) const; | 716 sk_sp<SkColorSpace> GetResourceSkColorSpace(const Resource* resource) const; |
| 717 | 717 |
| 718 // Holds const settings for the ResourceProvider. Never changed after init. | 718 // Holds const settings for the ResourceProvider. Never changed after init. |
| 719 struct Settings { | 719 struct Settings { |
| 720 Settings(ContextProvider* compositor_context_provider, | 720 Settings(ContextProvider* compositor_context_provider, |
| 721 bool delegated_sync_points_required, | 721 bool delegated_sync_points_required, |
| 722 bool use_gpu_memory_buffer_resources, | 722 bool use_gpu_memory_buffer_resources, |
| 723 bool enable_color_correct_rendering); | 723 bool enable_color_correct_rasterization); |
| 724 | 724 |
| 725 int max_texture_size = 0; | 725 int max_texture_size = 0; |
| 726 bool use_texture_storage_ext = false; | 726 bool use_texture_storage_ext = false; |
| 727 bool use_texture_format_bgra = false; | 727 bool use_texture_format_bgra = false; |
| 728 bool use_texture_usage_hint = false; | 728 bool use_texture_usage_hint = false; |
| 729 bool use_sync_query = false; | 729 bool use_sync_query = false; |
| 730 ResourceType default_resource_type = RESOURCE_TYPE_GL_TEXTURE; | 730 ResourceType default_resource_type = RESOURCE_TYPE_GL_TEXTURE; |
| 731 ResourceFormat yuv_resource_format = LUMINANCE_8; | 731 ResourceFormat yuv_resource_format = LUMINANCE_8; |
| 732 ResourceFormat yuv_highbit_resource_format = LUMINANCE_8; | 732 ResourceFormat yuv_highbit_resource_format = LUMINANCE_8; |
| 733 ResourceFormat best_texture_format = RGBA_8888; | 733 ResourceFormat best_texture_format = RGBA_8888; |
| 734 ResourceFormat best_render_buffer_format = RGBA_8888; | 734 ResourceFormat best_render_buffer_format = RGBA_8888; |
| 735 bool enable_color_correct_rendering = false; | 735 bool enable_color_correct_rasterization = false; |
| 736 bool delegated_sync_points_required = false; | 736 bool delegated_sync_points_required = false; |
| 737 } const settings_; | 737 } const settings_; |
| 738 | 738 |
| 739 ContextProvider* compositor_context_provider_; | 739 ContextProvider* compositor_context_provider_; |
| 740 SharedBitmapManager* shared_bitmap_manager_; | 740 SharedBitmapManager* shared_bitmap_manager_; |
| 741 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 741 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
| 742 BlockingTaskRunner* blocking_main_thread_task_runner_; | 742 BlockingTaskRunner* blocking_main_thread_task_runner_; |
| 743 bool lost_context_provider_; | 743 bool lost_context_provider_; |
| 744 ResourceId next_id_; | 744 ResourceId next_id_; |
| 745 ResourceMap resources_; | 745 ResourceMap resources_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 760 // Set of resource Ids that would like to be notified about promotion hints. | 760 // Set of resource Ids that would like to be notified about promotion hints. |
| 761 ResourceIdSet wants_promotion_hints_set_; | 761 ResourceIdSet wants_promotion_hints_set_; |
| 762 #endif | 762 #endif |
| 763 | 763 |
| 764 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 764 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 765 }; | 765 }; |
| 766 | 766 |
| 767 } // namespace cc | 767 } // namespace cc |
| 768 | 768 |
| 769 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 769 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |