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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 current_read_lock_fence_ = fence; | 363 current_read_lock_fence_ = fence; |
364 } | 364 } |
365 Fence* GetReadLockFence() { return current_read_lock_fence_.get(); } | 365 Fence* GetReadLockFence() { return current_read_lock_fence_.get(); } |
366 | 366 |
367 // Enable read lock fences for a specific resource. | 367 // Enable read lock fences for a specific resource. |
368 void EnableReadLockFences(ResourceProvider::ResourceId id, bool enable); | 368 void EnableReadLockFences(ResourceProvider::ResourceId id, bool enable); |
369 | 369 |
370 // Indicates if we can currently lock this resource for write. | 370 // Indicates if we can currently lock this resource for write. |
371 bool CanLockForWrite(ResourceId id); | 371 bool CanLockForWrite(ResourceId id); |
372 | 372 |
| 373 // Copy pixels from source to destination. |
| 374 void CopyResource(ResourceId source_id, ResourceId dest_id); |
| 375 |
373 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); | 376 static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); |
374 | 377 |
375 private: | 378 private: |
376 class DirectRasterBuffer; | 379 class DirectRasterBuffer; |
377 class ImageRasterBuffer; | 380 class ImageRasterBuffer; |
378 class PixelRasterBuffer; | 381 class PixelRasterBuffer; |
379 | 382 |
380 struct Resource { | 383 struct Resource { |
381 enum Origin { Internal, External, Delegated }; | 384 enum Origin { Internal, External, Delegated }; |
382 | 385 |
(...skipping 19 matching lines...) Expand all Loading... |
402 Origin origin, | 405 Origin origin, |
403 GLenum filter, | 406 GLenum filter, |
404 GLint wrap_mode); | 407 GLint wrap_mode); |
405 | 408 |
406 int child_id; | 409 int child_id; |
407 unsigned gl_id; | 410 unsigned gl_id; |
408 // Pixel buffer used for set pixels without unnecessary copying. | 411 // Pixel buffer used for set pixels without unnecessary copying. |
409 unsigned gl_pixel_buffer_id; | 412 unsigned gl_pixel_buffer_id; |
410 // Query used to determine when asynchronous set pixels complete. | 413 // Query used to determine when asynchronous set pixels complete. |
411 unsigned gl_upload_query_id; | 414 unsigned gl_upload_query_id; |
| 415 // Query used to determine when read lock fence has passed. |
| 416 unsigned gl_read_lock_query_id; |
412 TextureMailbox mailbox; | 417 TextureMailbox mailbox; |
413 ReleaseCallback release_callback; | 418 ReleaseCallback release_callback; |
414 uint8_t* pixels; | 419 uint8_t* pixels; |
415 int lock_for_read_count; | 420 int lock_for_read_count; |
416 int imported_count; | 421 int imported_count; |
417 int exported_count; | 422 int exported_count; |
418 bool dirty_image : 1; | 423 bool dirty_image : 1; |
419 bool locked_for_write : 1; | 424 bool locked_for_write : 1; |
420 bool lost : 1; | 425 bool lost : 1; |
421 bool marked_for_deletion : 1; | 426 bool marked_for_deletion : 1; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 return format_gl_data_format[format]; | 696 return format_gl_data_format[format]; |
692 } | 697 } |
693 | 698 |
694 inline GLenum GLInternalFormat(ResourceFormat format) { | 699 inline GLenum GLInternalFormat(ResourceFormat format) { |
695 return GLDataFormat(format); | 700 return GLDataFormat(format); |
696 } | 701 } |
697 | 702 |
698 } // namespace cc | 703 } // namespace cc |
699 | 704 |
700 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 705 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |