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

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

Issue 2121043002: 16 bpp video stream capture, render and WebGL usage - Realsense R200 & SR300 support. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests: cc, skcanvas_video_renderer, wrtcrecorder... Fake capture supports Y16. Created 4 years, 2 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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 void Initialize(); 102 void Initialize();
103 103
104 void DidLoseOutputSurface() { lost_output_surface_ = true; } 104 void DidLoseOutputSurface() { lost_output_surface_ = true; }
105 105
106 int max_texture_size() const { return max_texture_size_; } 106 int max_texture_size() const { return max_texture_size_; }
107 ResourceFormat best_texture_format() const { return best_texture_format_; } 107 ResourceFormat best_texture_format() const { return best_texture_format_; }
108 ResourceFormat best_render_buffer_format() const { 108 ResourceFormat best_render_buffer_format() const {
109 return best_render_buffer_format_; 109 return best_render_buffer_format_;
110 } 110 }
111 ResourceFormat YuvResourceFormat(int bits) const; 111 ResourceFormat YuvResourceFormat(int bits) const;
112 ResourceFormat Y16ResourceFormat() const;
112 bool use_sync_query() const { return use_sync_query_; } 113 bool use_sync_query() const { return use_sync_query_; }
113 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() { 114 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() {
114 return gpu_memory_buffer_manager_; 115 return gpu_memory_buffer_manager_;
115 } 116 }
116 size_t num_resources() const { return resources_.size(); } 117 size_t num_resources() const { return resources_.size(); }
117 118
118 bool IsResourceFormatSupported(ResourceFormat format) const; 119 bool IsResourceFormatSupported(ResourceFormat format) const;
119 120
120 // Checks whether a resource is in use by a consumer. 121 // Checks whether a resource is in use by a consumer.
121 bool InUseByConsumer(ResourceId id); 122 bool InUseByConsumer(ResourceId id);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // that they only use GL locks on GL resources, etc, and this is enforced 219 // that they only use GL locks on GL resources, etc, and this is enforced
219 // by assertions. 220 // by assertions.
220 class CC_EXPORT ScopedReadLockGL { 221 class CC_EXPORT ScopedReadLockGL {
221 public: 222 public:
222 ScopedReadLockGL(ResourceProvider* resource_provider, 223 ScopedReadLockGL(ResourceProvider* resource_provider,
223 ResourceId resource_id); 224 ResourceId resource_id);
224 ~ScopedReadLockGL(); 225 ~ScopedReadLockGL();
225 226
226 unsigned texture_id() const { return texture_id_; } 227 unsigned texture_id() const { return texture_id_; }
227 GLenum target() const { return target_; } 228 GLenum target() const { return target_; }
229 ResourceFormat format() const { return format_; }
228 const gfx::Size& size() const { return size_; } 230 const gfx::Size& size() const { return size_; }
229 const gfx::ColorSpace& color_space() const { return color_space_; } 231 const gfx::ColorSpace& color_space() const { return color_space_; }
230 232
231 private: 233 private:
232 ResourceProvider* resource_provider_; 234 ResourceProvider* resource_provider_;
233 ResourceId resource_id_; 235 ResourceId resource_id_;
234 unsigned texture_id_; 236 unsigned texture_id_;
235 GLenum target_; 237 GLenum target_;
238 ResourceFormat format_;
236 gfx::Size size_; 239 gfx::Size size_;
237 gfx::ColorSpace color_space_; 240 gfx::ColorSpace color_space_;
238 241
239 DISALLOW_COPY_AND_ASSIGN(ScopedReadLockGL); 242 DISALLOW_COPY_AND_ASSIGN(ScopedReadLockGL);
240 }; 243 };
241 244
242 class CC_EXPORT ScopedSamplerGL { 245 class CC_EXPORT ScopedSamplerGL {
243 public: 246 public:
244 ScopedSamplerGL(ResourceProvider* resource_provider, 247 ScopedSamplerGL(ResourceProvider* resource_provider,
245 ResourceId resource_id, 248 ResourceId resource_id,
246 GLenum filter); 249 GLenum filter);
247 ScopedSamplerGL(ResourceProvider* resource_provider, 250 ScopedSamplerGL(ResourceProvider* resource_provider,
248 ResourceId resource_id, 251 ResourceId resource_id,
249 GLenum unit, 252 GLenum unit,
250 GLenum filter); 253 GLenum filter);
251 ~ScopedSamplerGL(); 254 ~ScopedSamplerGL();
252 255
253 unsigned texture_id() const { return resource_lock_.texture_id(); } 256 unsigned texture_id() const { return resource_lock_.texture_id(); }
254 GLenum target() const { return target_; } 257 GLenum target() const { return target_; }
258 ResourceFormat format() const { return resource_lock_.format(); }
255 const gfx::ColorSpace& color_space() const { 259 const gfx::ColorSpace& color_space() const {
256 return resource_lock_.color_space(); 260 return resource_lock_.color_space();
257 } 261 }
258 262
259 private: 263 private:
260 ScopedReadLockGL resource_lock_; 264 ScopedReadLockGL resource_lock_;
261 GLenum unit_; 265 GLenum unit_;
262 GLenum target_; 266 GLenum target_;
263 267
264 DISALLOW_COPY_AND_ASSIGN(ScopedSamplerGL); 268 DISALLOW_COPY_AND_ASSIGN(ScopedSamplerGL);
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 710
706 base::ThreadChecker thread_checker_; 711 base::ThreadChecker thread_checker_;
707 712
708 scoped_refptr<Fence> current_read_lock_fence_; 713 scoped_refptr<Fence> current_read_lock_fence_;
709 714
710 const size_t id_allocation_chunk_size_; 715 const size_t id_allocation_chunk_size_;
711 std::unique_ptr<IdAllocator> texture_id_allocator_; 716 std::unique_ptr<IdAllocator> texture_id_allocator_;
712 std::unique_ptr<IdAllocator> buffer_id_allocator_; 717 std::unique_ptr<IdAllocator> buffer_id_allocator_;
713 718
714 bool use_sync_query_; 719 bool use_sync_query_;
715 BufferToTextureTargetMap buffer_to_texture_target_map_; 720 BufferToTextureTargetMap buffer_to_texture_target_map_;
716 721
717 // A process-unique ID used for disambiguating memory dumps from different 722 // A process-unique ID used for disambiguating memory dumps from different
718 // resource providers. 723 // resource providers.
719 int tracing_id_; 724 int tracing_id_;
720 725
721 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 726 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
722 }; 727 };
723 728
724 } // namespace cc 729 } // namespace cc
725 730
726 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 731 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698