From 76600f8cb3efeb001e8d44164ed4e08925913c96 Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Sun, 19 Mar 2023 23:37:45 -0700 Subject: [PATCH] [Impeller] Load instead of restore drawing for non-MSAA passes (flutter/engine#40436) [Impeller] Load instead of restore drawing for non-MSAA passes --- .../flutter/impeller/entity/inline_pass_context.cc | 13 ++++++++++--- .../flutter/impeller/entity/inline_pass_context.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/impeller/entity/inline_pass_context.cc b/engine/src/flutter/impeller/entity/inline_pass_context.cc index c29bb2b4ea8..b4437a7bd64 100644 --- a/engine/src/flutter/impeller/entity/inline_pass_context.cc +++ b/engine/src/flutter/impeller/entity/inline_pass_context.cc @@ -100,7 +100,10 @@ InlinePassContext::RenderPassResult InlinePassContext::GetRenderPass( RenderPassResult result; - if (pass_count_ > 0) { + if (pass_count_ > 0 && pass_target_.GetRenderTarget() + .GetColorAttachments() + .find(0) + ->second.resolve_texture) { result.backdrop_texture = pass_target_.Flip(*context_->GetResourceAllocator()); if (!result.backdrop_texture) { @@ -111,8 +114,12 @@ InlinePassContext::RenderPassResult InlinePassContext::GetRenderPass( auto color0 = pass_target_.GetRenderTarget().GetColorAttachments().find(0)->second; - color0.load_action = - pass_count_ > 0 ? LoadAction::kDontCare : LoadAction::kClear; + if (pass_count_ > 0) { + color0.load_action = + color0.resolve_texture ? LoadAction::kDontCare : LoadAction::kLoad; + } else { + color0.load_action = LoadAction::kClear; + } color0.store_action = color0.resolve_texture ? StoreAction::kMultisampleResolve diff --git a/engine/src/flutter/impeller/entity/inline_pass_context.h b/engine/src/flutter/impeller/entity/inline_pass_context.h index f35c1fc4477..00ce649204b 100644 --- a/engine/src/flutter/impeller/entity/inline_pass_context.h +++ b/engine/src/flutter/impeller/entity/inline_pass_context.h @@ -15,6 +15,7 @@ class InlinePassContext { public: struct RenderPassResult { std::shared_ptr pass; + std::shared_ptr backdrop_texture; };