Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
impeller::GpuSubmissionTracker Class Referenceabstract

Tracks GPU completion of submitted command buffers as a monotonic watermark. More...

#include <gpu_submission_tracker.h>

Public Member Functions

uint64_t RecordSubmission ()
 Records a command buffer submission and returns its id.
 
void RecordCompletion (uint64_t id)
 Marks a previously recorded submission as completed by the GPU.
 
uint64_t CompletedThrough () const
 
uint64_t LatestSubmission () const
 Returns the id of the most recent submission.
 

Detailed Description

Tracks GPU completion of submitted command buffers as a monotonic watermark.

Backends record an id for each submitted command buffer and mark it from the command buffer's completion callback. Consumers compare ids against [CompletedThrough] to find out whether the GPU is done with all work submitted up to a point in time, regardless of the order in which individual command buffers complete.

All methods are thread safe.

Definition at line 25 of file gpu_submission_tracker.h.

Member Function Documentation

◆ CompletedThrough()

uint64_t impeller::GpuSubmissionTracker::CompletedThrough ( ) const

Returns the highest id such that all submissions with ids up to and including it have completed.

Definition at line 26 of file gpu_submission_tracker.cc.

26 {
27 Lock lock(mutex_);
28 if (pending_.empty()) {
29 return last_id_;
30 }
31 return pending_.front() - 1;
32}

Referenced by impeller::testing::TEST().

◆ LatestSubmission()

uint64_t impeller::GpuSubmissionTracker::LatestSubmission ( ) const

Returns the id of the most recent submission.

Definition at line 34 of file gpu_submission_tracker.cc.

34 {
35 Lock lock(mutex_);
36 return last_id_;
37}

Referenced by impeller::testing::TEST().

◆ RecordCompletion()

void impeller::GpuSubmissionTracker::RecordCompletion ( uint64_t  id)

Marks a previously recorded submission as completed by the GPU.

Definition at line 18 of file gpu_submission_tracker.cc.

18 {
19 Lock lock(mutex_);
20 auto it = std::lower_bound(pending_.begin(), pending_.end(), id);
21 if (it != pending_.end() && *it == id) {
22 pending_.erase(it);
23 }
24}

Referenced by impeller::testing::TEST().

◆ RecordSubmission()

uint64_t impeller::GpuSubmissionTracker::RecordSubmission ( )

Records a command buffer submission and returns its id.

Definition at line 11 of file gpu_submission_tracker.cc.

11 {
12 Lock lock(mutex_);
13 uint64_t id = ++last_id_;
14 pending_.push_back(id);
15 return id;
16}
const uintptr_t id

References id.

Referenced by impeller::testing::TEST().


The documentation for this class was generated from the following files: