9#include "flutter/fml/status.h"
23 uint32_t entity_count,
24 std::optional<RenderPassResult> collapsed_parent_pass)
26 pass_target_(pass_target),
27 entity_count_(entity_count),
28 is_collapsed_(collapsed_parent_pass.has_value()) {
29 if (collapsed_parent_pass.has_value()) {
30 pass_ = collapsed_parent_pass.value().pass;
45 return pass_ !=
nullptr;
61 if (!pass_->EncodeCommands()) {
62 VALIDATION_LOG <<
"Failed to encode and submit command buffer while ending "
67 const std::shared_ptr<Texture>& target_texture =
69 if (target_texture->GetMipCount() > 1) {
71 command_buffer_, renderer_.
GetContext(), target_texture);
72 if (!mip_status.
ok()) {
78 ->Submit({std::move(command_buffer_)})
84 command_buffer_ =
nullptr;
94 uint32_t pass_depth) {
96 return {.
pass = pass_};
103 command_buffer_ = renderer_.
GetContext()->CreateCommandBuffer();
104 if (!command_buffer_) {
110 VALIDATION_LOG <<
"Color attachment unexpectedly missing from the "
111 "EntityPass render target.";
115 command_buffer_->SetLabel(
116 "EntityPass Command Buffer: Depth=" +
std::to_string(pass_depth) +
125 ->second.resolve_texture !=
nullptr;
126 if (pass_count_ > 0 && is_msaa) {
128 pass_target_.
Flip(*renderer_.
GetContext()->GetResourceAllocator());
129 if (!
result.backdrop_texture) {
139 bool is_msaa = color0.resolve_texture !=
nullptr;
141 if (pass_count_ > 0) {
150 color0.store_action =
154 if (!depth.has_value()) {
155 VALIDATION_LOG <<
"Depth attachment unexpectedly missing from the "
156 "EntityPass render target.";
164 if (!depth.has_value() || !stencil.has_value()) {
165 VALIDATION_LOG <<
"Stencil/Depth attachment unexpectedly missing from the "
166 "EntityPass render target.";
177 pass_ = command_buffer_->CreateRenderPass(pass_target_.
GetRenderTarget());
191 result.just_created =
true;
193 if (!renderer_.
GetContext()->GetCapabilities()->SupportsReadFromResolve() &&
194 result.backdrop_texture ==
195 result.pass->GetRenderTarget().GetRenderTargetTexture()) {
196 VALIDATION_LOG <<
"EntityPass backdrop restore configuration is not valid "
197 "for the current graphics backend.";
static uint32_t NextPowerOfTwoSize(uint32_t x)
std::shared_ptr< Context > GetContext() const
std::shared_ptr< Texture > Flip(Allocator &allocator)
Flips the backdrop and returns a readable texture that can be bound/sampled to restore the previous p...
const RenderTarget & GetRenderTarget() const
EntityPassTarget & GetPassTarget() const
std::shared_ptr< Texture > GetTexture()
RenderPassResult GetRenderPass(uint32_t pass_depth)
uint32_t GetPassCount() const
InlinePassContext(const ContentContext &renderer, EntityPassTarget &pass_target, uint32_t entity_count, std::optional< RenderPassResult > collapsed_parent_pass=std::nullopt)
std::shared_ptr< Texture > GetRenderTargetTexture() const
const std::map< size_t, ColorAttachment > & GetColorAttachments() const
RenderTarget & SetColorAttachment(const ColorAttachment &attachment, size_t index)
RenderTarget & SetDepthAttachment(std::optional< DepthAttachment > attachment)
RenderTarget & SetStencilAttachment(std::optional< StencilAttachment > attachment)
const std::optional< DepthAttachment > & GetDepthAttachment() const
const std::optional< StencilAttachment > & GetStencilAttachment() const
#define FML_DCHECK(condition)
fml::Status AddMipmapGeneration(const std::shared_ptr< CommandBuffer > &command_buffer, const std::shared_ptr< Context > &context, const std::shared_ptr< Texture > &texture)
Adds a blit command to the render pass.
static SkString to_string(int n)
std::shared_ptr< RenderPass > pass