A task queue designed for managing compilation of pipeline state objects. More...
#include <pipeline_compile_queue.h>
Public Member Functions | |
| PipelineCompileQueue ()=default | |
| virtual | ~PipelineCompileQueue () |
| PipelineCompileQueue (const PipelineCompileQueue &)=delete | |
| PipelineCompileQueue & | operator= (const PipelineCompileQueue &)=delete |
| bool | PostJobForDescriptor (const PipelineDescriptor &desc, const fml::closure &job) |
| Post a compile job for the specified descriptor. | |
| void | PerformJobEagerly (const PipelineDescriptor &desc) |
| If the task has not yet been done, perform it eagerly on the calling thread. This can be used in lieu of an idle wait for the task completion on the calling thread. | |
Protected Member Functions | |
| virtual void | PostJob (const fml::closure &job)=0 |
| Post a compilation job to the worker task runner. | |
| virtual void | OnJobAdded ()=0 |
| Called by PostJobForDescriptor after a job has been successfully added to the queue. Subclasses must implement this to define their scheduling strategy. | |
| void | DoOneJob () |
| Execute one pending compilation job from the queue. | |
| bool | AddJob (const PipelineDescriptor &desc, const fml::closure &job) |
| Add a compilation job to the pending queue for the specified descriptor. | |
| bool | HasPendingJobs () |
| Check if there are any pending compilation jobs in the queue. | |
A task queue designed for managing compilation of pipeline state objects.
The task queue attempts to perform compile jobs as quickly as possible by dispatching tasks to a concurrent task runner. These tasks are dispatched during renderer creation and usually complete before the first frame is rendered. In this ideal case, this queue is entirely unnecessary and and serves as a thin wrapper around just posting the compile jobs to a concurrent task runner.
If however, usually on lower end device, the compile jobs cannot be completed before the first frame is rendered, the implicit act of waiting for the compile job to be done can instead be augmented to take the pending job and perform it eagerly on the waiters thread. This effectively turns an idle wait into the job skipping to the front of the line and being done on the callers thread.
Again, the entire point of this class is the reduce startup times on the lowest end devices. On high end device, a queue is entirely optional. The queue skipping mechanism all assume the optional availability of a compile queue.
Definition at line 42 of file pipeline_compile_queue.h.
|
default |
|
virtual |
Definition at line 12 of file pipeline_compile_queue.cc.
|
delete |
|
protected |
Add a compilation job to the pending queue for the specified descriptor.
| [in] | desc | The pipeline descriptor that identifies the job |
| [in] | job | The compilation job closure to add |
Definition at line 37 of file pipeline_compile_queue.cc.
Referenced by impeller::testing::TestPipelineCompileQueue::AddJobForTest(), and PostJobForDescriptor().
|
protected |
Execute one pending compilation job from the queue.
This method retrieves and executes a single job from the
pending jobs queue. It is typically called by subclasses
when they are ready to process the next job in the queue.
Definition at line 81 of file pipeline_compile_queue.cc.
|
protected |
Check if there are any pending compilation jobs in the queue.
Definition at line 44 of file pipeline_compile_queue.cc.
Referenced by impeller::testing::TestPipelineCompileQueue::HasPendingJobsForTest().
|
protectedpure virtual |
Called by PostJobForDescriptor after a job has been successfully added to the queue. Subclasses must implement this to define their scheduling strategy.
The default implementation for duplicate descriptors is to run the job eagerly. Subclasses can override this behavior by checking for duplicates before calling the base class.
Implemented in impeller::PipelineCompileQueueGLES, impeller::PipelineCompileQueueVulkan, and impeller::testing::TestPipelineCompileQueue.
Referenced by PostJobForDescriptor().
|
delete |
| void impeller::PipelineCompileQueue::PerformJobEagerly | ( | const PipelineDescriptor & | desc | ) |
If the task has not yet been done, perform it eagerly on the calling thread. This can be used in lieu of an idle wait for the task completion on the calling thread.
| [in] | desc | The description |
Definition at line 104 of file pipeline_compile_queue.cc.
|
protectedpure virtual |
Post a compilation job to the worker task runner.
This is a pure virtual function that must be implemented by
subclasses. It is responsible for actually dispatching the
job closure to the appropriate task runner for execution.
| [in] | job | The compilation job closure to post |
Implemented in impeller::PipelineCompileQueueGLES, impeller::PipelineCompileQueueVulkan, and impeller::testing::TestPipelineCompileQueue.
Referenced by PostJobForDescriptor().
| bool impeller::PipelineCompileQueue::PostJobForDescriptor | ( | const PipelineDescriptor & | desc, |
| const fml::closure & | job | ||
| ) |
Post a compile job for the specified descriptor.
| [in] | desc | The description |
| [in] | job | The job |
Definition at line 16 of file pipeline_compile_queue.cc.
References AddJob(), FML_LOG, OnJobAdded(), and PostJob().