| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 void Initialize(); | 103 void Initialize(); |
| 104 | 104 |
| 105 void DidLoseContextProvider() { lost_context_provider_ = true; } | 105 void DidLoseContextProvider() { lost_context_provider_ = true; } |
| 106 | 106 |
| 107 int max_texture_size() const { return max_texture_size_; } | 107 int max_texture_size() const { return max_texture_size_; } |
| 108 ResourceFormat best_texture_format() const { return best_texture_format_; } | 108 ResourceFormat best_texture_format() const { return best_texture_format_; } |
| 109 ResourceFormat best_render_buffer_format() const { | 109 ResourceFormat best_render_buffer_format() const { |
| 110 return best_render_buffer_format_; | 110 return best_render_buffer_format_; |
| 111 } | 111 } |
| 112 ResourceFormat YuvResourceFormat(int bits) const; | 112 ResourceFormat YuvResourceFormat(int bits) const; |
| 113 ResourceFormat Y16ResourceFormat() const; |
| 113 bool use_sync_query() const { return use_sync_query_; } | 114 bool use_sync_query() const { return use_sync_query_; } |
| 114 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() { | 115 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() { |
| 115 return gpu_memory_buffer_manager_; | 116 return gpu_memory_buffer_manager_; |
| 116 } | 117 } |
| 117 size_t num_resources() const { return resources_.size(); } | 118 size_t num_resources() const { return resources_.size(); } |
| 118 | 119 |
| 119 bool IsResourceFormatSupported(ResourceFormat format) const; | 120 bool IsResourceFormatSupported(ResourceFormat format) const; |
| 120 | 121 |
| 121 // Checks whether a resource is in use by a consumer. | 122 // Checks whether a resource is in use by a consumer. |
| 122 bool InUseByConsumer(ResourceId id); | 123 bool InUseByConsumer(ResourceId id); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 // that they only use GL locks on GL resources, etc, and this is enforced | 221 // that they only use GL locks on GL resources, etc, and this is enforced |
| 221 // by assertions. | 222 // by assertions. |
| 222 class CC_EXPORT ScopedReadLockGL { | 223 class CC_EXPORT ScopedReadLockGL { |
| 223 public: | 224 public: |
| 224 ScopedReadLockGL(ResourceProvider* resource_provider, | 225 ScopedReadLockGL(ResourceProvider* resource_provider, |
| 225 ResourceId resource_id); | 226 ResourceId resource_id); |
| 226 ~ScopedReadLockGL(); | 227 ~ScopedReadLockGL(); |
| 227 | 228 |
| 228 unsigned texture_id() const { return texture_id_; } | 229 unsigned texture_id() const { return texture_id_; } |
| 229 GLenum target() const { return target_; } | 230 GLenum target() const { return target_; } |
| 231 ResourceFormat format() const { return format_; } |
| 230 const gfx::Size& size() const { return size_; } | 232 const gfx::Size& size() const { return size_; } |
| 231 const gfx::ColorSpace& color_space() const { return color_space_; } | 233 const gfx::ColorSpace& color_space() const { return color_space_; } |
| 232 | 234 |
| 233 private: | 235 private: |
| 234 ResourceProvider* resource_provider_; | 236 ResourceProvider* resource_provider_; |
| 235 ResourceId resource_id_; | 237 ResourceId resource_id_; |
| 236 unsigned texture_id_; | 238 unsigned texture_id_; |
| 237 GLenum target_; | 239 GLenum target_; |
| 240 ResourceFormat format_; |
| 238 gfx::Size size_; | 241 gfx::Size size_; |
| 239 gfx::ColorSpace color_space_; | 242 gfx::ColorSpace color_space_; |
| 240 | 243 |
| 241 DISALLOW_COPY_AND_ASSIGN(ScopedReadLockGL); | 244 DISALLOW_COPY_AND_ASSIGN(ScopedReadLockGL); |
| 242 }; | 245 }; |
| 243 | 246 |
| 244 class CC_EXPORT ScopedSamplerGL { | 247 class CC_EXPORT ScopedSamplerGL { |
| 245 public: | 248 public: |
| 246 ScopedSamplerGL(ResourceProvider* resource_provider, | 249 ScopedSamplerGL(ResourceProvider* resource_provider, |
| 247 ResourceId resource_id, | 250 ResourceId resource_id, |
| 248 GLenum filter); | 251 GLenum filter); |
| 249 ScopedSamplerGL(ResourceProvider* resource_provider, | 252 ScopedSamplerGL(ResourceProvider* resource_provider, |
| 250 ResourceId resource_id, | 253 ResourceId resource_id, |
| 251 GLenum unit, | 254 GLenum unit, |
| 252 GLenum filter); | 255 GLenum filter); |
| 253 ~ScopedSamplerGL(); | 256 ~ScopedSamplerGL(); |
| 254 | 257 |
| 255 unsigned texture_id() const { return resource_lock_.texture_id(); } | 258 unsigned texture_id() const { return resource_lock_.texture_id(); } |
| 256 GLenum target() const { return target_; } | 259 GLenum target() const { return target_; } |
| 260 ResourceFormat format() const { return resource_lock_.format(); } |
| 257 const gfx::ColorSpace& color_space() const { | 261 const gfx::ColorSpace& color_space() const { |
| 258 return resource_lock_.color_space(); | 262 return resource_lock_.color_space(); |
| 259 } | 263 } |
| 260 | 264 |
| 261 private: | 265 private: |
| 262 ScopedReadLockGL resource_lock_; | 266 ScopedReadLockGL resource_lock_; |
| 263 GLenum unit_; | 267 GLenum unit_; |
| 264 GLenum target_; | 268 GLenum target_; |
| 265 | 269 |
| 266 DISALLOW_COPY_AND_ASSIGN(ScopedSamplerGL); | 270 DISALLOW_COPY_AND_ASSIGN(ScopedSamplerGL); |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 | 696 |
| 693 const bool delegated_sync_points_required_; | 697 const bool delegated_sync_points_required_; |
| 694 | 698 |
| 695 ResourceType default_resource_type_; | 699 ResourceType default_resource_type_; |
| 696 bool use_texture_storage_ext_; | 700 bool use_texture_storage_ext_; |
| 697 bool use_texture_format_bgra_; | 701 bool use_texture_format_bgra_; |
| 698 bool use_texture_usage_hint_; | 702 bool use_texture_usage_hint_; |
| 699 bool use_compressed_texture_etc1_; | 703 bool use_compressed_texture_etc1_; |
| 700 ResourceFormat yuv_resource_format_; | 704 ResourceFormat yuv_resource_format_; |
| 701 ResourceFormat yuv_highbit_resource_format_; | 705 ResourceFormat yuv_highbit_resource_format_; |
| 706 ResourceFormat y16_resource_format_; |
| 702 int max_texture_size_; | 707 int max_texture_size_; |
| 703 ResourceFormat best_texture_format_; | 708 ResourceFormat best_texture_format_; |
| 704 ResourceFormat best_render_buffer_format_; | 709 ResourceFormat best_render_buffer_format_; |
| 705 const bool enable_color_correct_rendering_ = false; | 710 const bool enable_color_correct_rendering_ = false; |
| 706 | 711 |
| 707 base::ThreadChecker thread_checker_; | 712 base::ThreadChecker thread_checker_; |
| 708 | 713 |
| 709 scoped_refptr<Fence> current_read_lock_fence_; | 714 scoped_refptr<Fence> current_read_lock_fence_; |
| 710 | 715 |
| 711 const size_t id_allocation_chunk_size_; | 716 const size_t id_allocation_chunk_size_; |
| 712 std::unique_ptr<IdAllocator> texture_id_allocator_; | 717 std::unique_ptr<IdAllocator> texture_id_allocator_; |
| 713 std::unique_ptr<IdAllocator> buffer_id_allocator_; | 718 std::unique_ptr<IdAllocator> buffer_id_allocator_; |
| 714 | 719 |
| 715 bool use_sync_query_; | 720 bool use_sync_query_; |
| 716 BufferToTextureTargetMap buffer_to_texture_target_map_; | 721 BufferToTextureTargetMap buffer_to_texture_target_map_; |
| 717 | 722 |
| 718 // A process-unique ID used for disambiguating memory dumps from different | 723 // A process-unique ID used for disambiguating memory dumps from different |
| 719 // resource providers. | 724 // resource providers. |
| 720 int tracing_id_; | 725 int tracing_id_; |
| 721 | 726 |
| 722 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 727 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 723 }; | 728 }; |
| 724 | 729 |
| 725 } // namespace cc | 730 } // namespace cc |
| 726 | 731 |
| 727 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 732 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |