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

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

Issue 1157943004: cc: [WIP] Use worker context and OrderingBarrierCHROMIUM for one-copy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handle sync while copying texture. Created 5 years, 6 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 <deque> 8 #include <deque>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 ~SynchronousFence() override; 392 ~SynchronousFence() override;
393 393
394 void Synchronize(); 394 void Synchronize();
395 395
396 gpu::gles2::GLES2Interface* gl_; 396 gpu::gles2::GLES2Interface* gl_;
397 bool has_synchronized_; 397 bool has_synchronized_;
398 398
399 DISALLOW_COPY_AND_ASSIGN(SynchronousFence); 399 DISALLOW_COPY_AND_ASSIGN(SynchronousFence);
400 }; 400 };
401 401
402 // Query object based fence implementation used to detect completion of copy
403 // texture operations. Fence has passed when query result is available.
404 class CopyTextureFence : public ResourceProvider::Fence {
405 public:
406 CopyTextureFence(gpu::gles2::GLES2Interface* gl, unsigned query_id)
407 : gl_(gl), query_id_(query_id) {}
408
409 // Overridden from ResourceProvider::Fence:
410 void Set() override {}
411 bool HasPassed() override;
412 void Wait() override;
413
414 private:
415 ~CopyTextureFence() override {}
416
417 void ProcessResult();
418
419 gpu::gles2::GLES2Interface* gl_;
420 unsigned query_id_;
421
422 DISALLOW_COPY_AND_ASSIGN(CopyTextureFence);
423 };
424
402 // Acquire pixel buffer for resource. The pixel buffer can be used to 425 // Acquire pixel buffer for resource. The pixel buffer can be used to
403 // set resource pixels without performing unnecessary copying. 426 // set resource pixels without performing unnecessary copying.
404 void AcquirePixelBuffer(ResourceId resource); 427 void AcquirePixelBuffer(ResourceId resource);
405 void ReleasePixelBuffer(ResourceId resource); 428 void ReleasePixelBuffer(ResourceId resource);
406 // Map/unmap the acquired pixel buffer. 429 // Map/unmap the acquired pixel buffer.
407 uint8_t* MapPixelBuffer(ResourceId id, int* stride); 430 uint8_t* MapPixelBuffer(ResourceId id, int* stride);
408 void UnmapPixelBuffer(ResourceId id); 431 void UnmapPixelBuffer(ResourceId id);
409 // Asynchronously update pixels from acquired pixel buffer. 432 // Asynchronously update pixels from acquired pixel buffer.
410 void BeginSetPixels(ResourceId id); 433 void BeginSetPixels(ResourceId id);
411 void ForceSetPixelsToComplete(ResourceId id); 434 void ForceSetPixelsToComplete(ResourceId id);
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 return format_gl_data_format[format]; 688 return format_gl_data_format[format];
666 } 689 }
667 690
668 inline GLenum GLInternalFormat(ResourceFormat format) { 691 inline GLenum GLInternalFormat(ResourceFormat format) {
669 return GLDataFormat(format); 692 return GLDataFormat(format);
670 } 693 }
671 694
672 } // namespace cc 695 } // namespace cc
673 696
674 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 697 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698