5 #ifndef FLUTTER_IMPELLER_RENDERER_CONTEXT_H_
6 #define FLUTTER_IMPELLER_RENDERER_CONTEXT_H_
12 #include "fml/closure.h"
25 class PipelineLibrary;
32 std::future<std::shared_ptr<impeller::Context>> context);
34 std::shared_ptr<impeller::Context>
GetContext();
38 std::future<std::shared_ptr<impeller::Context>> future_;
39 std::shared_ptr<impeller::Context> context_;
40 bool did_wait_ =
false;
206 const fml::closure& failure) {
207 FML_CHECK(
false &&
"not supported in this context");
235 std::shared_ptr<CommandBuffer> command_buffer);
244 virtual bool AddTrackingFence(
const std::shared_ptr<Texture>& texture)
const;
246 virtual std::shared_ptr<const IdleWaiter>
GetIdleWaiter()
const;
265 virtual bool SubmitOnscreen(std::shared_ptr<CommandBuffer> cmd_buffer);
To do anything rendering related with Impeller, you need a context.
virtual std::shared_ptr< const IdleWaiter > GetIdleWaiter() const
virtual bool AddTrackingFence(const std::shared_ptr< Texture > &texture) const
virtual std::shared_ptr< SamplerLibrary > GetSamplerLibrary() const =0
Returns the library of combined image samplers used in shaders.
virtual std::shared_ptr< CommandBuffer > CreateCommandBuffer() const =0
Create a new command buffer. Command buffers can be used to encode graphics, blit,...
virtual std::shared_ptr< PipelineLibrary > GetPipelineLibrary() const =0
Returns the library of pipelines used by render or compute commands.
virtual bool SubmitOnscreen(std::shared_ptr< CommandBuffer > cmd_buffer)
Submit the command buffer that renders to the onscreen surface.
virtual std::shared_ptr< ShaderLibrary > GetShaderLibrary() const =0
Returns the library of shaders used to specify the programmable stages of a pipeline.
const Flags & GetFlags() const
static constexpr int32_t kMaxTasksAwaitingGPU
virtual const std::shared_ptr< const Capabilities > & GetCapabilities() const =0
Get the capabilities of Impeller context. All optionally supported feature of the platform,...
std::vector< std::function< void()> > per_frame_task_
virtual bool UpdateOffscreenLayerPixelFormat(PixelFormat format)
virtual BackendType GetBackendType() const =0
Get the graphics backend of an Impeller context.
virtual void Shutdown()=0
Force all pending asynchronous work to finish. This is achieved by deleting all owned concurrent mess...
Context(const Flags &flags)
virtual void DisposeThreadLocalCachedResources()
virtual bool FlushCommandBuffers()
Flush all pending command buffers.
virtual std::shared_ptr< CommandQueue > GetCommandQueue() const =0
Return the graphics queue for submitting command buffers.
virtual RuntimeStageBackend GetRuntimeStageBackend() const =0
Retrieve the runtime stage for this context type.
virtual void StoreTaskForGPU(const fml::closure &task, const fml::closure &failure)
virtual void InitializeCommonlyUsedShadersIfNeeded() const
virtual std::shared_ptr< Allocator > GetResourceAllocator() const =0
Returns the allocator used to create textures and buffers on the device.
virtual std::string DescribeGpuModel() const =0
virtual ~Context()
Destroys an Impeller context.
virtual bool IsValid() const =0
Determines if a context is valid. If the caller ever receives an invalid context, they must discard i...
virtual void ResetThreadLocalState() const
virtual bool EnqueueCommandBuffer(std::shared_ptr< CommandBuffer > command_buffer)
Enqueue command_buffer for submission by the end of the frame.
ImpellerContextFuture(std::future< std::shared_ptr< impeller::Context >> context)
std::shared_ptr< impeller::Context > GetContext()
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...