5 #ifndef FLUTTER_IMPELLER_RENDERER_RENDER_TARGET_H_
6 #define FLUTTER_IMPELLER_RENDERER_RENDER_TARGET_H_
12 #include "flutter/fml/hash_combine.h"
32 constexpr
size_t Hash()
const {
85 std::string_view label =
"Offscreen",
88 const std::shared_ptr<Texture>& depth_stencil_texture =
nullptr);
115 std::optional<StencilAttachment> attachment);
126 const std::function<
bool(
size_t index,
131 const std::function<
bool(
const Attachment& attachment)>& iterator)
const;
138 std::optional<ColorAttachment> color0_;
139 std::optional<DepthAttachment> depth_;
140 std::optional<StencilAttachment> stencil_;
144 std::map<size_t, ColorAttachment> colors_;
159 std::string_view label =
"Offscreen",
162 std::optional<RenderTarget::AttachmentConfig> stencil_attachment_config =
164 const std::shared_ptr<Texture>& existing_color_texture =
nullptr,
165 const std::shared_ptr<Texture>& existing_depth_stencil_texture =
nullptr);
171 std::string_view label =
"Offscreen MSAA",
174 std::optional<RenderTarget::AttachmentConfig> stencil_attachment_config =
176 const std::shared_ptr<Texture>& existing_color_msaa_texture =
nullptr,
177 const std::shared_ptr<Texture>& existing_color_resolve_texture =
nullptr,
178 const std::shared_ptr<Texture>& existing_depth_stencil_texture =
nullptr);
190 virtual void Start();
198 std::shared_ptr<Allocator> allocator_;
An object that allocates device memory.
To do anything rendering related with Impeller, you need a context.
a wrapper around the impeller [Allocator] instance that can be used to provide caching of allocated r...
RenderTargetAllocator(std::shared_ptr< Allocator > allocator)
virtual ~RenderTargetAllocator()=default
virtual void EnableCache()
Re-enable any caching if disabled.
virtual RenderTarget CreateOffscreenMSAA(const Context &context, ISize size, int mip_count, std::string_view label="Offscreen MSAA", RenderTarget::AttachmentConfigMSAA color_attachment_config=RenderTarget::kDefaultColorAttachmentConfigMSAA, std::optional< RenderTarget::AttachmentConfig > stencil_attachment_config=RenderTarget::kDefaultStencilAttachmentConfig, const std::shared_ptr< Texture > &existing_color_msaa_texture=nullptr, const std::shared_ptr< Texture > &existing_color_resolve_texture=nullptr, const std::shared_ptr< Texture > &existing_depth_stencil_texture=nullptr)
virtual RenderTarget CreateOffscreen(const Context &context, ISize size, int mip_count, std::string_view label="Offscreen", RenderTarget::AttachmentConfig color_attachment_config=RenderTarget::kDefaultColorAttachmentConfig, std::optional< RenderTarget::AttachmentConfig > stencil_attachment_config=RenderTarget::kDefaultStencilAttachmentConfig, const std::shared_ptr< Texture > &existing_color_texture=nullptr, const std::shared_ptr< Texture > &existing_depth_stencil_texture=nullptr)
virtual void Start()
Mark the beginning of a frame workload.
virtual void DisableCache()
Disable any caching until the next call to EnabledCache.
virtual void End()
Mark the end of a frame workload.
ColorAttachment GetColorAttachment(size_t index) const
Get the color attachment at [index].
std::shared_ptr< Texture > GetRenderTargetTexture() const
static constexpr AttachmentConfig kDefaultColorAttachmentConfig
SampleCount GetSampleCount() const
static constexpr AttachmentConfigMSAA kDefaultColorAttachmentConfigMSAA
void IterateAllAttachments(const std::function< bool(const Attachment &attachment)> &iterator) const
RenderTarget & SetColorAttachment(const ColorAttachment &attachment, size_t index)
bool HasColorAttachment(size_t index) const
size_t GetMaxColorAttacmentBindIndex() const
static constexpr AttachmentConfig kDefaultStencilAttachmentConfig
std::string ToString() const
RenderTarget & SetDepthAttachment(std::optional< DepthAttachment > attachment)
PixelFormat GetRenderTargetPixelFormat() const
size_t GetTotalAttachmentCount() const
ISize GetRenderTargetSize() const
RenderTarget & SetStencilAttachment(std::optional< StencilAttachment > attachment)
bool IterateAllColorAttachments(const std::function< bool(size_t index, const ColorAttachment &attachment)> &iterator) const
std::optional< ISize > GetColorAttachmentSize(size_t index) const
const std::optional< DepthAttachment > & GetDepthAttachment() const
const std::optional< StencilAttachment > & GetStencilAttachment() const
void SetupDepthStencilAttachments(const Context &context, Allocator &allocator, ISize size, bool msaa, std::string_view label="Offscreen", RenderTarget::AttachmentConfig stencil_attachment_config=RenderTarget::kDefaultStencilAttachmentConfig, const std::shared_ptr< Texture > &depth_stencil_texture=nullptr)
RenderTargetConfig ToConfig() const
StorageMode
Specified where the allocation resides and how it is used.
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
static constexpr Color BlackTransparent()
StorageMode resolve_storage_mode
constexpr size_t Hash() const
constexpr bool operator==(const RenderTargetConfig &o) const