14 for (
auto& td : render_target_data_) {
15 td.used_this_frame =
false;
20 std::vector<RenderTargetData> retain;
22 for (
const auto& td : render_target_data_) {
23 if (td.used_this_frame) {
27 render_target_data_.swap(retain);
34 const std::string& label,
36 std::optional<RenderTarget::AttachmentConfig> stencil_attachment_config,
37 const std::shared_ptr<Texture>& existing_color_texture,
38 const std::shared_ptr<Texture>& existing_depth_stencil_texture) {
43 FML_DCHECK(existing_color_texture ==
nullptr &&
44 existing_depth_stencil_texture ==
nullptr);
47 .mip_count =
static_cast<size_t>(mip_count),
49 .has_depth_stencil = stencil_attachment_config.has_value(),
51 for (
auto& render_target_data : render_target_data_) {
52 const auto other_config = render_target_data.config;
53 if (!render_target_data.used_this_frame && other_config == config) {
54 render_target_data.used_this_frame =
true;
55 auto color0 = render_target_data.render_target.GetColorAttachments()
58 auto depth = render_target_data.render_target.GetDepthAttachment();
59 std::shared_ptr<Texture> depth_tex = depth ? depth->texture :
nullptr;
61 context,
size, mip_count, label, color_attachment_config,
62 stencil_attachment_config, color0.texture, depth_tex);
66 context,
size, mip_count, label, color_attachment_config,
67 stencil_attachment_config);
68 if (!created_target.
IsValid()) {
69 return created_target;
71 render_target_data_.push_back(
72 RenderTargetData{.used_this_frame =
true,
74 .render_target = created_target});
75 return created_target;
82 const std::string& label,
84 std::optional<RenderTarget::AttachmentConfig> stencil_attachment_config,
85 const std::shared_ptr<Texture>& existing_color_msaa_texture,
86 const std::shared_ptr<Texture>& existing_color_resolve_texture,
87 const std::shared_ptr<Texture>& existing_depth_stencil_texture) {
92 FML_DCHECK(existing_color_msaa_texture ==
nullptr &&
93 existing_color_resolve_texture ==
nullptr &&
94 existing_depth_stencil_texture ==
nullptr);
97 .mip_count =
static_cast<size_t>(mip_count),
99 .has_depth_stencil = stencil_attachment_config.has_value(),
101 for (
auto& render_target_data : render_target_data_) {
102 const auto other_config = render_target_data.config;
103 if (!render_target_data.used_this_frame && other_config == config) {
104 render_target_data.used_this_frame =
true;
105 auto color0 = render_target_data.render_target.GetColorAttachments()
108 auto depth = render_target_data.render_target.GetDepthAttachment();
109 std::shared_ptr<Texture> depth_tex = depth ? depth->texture :
nullptr;
111 context,
size, mip_count, label, color_attachment_config,
112 stencil_attachment_config, color0.texture, color0.resolve_texture,
117 context,
size, mip_count, label, color_attachment_config,
118 stencil_attachment_config);
119 if (!created_target.
IsValid()) {
120 return created_target;
122 render_target_data_.push_back(
123 RenderTargetData{.used_this_frame =
true,
125 .render_target = created_target});
126 return created_target;
130 return render_target_data_.size();
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 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)
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)
size_t CachedTextureCount() const
RenderTargetCache(std::shared_ptr< Allocator > allocator)
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) override
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) override
void End() override
Mark the end of a frame workload.
void Start() override
Mark the beginning of a frame workload.
#define FML_DCHECK(condition)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size