5#ifndef FLUTTER_IMPELLER_RENDERER_RENDER_TARGET_H_
6#define FLUTTER_IMPELLER_RENDERER_RENDER_TARGET_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,
166 std::optional<PixelFormat> target_pixel_format = std::nullopt);
172 std::string_view label =
"Offscreen MSAA",
175 std::optional<RenderTarget::AttachmentConfig> stencil_attachment_config =
177 const std::shared_ptr<Texture>& existing_color_msaa_texture =
nullptr,
178 const std::shared_ptr<Texture>& existing_color_resolve_texture =
nullptr,
179 const std::shared_ptr<Texture>& existing_depth_stencil_texture =
nullptr,
180 std::optional<PixelFormat> target_pixel_format = std::nullopt);
192 virtual void Start();
200 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...
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, std::optional< PixelFormat > target_pixel_format=std::nullopt)
virtual ~RenderTargetAllocator()=default
virtual void EnableCache()
Re-enable any caching if disabled.
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, std::optional< PixelFormat > target_pixel_format=std::nullopt)
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
static constexpr AttachmentConfig kDefaultStencilAttachmentConfig
std::string ToString() const
RenderTarget & SetDepthAttachment(std::optional< DepthAttachment > attachment)
size_t GetMaxColorAttachmentBindIndex() const
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
std::shared_ptr< ImpellerAllocator > allocator
constexpr std::size_t HashCombine()
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,...
std::shared_ptr< ContextGLES > context
static constexpr Color BlackTransparent()
StorageMode resolve_storage_mode
constexpr size_t Hash() const
constexpr bool operator==(const RenderTargetConfig &o) const