[Impeller] Use booleans instead of counting backdrop reads. (flutter/engine#52181)
We don't need to track the actual number of reads anymore now that clips are replayed (since we no longer ever store the stencil or depth buffers). Also, we don't need to pass this into `InlinePassContext` anymore.
This commit is contained in:
@@ -110,7 +110,7 @@ void EntityPass::AddEntity(Entity entity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (entity.GetBlendMode() > Entity::kLastPipelineBlendMode) {
|
if (entity.GetBlendMode() > Entity::kLastPipelineBlendMode) {
|
||||||
advanced_blend_reads_from_pass_texture_ += 1;
|
advanced_blend_reads_from_pass_texture_ = true;
|
||||||
}
|
}
|
||||||
elements_.emplace_back(std::move(entity));
|
elements_.emplace_back(std::move(entity));
|
||||||
}
|
}
|
||||||
@@ -277,10 +277,10 @@ EntityPass* EntityPass::AddSubpass(std::unique_ptr<EntityPass> pass) {
|
|||||||
pass->superpass_ = this;
|
pass->superpass_ = this;
|
||||||
|
|
||||||
if (pass->backdrop_filter_proc_) {
|
if (pass->backdrop_filter_proc_) {
|
||||||
backdrop_filter_reads_from_pass_texture_ += 1;
|
backdrop_filter_reads_from_pass_texture_ = true;
|
||||||
}
|
}
|
||||||
if (pass->blend_mode_ > Entity::kLastPipelineBlendMode) {
|
if (pass->blend_mode_ > Entity::kLastPipelineBlendMode) {
|
||||||
advanced_blend_reads_from_pass_texture_ += 1;
|
advanced_blend_reads_from_pass_texture_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto subpass_pointer = pass.get();
|
auto subpass_pointer = pass.get();
|
||||||
@@ -299,9 +299,11 @@ void EntityPass::AddSubpassInline(std::unique_ptr<EntityPass> pass) {
|
|||||||
elements_.emplace_back(std::move(elements[i]));
|
elements_.emplace_back(std::move(elements[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
backdrop_filter_reads_from_pass_texture_ +=
|
backdrop_filter_reads_from_pass_texture_ =
|
||||||
|
backdrop_filter_reads_from_pass_texture_ ||
|
||||||
pass->backdrop_filter_reads_from_pass_texture_;
|
pass->backdrop_filter_reads_from_pass_texture_;
|
||||||
advanced_blend_reads_from_pass_texture_ +=
|
advanced_blend_reads_from_pass_texture_ =
|
||||||
|
advanced_blend_reads_from_pass_texture_ ||
|
||||||
pass->advanced_blend_reads_from_pass_texture_;
|
pass->advanced_blend_reads_from_pass_texture_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,10 +368,10 @@ static EntityPassTarget CreateRenderTarget(ContentContext& renderer,
|
|||||||
renderer.GetDeviceCapabilities().SupportsImplicitResolvingMSAA());
|
renderer.GetDeviceCapabilities().SupportsImplicitResolvingMSAA());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t EntityPass::GetTotalPassReads(ContentContext& renderer) const {
|
bool EntityPass::DoesBackdropGetRead(ContentContext& renderer) const {
|
||||||
return renderer.GetDeviceCapabilities().SupportsFramebufferFetch()
|
return renderer.GetDeviceCapabilities().SupportsFramebufferFetch()
|
||||||
? backdrop_filter_reads_from_pass_texture_
|
? backdrop_filter_reads_from_pass_texture_
|
||||||
: backdrop_filter_reads_from_pass_texture_ +
|
: backdrop_filter_reads_from_pass_texture_ ||
|
||||||
advanced_blend_reads_from_pass_texture_;
|
advanced_blend_reads_from_pass_texture_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,11 +415,10 @@ bool EntityPass::Render(ContentContext& renderer,
|
|||||||
EntityPassClipStack clip_stack = EntityPassClipStack(
|
EntityPassClipStack clip_stack = EntityPassClipStack(
|
||||||
Rect::MakeSize(root_render_target.GetRenderTargetSize()));
|
Rect::MakeSize(root_render_target.GetRenderTargetSize()));
|
||||||
|
|
||||||
bool reads_from_onscreen_backdrop = GetTotalPassReads(renderer) > 0;
|
|
||||||
// In this branch path, we need to render everything to an offscreen texture
|
// In this branch path, we need to render everything to an offscreen texture
|
||||||
// and then blit the results onto the onscreen texture. If using this branch,
|
// and then blit the results onto the onscreen texture. If using this branch,
|
||||||
// there's no need to set up a stencil attachment on the root render target.
|
// there's no need to set up a stencil attachment on the root render target.
|
||||||
if (reads_from_onscreen_backdrop) {
|
if (DoesBackdropGetRead(renderer)) {
|
||||||
EntityPassTarget offscreen_target = CreateRenderTarget(
|
EntityPassTarget offscreen_target = CreateRenderTarget(
|
||||||
renderer, root_render_target.GetRenderTargetSize(),
|
renderer, root_render_target.GetRenderTargetSize(),
|
||||||
GetRequiredMipCount(),
|
GetRequiredMipCount(),
|
||||||
@@ -889,8 +890,7 @@ bool EntityPass::OnRender(
|
|||||||
pass_depth);
|
pass_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
InlinePassContext pass_context(renderer, pass_target,
|
InlinePassContext pass_context(renderer, pass_target, GetElementCount(),
|
||||||
GetTotalPassReads(renderer), GetElementCount(),
|
|
||||||
collapsed_parent_pass);
|
collapsed_parent_pass);
|
||||||
if (!pass_context.IsValid()) {
|
if (!pass_context.IsValid()) {
|
||||||
VALIDATION_LOG << SPrintF("Pass context invalid (Depth=%d)", pass_depth);
|
VALIDATION_LOG << SPrintF("Pass context invalid (Depth=%d)", pass_depth);
|
||||||
|
|||||||
@@ -346,18 +346,18 @@ class EntityPass {
|
|||||||
ContentBoundsPromise bounds_promise_ = ContentBoundsPromise::kUnknown;
|
ContentBoundsPromise bounds_promise_ = ContentBoundsPromise::kUnknown;
|
||||||
int32_t required_mip_count_ = 1;
|
int32_t required_mip_count_ = 1;
|
||||||
|
|
||||||
/// These values are incremented whenever something is added to the pass that
|
/// These values indicate whether something has been added to the EntityPass
|
||||||
/// requires reading from the backdrop texture. Currently, this can happen in
|
/// that requires reading from the backdrop texture. Currently, this can
|
||||||
/// the following scenarios:
|
/// happen in the following scenarios:
|
||||||
/// 1. An entity with an "advanced blend" is added to the pass.
|
/// 1. An entity with an "advanced blend" is added to the pass.
|
||||||
/// 2. A subpass with a backdrop filter is added to the pass.
|
/// 2. A subpass with a backdrop filter is added to the pass.
|
||||||
/// These are tracked as separate values because we may ignore
|
/// These are tracked as separate values because we may ignore
|
||||||
/// blend_reads_from_pass_texture_ if the device supports framebuffer based
|
/// `blend_reads_from_pass_texture_` if the device supports framebuffer based
|
||||||
/// advanced blends.
|
/// advanced blends.
|
||||||
uint32_t advanced_blend_reads_from_pass_texture_ = 0;
|
bool advanced_blend_reads_from_pass_texture_ = false;
|
||||||
uint32_t backdrop_filter_reads_from_pass_texture_ = 0;
|
bool backdrop_filter_reads_from_pass_texture_ = false;
|
||||||
|
|
||||||
uint32_t GetTotalPassReads(ContentContext& renderer) const;
|
bool DoesBackdropGetRead(ContentContext& renderer) const;
|
||||||
|
|
||||||
BackdropFilterProc backdrop_filter_proc_ = nullptr;
|
BackdropFilterProc backdrop_filter_proc_ = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ namespace impeller {
|
|||||||
InlinePassContext::InlinePassContext(
|
InlinePassContext::InlinePassContext(
|
||||||
const ContentContext& renderer,
|
const ContentContext& renderer,
|
||||||
EntityPassTarget& pass_target,
|
EntityPassTarget& pass_target,
|
||||||
uint32_t pass_texture_reads,
|
|
||||||
uint32_t entity_count,
|
uint32_t entity_count,
|
||||||
std::optional<RenderPassResult> collapsed_parent_pass)
|
std::optional<RenderPassResult> collapsed_parent_pass)
|
||||||
: renderer_(renderer),
|
: renderer_(renderer),
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ class InlinePassContext {
|
|||||||
InlinePassContext(
|
InlinePassContext(
|
||||||
const ContentContext& renderer,
|
const ContentContext& renderer,
|
||||||
EntityPassTarget& pass_target,
|
EntityPassTarget& pass_target,
|
||||||
uint32_t pass_texture_reads,
|
|
||||||
uint32_t entity_count,
|
uint32_t entity_count,
|
||||||
std::optional<RenderPassResult> collapsed_parent_pass = std::nullopt);
|
std::optional<RenderPassResult> collapsed_parent_pass = std::nullopt);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user