Chromium Code Reviews| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 static scoped_ptr<ResourceProvider> Create( | 80 static scoped_ptr<ResourceProvider> Create( |
| 81 OutputSurface* output_surface, | 81 OutputSurface* output_surface, |
| 82 SharedBitmapManager* shared_bitmap_manager, | 82 SharedBitmapManager* shared_bitmap_manager, |
| 83 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 83 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 84 BlockingTaskRunner* blocking_main_thread_task_runner, | 84 BlockingTaskRunner* blocking_main_thread_task_runner, |
| 85 int highp_threshold_min, | 85 int highp_threshold_min, |
| 86 bool use_rgba_4444_texture_format, | 86 bool use_rgba_4444_texture_format, |
| 87 size_t id_allocation_chunk_size, | 87 size_t id_allocation_chunk_size, |
| 88 bool use_persistent_map_for_gpu_memory_buffers); | 88 bool use_persistent_map_for_gpu_memory_buffers, |
| 89 std::vector<unsigned> use_image_texture_targets); | |
|
reveman
2015/07/28 08:58:26
nit: const std::vector<unsigned>&
| |
| 89 virtual ~ResourceProvider(); | 90 virtual ~ResourceProvider(); |
| 90 | 91 |
| 91 void DidLoseOutputSurface() { lost_output_surface_ = true; } | 92 void DidLoseOutputSurface() { lost_output_surface_ = true; } |
| 92 | 93 |
| 93 int max_texture_size() const { return max_texture_size_; } | 94 int max_texture_size() const { return max_texture_size_; } |
| 94 ResourceFormat memory_efficient_texture_format() const { | 95 ResourceFormat memory_efficient_texture_format() const { |
| 95 return use_rgba_4444_texture_format_ ? RGBA_4444 : best_texture_format_; | 96 return use_rgba_4444_texture_format_ ? RGBA_4444 : best_texture_format_; |
| 96 } | 97 } |
| 97 ResourceFormat best_texture_format() const { return best_texture_format_; } | 98 ResourceFormat best_texture_format() const { return best_texture_format_; } |
| 98 ResourceFormat best_render_buffer_format() const { | 99 ResourceFormat best_render_buffer_format() const { |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 void WaitSyncPointIfNeeded(ResourceId id); | 431 void WaitSyncPointIfNeeded(ResourceId id); |
| 431 | 432 |
| 432 void WaitReadLockIfNeeded(ResourceId id); | 433 void WaitReadLockIfNeeded(ResourceId id); |
| 433 | 434 |
| 434 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); | 435 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); |
| 435 | 436 |
| 436 OutputSurface* output_surface() { return output_surface_; } | 437 OutputSurface* output_surface() { return output_surface_; } |
| 437 | 438 |
| 438 void ValidateResource(ResourceId id) const; | 439 void ValidateResource(ResourceId id) const; |
| 439 | 440 |
| 441 GLenum GetImageTextureTarget(ResourceFormat format); | |
| 442 | |
| 440 protected: | 443 protected: |
| 441 ResourceProvider(OutputSurface* output_surface, | 444 ResourceProvider(OutputSurface* output_surface, |
| 442 SharedBitmapManager* shared_bitmap_manager, | 445 SharedBitmapManager* shared_bitmap_manager, |
| 443 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 446 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 444 BlockingTaskRunner* blocking_main_thread_task_runner, | 447 BlockingTaskRunner* blocking_main_thread_task_runner, |
| 445 int highp_threshold_min, | 448 int highp_threshold_min, |
| 446 bool use_rgba_4444_texture_format, | 449 bool use_rgba_4444_texture_format, |
| 447 size_t id_allocation_chunk_size, | 450 size_t id_allocation_chunk_size, |
| 448 bool use_persistent_map_for_gpu_memory_buffers); | 451 bool use_persistent_map_for_gpu_memory_buffers, |
| 452 std::vector<unsigned> use_image_texture_targets); | |
|
reveman
2015/07/28 08:58:26
nit: const std::vector<unsigned>&
| |
| 449 void Initialize(); | 453 void Initialize(); |
| 450 | 454 |
| 451 private: | 455 private: |
| 452 struct Resource { | 456 struct Resource { |
| 453 enum Origin { INTERNAL, EXTERNAL, DELEGATED }; | 457 enum Origin { INTERNAL, EXTERNAL, DELEGATED }; |
| 454 | 458 |
| 455 ~Resource(); | 459 ~Resource(); |
| 456 Resource(unsigned texture_id, | 460 Resource(unsigned texture_id, |
| 457 const gfx::Size& size, | 461 const gfx::Size& size, |
| 458 Origin origin, | 462 Origin origin, |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 594 | 598 |
| 595 scoped_refptr<Fence> current_read_lock_fence_; | 599 scoped_refptr<Fence> current_read_lock_fence_; |
| 596 bool use_rgba_4444_texture_format_; | 600 bool use_rgba_4444_texture_format_; |
| 597 | 601 |
| 598 const size_t id_allocation_chunk_size_; | 602 const size_t id_allocation_chunk_size_; |
| 599 scoped_ptr<IdAllocator> texture_id_allocator_; | 603 scoped_ptr<IdAllocator> texture_id_allocator_; |
| 600 scoped_ptr<IdAllocator> buffer_id_allocator_; | 604 scoped_ptr<IdAllocator> buffer_id_allocator_; |
| 601 | 605 |
| 602 bool use_sync_query_; | 606 bool use_sync_query_; |
| 603 bool use_persistent_map_for_gpu_memory_buffers_; | 607 bool use_persistent_map_for_gpu_memory_buffers_; |
| 608 std::vector<unsigned> use_image_texture_targets_; | |
| 604 // Fence used for CopyResource if CHROMIUM_sync_query is not supported. | 609 // Fence used for CopyResource if CHROMIUM_sync_query is not supported. |
| 605 scoped_refptr<SynchronousFence> synchronous_fence_; | 610 scoped_refptr<SynchronousFence> synchronous_fence_; |
| 606 | 611 |
| 607 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 612 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 608 }; | 613 }; |
| 609 | 614 |
| 610 // TODO(epenner): Move these format conversions to resource_format.h | 615 // TODO(epenner): Move these format conversions to resource_format.h |
| 611 // once that builds on mac (npapi.h currently #includes OpenGL.h). | 616 // once that builds on mac (npapi.h currently #includes OpenGL.h). |
| 612 inline int BitsPerPixel(ResourceFormat format) { | 617 inline int BitsPerPixel(ResourceFormat format) { |
| 613 switch (format) { | 618 switch (format) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 658 return format_gl_data_format[format]; | 663 return format_gl_data_format[format]; |
| 659 } | 664 } |
| 660 | 665 |
| 661 inline GLenum GLInternalFormat(ResourceFormat format) { | 666 inline GLenum GLInternalFormat(ResourceFormat format) { |
| 662 return GLDataFormat(format); | 667 return GLDataFormat(format); |
| 663 } | 668 } |
| 664 | 669 |
| 665 } // namespace cc | 670 } // namespace cc |
| 666 | 671 |
| 667 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 672 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |