5#ifndef FLUTTER_IMPELLER_RENDERER_PIPELINE_H_
6#define FLUTTER_IMPELLER_RENDERER_PIPELINE_H_
21template <
typename PipelineDescriptor_>
27 std::shared_future<std::shared_ptr<Pipeline<T>>>
future;
29 const std::shared_ptr<Pipeline<T>>
Get()
const {
return future.get(); }
86 std::optional<PipelineDescriptor>
desc);
90 std::optional<ComputePipelineDescriptor>
desc);
98template <
class VertexShader_,
class FragmentShader_>
102 "The output slots for the fragment shader don't have matches in the "
103 "vertex shader's output slots. This will result in a linker error.");
113 Builder::MakeDefaultPipelineDescriptor(context))) {}
116 std::optional<PipelineDescriptor>
desc)
120 : pipeline_future_(
std::move(future)) {}
127 if (pipeline_future_.IsValid()) {
128 pipeline_ = pipeline_future_.Get();
134 return pipeline_future_.descriptor;
139 std::shared_ptr<Pipeline<PipelineDescriptor>> pipeline_;
140 bool did_wait_ =
false;
147template <
class ComputeShader_>
156 Builder::MakeDefaultPipelineDescriptor(context))) {}
160 std::optional<ComputePipelineDescriptor> compute_desc)
165 : pipeline_future_(
std::move(future)) {}
167 std::shared_ptr<Pipeline<ComputePipelineDescriptor>>
WaitAndGet() {
172 if (pipeline_future_.IsValid()) {
173 pipeline_ = pipeline_future_.Get();
180 std::shared_ptr<Pipeline<ComputePipelineDescriptor>> pipeline_;
181 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)
VertexShader_ VertexShader
std::optional< PipelineDescriptor > GetDescriptor() const
RenderPipelineHandle(PipelineFuture< PipelineDescriptor > future)
std::shared_ptr< Pipeline< PipelineDescriptor > > WaitAndGet()
RenderPipelineHandle(const Context &context)
FragmentShader_ FragmentShader
static constexpr bool Check()
Dart_NativeFunction function
PipelineFuture< PipelineDescriptor > CreatePipelineFuture(const Context &context, std::optional< PipelineDescriptor > desc)
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...
const std::shared_ptr< Pipeline< T > > Get() const
std::shared_future< std::shared_ptr< Pipeline< T > > > future
std::optional< T > descriptor