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);
116 template <
class VertexShader_,
class FragmentShader_>
126 Builder::MakeDefaultPipelineDescriptor(context),
130 std::optional<PipelineDescriptor> desc,
136 : pipeline_future_(
std::move(future)) {}
143 if (pipeline_future_.IsValid()) {
144 pipeline_ = pipeline_future_.Get();
150 return pipeline_future_.descriptor;
155 std::shared_ptr<Pipeline<PipelineDescriptor>> pipeline_;
156 bool did_wait_ =
false;
163 template <
class ComputeShader_>
172 Builder::MakeDefaultPipelineDescriptor(context))) {}
176 std::optional<ComputePipelineDescriptor> compute_desc)
181 : pipeline_future_(
std::move(future)) {}
183 std::shared_ptr<Pipeline<ComputePipelineDescriptor>>
WaitAndGet() {
188 if (pipeline_future_.IsValid()) {
189 pipeline_ = pipeline_future_.Get();
196 std::shared_ptr<Pipeline<ComputePipelineDescriptor>> pipeline_;
197 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.
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)
std::shared_ptr< Pipeline< PipelineDescriptor > > WaitAndGet()
FragmentShader_ FragmentShader
std::optional< PipelineDescriptor > GetDescriptor() const
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