5 #ifndef FLUTTER_IMPELLER_RENDERER_PIPELINE_H_
6 #define FLUTTER_IMPELLER_RENDERER_PIPELINE_H_
25 template <
typename PipelineDescriptor_>
31 std::shared_future<std::shared_ptr<Pipeline<T>>>
future;
33 const std::shared_ptr<Pipeline<T>>
Get()
const {
return future.get(); }
70 const std::function<
void(T& desc)>& descriptor_callback)
const;
77 Pipeline(std::weak_ptr<PipelineLibrary> library,
const T& desc);
104 std::optional<PipelineDescriptor> desc,
109 std::optional<ComputePipelineDescriptor> desc);
118 std::optional<PipelineDescriptor> desc,
125 : pipeline_future_(
std::move(future)) {}
135 if (pipeline_future_.IsValid()) {
136 if (queue !=
nullptr && pipeline_future_.descriptor.has_value()) {
139 pipeline_ = pipeline_future_.Get();
145 return pipeline_future_.descriptor;
150 std::shared_ptr<Pipeline<PipelineDescriptor>> pipeline_;
151 bool did_wait_ =
false;
165 template <
class VertexShader_,
class FragmentShader_>
175 Builder::MakeDefaultPipelineDescriptor(context),
179 std::optional<PipelineDescriptor> desc,
192 template <
class ComputeShader_>
201 Builder::MakeDefaultPipelineDescriptor(context))) {}
205 std::optional<ComputePipelineDescriptor> compute_desc)
210 : pipeline_future_(
std::move(future)) {}
212 std::shared_ptr<Pipeline<ComputePipelineDescriptor>>
WaitAndGet() {
217 if (pipeline_future_.IsValid()) {
218 pipeline_ = pipeline_future_.Get();
225 std::shared_ptr<Pipeline<ComputePipelineDescriptor>> pipeline_;
226 bool did_wait_ =
false;
ComputePipelineHandle(PipelineFuture< ComputePipelineDescriptor > future)
ComputePipelineHandle(const Context &context, std::optional< ComputePipelineDescriptor > compute_desc)
ComputePipelineHandle(const Context &context)
ComputeShader_ ComputeShader
std::shared_ptr< Pipeline< ComputePipelineDescriptor > > WaitAndGet()
To do anything rendering related with Impeller, you need a context.
virtual ~GenericRenderPipelineHandle()=default
std::optional< PipelineDescriptor > GetDescriptor() const
GenericRenderPipelineHandle(PipelineFuture< PipelineDescriptor > future)
GenericRenderPipelineHandle(const Context &context, std::optional< PipelineDescriptor > desc, bool async=true)
std::shared_ptr< Pipeline< PipelineDescriptor > > WaitAndGet(PipelineCompileQueue *queue)
A task queue designed for managing compilation of pipeline state objects.
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...
Describes the fixed function and programmable aspects of rendering and compute operations performed b...
Pipeline(std::weak_ptr< PipelineLibrary > library, const T &desc)
PipelineFuture< T > CreateVariant(bool async, const std::function< void(T &desc)> &descriptor_callback) const
const std::weak_ptr< PipelineLibrary > library_
virtual bool IsValid() const =0
const T & GetDescriptor() const
Get the descriptor that was responsible for creating this pipeline. It may be copied and modified to ...
RenderPipelineHandle(const Context &context, std::optional< PipelineDescriptor > desc, bool async=true)
VertexShader_ VertexShader
RenderPipelineHandle(const Context &context, bool async=true)
RenderPipelineHandle(PipelineFuture< PipelineDescriptor > future)
FragmentShader_ FragmentShader
PipelineFuture< PipelineDescriptor > CreatePipelineFuture(const Context &context, std::optional< PipelineDescriptor > desc, bool async)
Create a pipeline for the given descriptor.
An optional (but highly recommended) utility for creating pipelines from reflected shader information...
An optional (but highly recommended) utility for creating pipelines from reflected shader information...
std::shared_future< std::shared_ptr< Pipeline< T > > > future
const std::shared_ptr< Pipeline< T > > Get() const
std::optional< T > descriptor