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

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: scoping Y8 out. 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 694
691 const bool delegated_sync_points_required_; 695 const bool delegated_sync_points_required_;
692 696
693 ResourceType default_resource_type_; 697 ResourceType default_resource_type_;
694 bool use_texture_storage_ext_; 698 bool use_texture_storage_ext_;
695 bool use_texture_format_bgra_; 699 bool use_texture_format_bgra_;
696 bool use_texture_usage_hint_; 700 bool use_texture_usage_hint_;
697 bool use_compressed_texture_etc1_; 701 bool use_compressed_texture_etc1_;
698 ResourceFormat yuv_resource_format_; 702 ResourceFormat yuv_resource_format_;
699 ResourceFormat yuv_highbit_resource_format_; 703 ResourceFormat yuv_highbit_resource_format_;
704 ResourceFormat y16_resource_format_;
700 int max_texture_size_; 705 int max_texture_size_;
701 ResourceFormat best_texture_format_; 706 ResourceFormat best_texture_format_;
702 ResourceFormat best_render_buffer_format_; 707 ResourceFormat best_render_buffer_format_;
703 const bool enable_color_correct_rendering_ = false; 708 const bool enable_color_correct_rendering_ = false;
704 709
705 base::ThreadChecker thread_checker_; 710 base::ThreadChecker thread_checker_;
706 711
707 scoped_refptr<Fence> current_read_lock_fence_; 712 scoped_refptr<Fence> current_read_lock_fence_;
708 713
709 const size_t id_allocation_chunk_size_; 714 const size_t id_allocation_chunk_size_;
710 std::unique_ptr<IdAllocator> texture_id_allocator_; 715 std::unique_ptr<IdAllocator> texture_id_allocator_;
711 std::unique_ptr<IdAllocator> buffer_id_allocator_; 716 std::unique_ptr<IdAllocator> buffer_id_allocator_;
712 717
713 bool use_sync_query_; 718 bool use_sync_query_;
714 BufferToTextureTargetMap buffer_to_texture_target_map_; 719 BufferToTextureTargetMap buffer_to_texture_target_map_;
715 720
716 // A process-unique ID used for disambiguating memory dumps from different 721 // A process-unique ID used for disambiguating memory dumps from different
717 // resource providers. 722 // resource providers.
718 int tracing_id_; 723 int tracing_id_;
719 724
720 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 725 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
721 }; 726 };
722 727
723 } // namespace cc 728 } // namespace cc
724 729
725 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 730 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698