5 #ifndef FLUTTER_IMPELLER_RENDERER_PIPELINE_H_
6 #define FLUTTER_IMPELLER_RENDERER_PIPELINE_H_
24 template <
typename PipelineDescriptor_>
30 std::shared_future<std::shared_ptr<Pipeline<T>>>
future;
32 const std::shared_ptr<Pipeline<T>>
Get()
const {
return future.get(); }
69 std::function<
void(T& desc)> descriptor_callback)
const;
76 Pipeline(std::weak_ptr<PipelineLibrary> library, T desc);
103 std::optional<PipelineDescriptor> desc,
108 std::optional<ComputePipelineDescriptor> desc);
117 std::optional<PipelineDescriptor> desc,
124 : pipeline_future_(
std::move(future)) {}
133 if (pipeline_future_.IsValid()) {
134 pipeline_ = pipeline_future_.Get();
140 return pipeline_future_.descriptor;
145 std::shared_ptr<Pipeline<PipelineDescriptor>> pipeline_;
146 bool did_wait_ =
false;
160 template <
class VertexShader_,
class FragmentShader_>
170 Builder::MakeDefaultPipelineDescriptor(context),
174 std::optional<PipelineDescriptor> desc,
187 template <
class ComputeShader_>
196 Builder::MakeDefaultPipelineDescriptor(context))) {}
200 std::optional<ComputePipelineDescriptor> compute_desc)
205 : pipeline_future_(
std::move(future)) {}
207 std::shared_ptr<Pipeline<ComputePipelineDescriptor>>
WaitAndGet() {
212 if (pipeline_future_.IsValid()) {
213 pipeline_ = pipeline_future_.Get();
220 std::shared_ptr<Pipeline<ComputePipelineDescriptor>> pipeline_;
221 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()
Describes the fixed function and programmable aspects of rendering and compute operations performed b...
PipelineFuture< T > CreateVariant(bool async, std::function< void(T &desc)> descriptor_callback) const
const std::weak_ptr< PipelineLibrary > library_
virtual bool IsValid() const =0
Pipeline(std::weak_ptr< PipelineLibrary > library, T desc)
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