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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 bool CanLockForWrite(ResourceId id); | 311 bool CanLockForWrite(ResourceId id); |
| 312 | 312 |
| 313 cc::ContextProvider* offscreen_context_provider() { | 313 cc::ContextProvider* offscreen_context_provider() { |
| 314 return offscreen_context_provider_.get(); | 314 return offscreen_context_provider_.get(); |
| 315 } | 315 } |
| 316 void set_offscreen_context_provider( | 316 void set_offscreen_context_provider( |
| 317 scoped_refptr<cc::ContextProvider> offscreen_context_provider) { | 317 scoped_refptr<cc::ContextProvider> offscreen_context_provider) { |
| 318 offscreen_context_provider_ = offscreen_context_provider; | 318 offscreen_context_provider_ = offscreen_context_provider; |
| 319 } | 319 } |
| 320 | 320 |
| 321 // Sets if zero-copy GPU memory buffers should be used. | |
| 322 void SetUseGpuMemoryBuffers(bool use_gpu_memory_buffers); | |
|
reveman
2013/05/17 01:48:08
You don't need this when exposing this using a new
kaanb
2013/05/17 21:27:36
Done.
| |
| 323 | |
| 321 private: | 324 private: |
| 322 struct Resource { | 325 struct Resource { |
| 323 Resource(); | 326 Resource(); |
| 324 ~Resource(); | 327 ~Resource(); |
| 325 Resource(unsigned texture_id, gfx::Size size, GLenum format, GLenum filter); | 328 Resource(unsigned texture_id, gfx::Size size, GLenum format, GLenum filter); |
| 326 Resource(uint8_t* pixels, gfx::Size size, GLenum format, GLenum filter); | 329 Resource(uint8_t* pixels, gfx::Size size, GLenum format, GLenum filter); |
| 327 | 330 |
| 328 unsigned gl_id; | 331 unsigned gl_id; |
| 329 // Pixel buffer used for set pixels without unnecessary copying. | 332 // Pixel buffer used for set pixels without unnecessary copying. |
| 330 unsigned gl_pixel_buffer_id; | 333 unsigned gl_pixel_buffer_id; |
| 331 // Query used to determine when asynchronous set pixels complete. | 334 // Query used to determine when asynchronous set pixels complete. |
| 332 unsigned gl_upload_query_id; | 335 unsigned gl_upload_query_id; |
| 333 TextureMailbox mailbox; | 336 TextureMailbox mailbox; |
| 334 uint8_t* pixels; | 337 uint8_t* pixels; |
| 335 uint8_t* pixel_buffer; | 338 uint8_t* pixel_buffer; |
| 336 int lock_for_read_count; | 339 int lock_for_read_count; |
| 337 bool locked_for_write; | 340 bool locked_for_write; |
| 338 bool external; | 341 bool external; |
| 339 bool exported; | 342 bool exported; |
| 340 bool marked_for_deletion; | 343 bool marked_for_deletion; |
| 341 bool pending_set_pixels; | 344 bool pending_set_pixels; |
| 342 bool set_pixels_completion_forced; | 345 bool set_pixels_completion_forced; |
| 343 bool allocated; | 346 bool allocated; |
| 344 bool enable_read_lock_fences; | 347 bool enable_read_lock_fences; |
| 345 scoped_refptr<Fence> read_lock_fence; | 348 scoped_refptr<Fence> read_lock_fence; |
| 346 gfx::Size size; | 349 gfx::Size size; |
| 347 GLenum format; | 350 GLenum format; |
| 348 // TODO(skyostil): Use a separate sampler object for filter state. | 351 // TODO(skyostil): Use a separate sampler object for filter state. |
| 349 GLenum filter; | 352 GLenum filter; |
| 353 unsigned image_id; | |
| 350 ResourceType type; | 354 ResourceType type; |
| 351 }; | 355 }; |
| 352 typedef base::hash_map<ResourceId, Resource> ResourceMap; | 356 typedef base::hash_map<ResourceId, Resource> ResourceMap; |
| 353 struct Child { | 357 struct Child { |
| 354 Child(); | 358 Child(); |
| 355 ~Child(); | 359 ~Child(); |
| 356 | 360 |
| 357 ResourceIdMap child_to_parent_map; | 361 ResourceIdMap child_to_parent_map; |
| 358 ResourceIdMap parent_to_child_map; | 362 ResourceIdMap parent_to_child_map; |
| 359 }; | 363 }; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 scoped_ptr<AcceleratedTextureCopier> texture_copier_; | 403 scoped_ptr<AcceleratedTextureCopier> texture_copier_; |
| 400 int max_texture_size_; | 404 int max_texture_size_; |
| 401 GLenum best_texture_format_; | 405 GLenum best_texture_format_; |
| 402 | 406 |
| 403 scoped_refptr<cc::ContextProvider> offscreen_context_provider_; | 407 scoped_refptr<cc::ContextProvider> offscreen_context_provider_; |
| 404 | 408 |
| 405 base::ThreadChecker thread_checker_; | 409 base::ThreadChecker thread_checker_; |
| 406 | 410 |
| 407 scoped_refptr<Fence> current_read_lock_fence_; | 411 scoped_refptr<Fence> current_read_lock_fence_; |
| 408 | 412 |
| 413 bool use_gpu_memory_buffers_; | |
|
reveman
2013/05/17 01:48:08
remove this
kaanb
2013/05/17 21:27:36
Done.
| |
| 414 | |
| 409 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 415 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
| 410 }; | 416 }; |
| 411 | 417 |
| 412 } // namespace cc | 418 } // namespace cc |
| 413 | 419 |
| 414 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 420 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
| OLD | NEW |