5 #ifndef FLUTTER_IMPELLER_RENDERER_PIPELINE_H_
6 #define FLUTTER_IMPELLER_RENDERER_PIPELINE_H_
21 class PipelineLibrary;
22 template <
typename PipelineDescriptor_>
28 std::shared_future<std::shared_ptr<Pipeline<T>>>
future;
30 const std::shared_ptr<Pipeline<T>>
Get()
const {
return future.get(); }
67 std::function<
void(T& desc)> descriptor_callback)
const;
74 Pipeline(std::weak_ptr<PipelineLibrary> library, T desc);
93 std::optional<PipelineDescriptor> desc);
97 std::optional<ComputePipelineDescriptor> desc);
105 template <
class VertexShader_,
class FragmentShader_>
109 "The output slots for the fragment shader don't have matches in the "
110 "vertex shader's output slots. This will result in a linker error.");
120 Builder::MakeDefaultPipelineDescriptor(context))) {}
123 std::optional<PipelineDescriptor> desc)
127 : pipeline_future_(
std::move(future)) {}
134 if (pipeline_future_.IsValid()) {
135 pipeline_ = pipeline_future_.Get();
141 return pipeline_future_.descriptor;
146 std::shared_ptr<Pipeline<PipelineDescriptor>> pipeline_;
147 bool did_wait_ =
false;
154 template <
class ComputeShader_>
163 Builder::MakeDefaultPipelineDescriptor(context))) {}
167 std::optional<ComputePipelineDescriptor> compute_desc)
172 : pipeline_future_(
std::move(future)) {}
174 std::shared_ptr<Pipeline<ComputePipelineDescriptor>>
WaitAndGet() {
179 if (pipeline_future_.IsValid()) {
180 pipeline_ = pipeline_future_.Get();
187 std::shared_ptr<Pipeline<ComputePipelineDescriptor>> pipeline_;
188 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
RenderPipelineHandle(PipelineFuture< PipelineDescriptor > future)
std::shared_ptr< Pipeline< PipelineDescriptor > > WaitAndGet()
RenderPipelineHandle(const Context &context)
FragmentShader_ FragmentShader
std::optional< PipelineDescriptor > GetDescriptor() const
Checks, at C++ compile-time, if the two pipeline stages are compatible.
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...
std::shared_future< std::shared_ptr< Pipeline< T > > > future
const std::shared_ptr< Pipeline< T > > Get() const
std::optional< T > descriptor