Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: cc/resources/resource_provider.h

Issue 1197423003: Remaining code for basic tile compression functionality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Enable tile compression for one copy Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 RESOURCE_TYPE_BITMAP, 77 RESOURCE_TYPE_BITMAP,
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 bool use_tile_compression,
reveman 2015/07/21 04:26:33 s/use_tile_compression/use_compressed_texture_form
87 size_t id_allocation_chunk_size, 88 size_t id_allocation_chunk_size,
88 bool use_persistent_map_for_gpu_memory_buffers); 89 bool use_persistent_map_for_gpu_memory_buffers);
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(bool must_be_noncompressed,
reveman 2015/07/21 04:26:33 Can we avoid must_be_noncompressed param for now a
95 return use_rgba_4444_texture_format_ ? RGBA_4444 : best_texture_format_; 96 bool must_support_alpha) const;
reveman 2015/07/21 04:26:33 I think this change that adds a "bool alpha" param
96 }
97 ResourceFormat best_texture_format() const { return best_texture_format_; } 97 ResourceFormat best_texture_format() const { return best_texture_format_; }
98 ResourceFormat best_render_buffer_format() const { 98 ResourceFormat best_render_buffer_format() const {
99 return best_render_buffer_format_; 99 return best_render_buffer_format_;
100 } 100 }
101 ResourceFormat yuv_resource_format() const { return yuv_resource_format_; } 101 ResourceFormat yuv_resource_format() const { return yuv_resource_format_; }
102 bool use_sync_query() const { return use_sync_query_; } 102 bool use_sync_query() const { return use_sync_query_; }
103 bool use_persistent_map_for_gpu_memory_buffers() const { 103 bool use_persistent_map_for_gpu_memory_buffers() const {
104 return use_persistent_map_for_gpu_memory_buffers_; 104 return use_persistent_map_for_gpu_memory_buffers_;
105 } 105 }
106 size_t num_resources() const { return resources_.size(); } 106 size_t num_resources() const { return resources_.size(); }
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 437
438 void ValidateResource(ResourceId id) const; 438 void ValidateResource(ResourceId id) const;
439 439
440 protected: 440 protected:
441 ResourceProvider(OutputSurface* output_surface, 441 ResourceProvider(OutputSurface* output_surface,
442 SharedBitmapManager* shared_bitmap_manager, 442 SharedBitmapManager* shared_bitmap_manager,
443 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 443 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
444 BlockingTaskRunner* blocking_main_thread_task_runner, 444 BlockingTaskRunner* blocking_main_thread_task_runner,
445 int highp_threshold_min, 445 int highp_threshold_min,
446 bool use_rgba_4444_texture_format, 446 bool use_rgba_4444_texture_format,
447 bool use_tile_compression,
447 size_t id_allocation_chunk_size, 448 size_t id_allocation_chunk_size,
448 bool use_persistent_map_for_gpu_memory_buffers); 449 bool use_persistent_map_for_gpu_memory_buffers);
449 void Initialize(); 450 void Initialize();
450 451
451 private: 452 private:
452 struct Resource { 453 struct Resource {
453 enum Origin { INTERNAL, EXTERNAL, DELEGATED }; 454 enum Origin { INTERNAL, EXTERNAL, DELEGATED };
454 455
455 ~Resource(); 456 ~Resource();
456 Resource(unsigned texture_id, 457 Resource(unsigned texture_id,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 bool use_compressed_texture_etc1_; 588 bool use_compressed_texture_etc1_;
588 ResourceFormat yuv_resource_format_; 589 ResourceFormat yuv_resource_format_;
589 int max_texture_size_; 590 int max_texture_size_;
590 ResourceFormat best_texture_format_; 591 ResourceFormat best_texture_format_;
591 ResourceFormat best_render_buffer_format_; 592 ResourceFormat best_render_buffer_format_;
592 593
593 base::ThreadChecker thread_checker_; 594 base::ThreadChecker thread_checker_;
594 595
595 scoped_refptr<Fence> current_read_lock_fence_; 596 scoped_refptr<Fence> current_read_lock_fence_;
596 bool use_rgba_4444_texture_format_; 597 bool use_rgba_4444_texture_format_;
598 bool use_tile_compression_;
597 599
598 const size_t id_allocation_chunk_size_; 600 const size_t id_allocation_chunk_size_;
599 scoped_ptr<IdAllocator> texture_id_allocator_; 601 scoped_ptr<IdAllocator> texture_id_allocator_;
600 scoped_ptr<IdAllocator> buffer_id_allocator_; 602 scoped_ptr<IdAllocator> buffer_id_allocator_;
601 603
602 bool use_sync_query_; 604 bool use_sync_query_;
603 bool use_persistent_map_for_gpu_memory_buffers_; 605 bool use_persistent_map_for_gpu_memory_buffers_;
604 // Fence used for CopyResource if CHROMIUM_sync_query is not supported. 606 // Fence used for CopyResource if CHROMIUM_sync_query is not supported.
605 scoped_refptr<SynchronousFence> synchronous_fence_; 607 scoped_refptr<SynchronousFence> synchronous_fence_;
606 608
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 return format_gl_data_format[format]; 660 return format_gl_data_format[format];
659 } 661 }
660 662
661 inline GLenum GLInternalFormat(ResourceFormat format) { 663 inline GLenum GLInternalFormat(ResourceFormat format) {
662 return GLDataFormat(format); 664 return GLDataFormat(format);
663 } 665 }
664 666
665 } // namespace cc 667 } // namespace cc
666 668
667 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 669 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698