 |
Flutter Impeller
|
|
Go to the documentation of this file.
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 const std::string& label =
"Offscreen",
88 const std::shared_ptr<Texture>& depth_stencil_texture =
nullptr);
108 std::optional<StencilAttachment> attachment);
121 const std::function<
bool(
const Attachment& attachment)>& iterator)
const;
128 .
size = color_attachment.texture->GetSize(),
129 .mip_count = color_attachment.texture->GetMipCount(),
130 .has_msaa = color_attachment.resolve_texture !=
nullptr,
131 .has_depth_stencil = depth_.has_value() && stencil_.has_value()};
135 std::map<size_t, ColorAttachment> colors_;
136 std::optional<DepthAttachment> depth_;
137 std::optional<StencilAttachment> stencil_;
152 const std::string& label =
"Offscreen",
155 std::optional<RenderTarget::AttachmentConfig> stencil_attachment_config =
157 const std::shared_ptr<Texture>& existing_color_texture =
nullptr,
158 const std::shared_ptr<Texture>& existing_depth_stencil_texture =
nullptr);
164 const std::string& label =
"Offscreen MSAA",
167 std::optional<RenderTarget::AttachmentConfig> stencil_attachment_config =
169 const std::shared_ptr<Texture>& existing_color_msaa_texture =
nullptr,
170 const std::shared_ptr<Texture>& existing_color_resolve_texture =
nullptr,
171 const std::shared_ptr<Texture>& existing_depth_stencil_texture =
nullptr);
177 virtual void Start();
185 std::shared_ptr<Allocator> allocator_;
190 #endif // FLUTTER_IMPELLER_RENDERER_RENDER_TARGET_H_
size_t GetTotalAttachmentCount() const
virtual RenderTarget CreateOffscreen(const Context &context, ISize size, int mip_count, const std::string &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)
static constexpr AttachmentConfig kDefaultColorAttachmentConfig
virtual void Start()
Mark the beginning of a frame workload.
RenderTarget & SetColorAttachment(const ColorAttachment &attachment, size_t index)
static constexpr AttachmentConfigMSAA kDefaultColorAttachmentConfigMSAA
constexpr size_t Hash() const
RenderTargetConfig ToConfig() const
PixelFormat GetRenderTargetPixelFormat() const
std::optional< ISize > GetColorAttachmentSize(size_t index) const
RenderTargetAllocator(std::shared_ptr< Allocator > allocator)
const std::map< size_t, ColorAttachment > & GetColorAttachments() const
StorageMode resolve_storage_mode
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
const std::optional< DepthAttachment > & GetDepthAttachment() const
StorageMode
Specified where the allocation resides and how it is used.
std::shared_ptr< Texture > GetRenderTargetTexture() const
void IterateAllAttachments(const std::function< bool(const Attachment &attachment)> &iterator) const
static constexpr AttachmentConfig kDefaultStencilAttachmentConfig
An object that allocates device memory.
virtual RenderTarget CreateOffscreenMSAA(const Context &context, ISize size, int mip_count, const std::string &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)
a wrapper around the impeller [Allocator] instance that can be used to provide caching of allocated r...
constexpr bool operator==(const RenderTargetConfig &o) const
ISize GetRenderTargetSize() const
RenderTarget & SetStencilAttachment(std::optional< StencilAttachment > attachment)
To do anything rendering related with Impeller, you need a context.
virtual void End()
Mark the end of a frame workload.
static constexpr Color BlackTransparent()
size_t GetMaxColorAttacmentBindIndex() const
const std::optional< StencilAttachment > & GetStencilAttachment() const
RenderTarget & SetDepthAttachment(std::optional< DepthAttachment > attachment)
void SetupDepthStencilAttachments(const Context &context, Allocator &allocator, ISize size, bool msaa, const std::string &label="Offscreen", RenderTarget::AttachmentConfig stencil_attachment_config=RenderTarget::kDefaultStencilAttachmentConfig, const std::shared_ptr< Texture > &depth_stencil_texture=nullptr)
SampleCount GetSampleCount() const
bool HasColorAttachment(size_t index) const
std::string ToString() const
virtual ~RenderTargetAllocator()=default