| 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 <deque> | 8 #include <deque> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 static scoped_ptr<ResourceProvider> Create( | 83 static scoped_ptr<ResourceProvider> Create( |
| 84 OutputSurface* output_surface, | 84 OutputSurface* output_surface, |
| 85 SharedBitmapManager* shared_bitmap_manager, | 85 SharedBitmapManager* shared_bitmap_manager, |
| 86 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 86 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 87 BlockingTaskRunner* blocking_main_thread_task_runner, | 87 BlockingTaskRunner* blocking_main_thread_task_runner, |
| 88 int highp_threshold_min, | 88 int highp_threshold_min, |
| 89 bool use_rgba_4444_texture_format, | 89 bool use_rgba_4444_texture_format, |
| 90 size_t id_allocation_chunk_size, | 90 size_t id_allocation_chunk_size, |
| 91 bool use_persistent_map_for_gpu_memory_buffers); | 91 bool use_persistent_map_for_gpu_memory_buffers, |
| 92 const std::vector<unsigned>& use_image_texture_targets); |
| 92 ~ResourceProvider() override; | 93 ~ResourceProvider() override; |
| 93 | 94 |
| 94 void DidLoseOutputSurface() { lost_output_surface_ = true; } | 95 void DidLoseOutputSurface() { lost_output_surface_ = true; } |
| 95 | 96 |
| 96 int max_texture_size() const { return max_texture_size_; } | 97 int max_texture_size() const { return max_texture_size_; } |
| 97 ResourceFormat memory_efficient_texture_format() const { | 98 ResourceFormat memory_efficient_texture_format() const { |
| 98 return use_rgba_4444_texture_format_ ? RGBA_4444 : best_texture_format_; | 99 return use_rgba_4444_texture_format_ ? RGBA_4444 : best_texture_format_; |
| 99 } | 100 } |
| 100 ResourceFormat best_texture_format() const { return best_texture_format_; } | 101 ResourceFormat best_texture_format() const { return best_texture_format_; } |
| 101 ResourceFormat best_render_buffer_format() const { | 102 ResourceFormat best_render_buffer_format() const { |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 void WaitSyncPointIfNeeded(ResourceId id); | 435 void WaitSyncPointIfNeeded(ResourceId id); |
| 435 | 436 |
| 436 void WaitReadLockIfNeeded(ResourceId id); | 437 void WaitReadLockIfNeeded(ResourceId id); |
| 437 | 438 |
| 438 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); | 439 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); |
| 439 | 440 |
| 440 OutputSurface* output_surface() { return output_surface_; } | 441 OutputSurface* output_surface() { return output_surface_; } |
| 441 | 442 |
| 442 void ValidateResource(ResourceId id) const; | 443 void ValidateResource(ResourceId id) const; |
| 443 | 444 |
| 445 GLenum GetImageTextureTarget(ResourceFormat format); |
| 446 |
| 444 // base::trace_event::MemoryDumpProvider implementation. | 447 // base::trace_event::MemoryDumpProvider implementation. |
| 445 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 448 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
| 446 base::trace_event::ProcessMemoryDump* pmd) override; | 449 base::trace_event::ProcessMemoryDump* pmd) override; |
| 447 | 450 |
| 448 protected: | 451 protected: |
| 449 ResourceProvider(OutputSurface* output_surface, | 452 ResourceProvider(OutputSurface* output_surface, |
| 450 SharedBitmapManager* shared_bitmap_manager, | 453 SharedBitmapManager* shared_bitmap_manager, |
| 451 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 454 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 452 BlockingTaskRunner* blocking_main_thread_task_runner, | 455 BlockingTaskRunner* blocking_main_thread_task_runner, |
| 453 int highp_threshold_min, | 456 int highp_threshold_min, |
| 454 bool use_rgba_4444_texture_format, | 457 bool use_rgba_4444_texture_format, |
| 455 size_t id_allocation_chunk_size, | 458 size_t id_allocation_chunk_size, |
| 456 bool use_persistent_map_for_gpu_memory_buffers); | 459 bool use_persistent_map_for_gpu_memory_buffers, |
| 460 const std::vector<unsigned>& use_image_texture_targets); |
| 457 void Initialize(); | 461 void Initialize(); |
| 458 | 462 |
| 459 private: | 463 private: |
| 460 struct Resource { | 464 struct Resource { |
| 461 enum Origin { INTERNAL, EXTERNAL, DELEGATED }; | 465 enum Origin { INTERNAL, EXTERNAL, DELEGATED }; |
| 462 | 466 |
| 463 ~Resource(); | 467 ~Resource(); |
| 464 Resource(unsigned texture_id, | 468 Resource(unsigned texture_id, |
| 465 const gfx::Size& size, | 469 const gfx::Size& size, |
| 466 Origin origin, | 470 Origin origin, |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 bool use_rgba_4444_texture_format_; | 608 bool use_rgba_4444_texture_format_; |
| 605 | 609 |
| 606 const size_t id_allocation_chunk_size_; | 610 const size_t id_allocation_chunk_size_; |
| 607 scoped_ptr<IdAllocator> texture_id_allocator_; | 611 scoped_ptr<IdAllocator> texture_id_allocator_; |
| 608 scoped_ptr<IdAllocator> buffer_id_allocator_; | 612 scoped_ptr<IdAllocator> buffer_id_allocator_; |
| 609 | 613 |
| 610 bool use_sync_query_; | 614 bool use_sync_query_; |
| 611 bool use_persistent_map_for_gpu_memory_buffers_; | 615 bool use_persistent_map_for_gpu_memory_buffers_; |
| 612 // Fence used for CopyResource if CHROMIUM_sync_query is not supported. | 616 // Fence used for CopyResource if CHROMIUM_sync_query is not supported. |
| 613 scoped_refptr<SynchronousFence> synchronous_fence_; | 617 scoped_refptr<SynchronousFence> synchronous_fence_; |
| 618 std::vector<unsigned> use_image_texture_targets_; |
| 614 | 619 |
| 615 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 620 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 616 }; | 621 }; |
| 617 | 622 |
| 618 } // namespace cc | 623 } // namespace cc |
| 619 | 624 |
| 620 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 625 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |