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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 285 |
286 // Update pixels from acquired pixel buffer. | 286 // Update pixels from acquired pixel buffer. |
287 void SetPixelsFromBuffer(ResourceId id); | 287 void SetPixelsFromBuffer(ResourceId id); |
288 | 288 |
289 // Asynchronously update pixels from acquired pixel buffer. | 289 // Asynchronously update pixels from acquired pixel buffer. |
290 void BeginSetPixels(ResourceId id); | 290 void BeginSetPixels(ResourceId id); |
291 void ForceSetPixelsToComplete(ResourceId id); | 291 void ForceSetPixelsToComplete(ResourceId id); |
292 bool DidSetPixelsComplete(ResourceId id); | 292 bool DidSetPixelsComplete(ResourceId id); |
293 void AbortSetPixels(ResourceId id); | 293 void AbortSetPixels(ResourceId id); |
294 | 294 |
| 295 // Acquire and release an image. The image allows direct |
| 296 // manipulation of texture memory. |
| 297 void AcquireImage(ResourceId id); |
| 298 void ReleaseImage(ResourceId id); |
| 299 |
| 300 // Maps the acquired image so that its pixels could be modified. |
| 301 // Unmap is called when all pixels are set. |
| 302 uint8_t* MapImage(ResourceId id); |
| 303 void UnmapImage(ResourceId id); |
| 304 |
| 305 // Binds the image to a texture. |
| 306 void BindImage(ResourceId id); |
| 307 |
| 308 // Returns the stride for the image. |
| 309 int GetImageStride(ResourceId id); |
| 310 |
295 // For tests only! This prevents detecting uninitialized reads. | 311 // For tests only! This prevents detecting uninitialized reads. |
296 // Use SetPixels or LockForWrite to allocate implicitly. | 312 // Use SetPixels or LockForWrite to allocate implicitly. |
297 void AllocateForTesting(ResourceId id); | 313 void AllocateForTesting(ResourceId id); |
298 | 314 |
299 // Sets the current read fence. If a resource is locked for read | 315 // Sets the current read fence. If a resource is locked for read |
300 // and has read fences enabled, the resource will not allow writes | 316 // and has read fences enabled, the resource will not allow writes |
301 // until this fence has passed. | 317 // until this fence has passed. |
302 void SetReadLockFence(scoped_refptr<Fence> fence) { | 318 void SetReadLockFence(scoped_refptr<Fence> fence) { |
303 current_read_lock_fence_ = fence; | 319 current_read_lock_fence_ = fence; |
304 } | 320 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 bool marked_for_deletion; | 356 bool marked_for_deletion; |
341 bool pending_set_pixels; | 357 bool pending_set_pixels; |
342 bool set_pixels_completion_forced; | 358 bool set_pixels_completion_forced; |
343 bool allocated; | 359 bool allocated; |
344 bool enable_read_lock_fences; | 360 bool enable_read_lock_fences; |
345 scoped_refptr<Fence> read_lock_fence; | 361 scoped_refptr<Fence> read_lock_fence; |
346 gfx::Size size; | 362 gfx::Size size; |
347 GLenum format; | 363 GLenum format; |
348 // TODO(skyostil): Use a separate sampler object for filter state. | 364 // TODO(skyostil): Use a separate sampler object for filter state. |
349 GLenum filter; | 365 GLenum filter; |
| 366 unsigned image_id; |
350 ResourceType type; | 367 ResourceType type; |
351 }; | 368 }; |
352 typedef base::hash_map<ResourceId, Resource> ResourceMap; | 369 typedef base::hash_map<ResourceId, Resource> ResourceMap; |
353 struct Child { | 370 struct Child { |
354 Child(); | 371 Child(); |
355 ~Child(); | 372 ~Child(); |
356 | 373 |
357 ResourceIdMap child_to_parent_map; | 374 ResourceIdMap child_to_parent_map; |
358 ResourceIdMap parent_to_child_map; | 375 ResourceIdMap parent_to_child_map; |
359 }; | 376 }; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 base::ThreadChecker thread_checker_; | 422 base::ThreadChecker thread_checker_; |
406 | 423 |
407 scoped_refptr<Fence> current_read_lock_fence_; | 424 scoped_refptr<Fence> current_read_lock_fence_; |
408 | 425 |
409 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); | 426 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
410 }; | 427 }; |
411 | 428 |
412 } // namespace cc | 429 } // namespace cc |
413 | 430 |
414 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ | 431 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ |
OLD | NEW |