diff --git a/shell/gpu/gpu_surface_gl_impeller.cc b/shell/gpu/gpu_surface_gl_impeller.cc index da51753d0050f..78a8bcaf0aab0 100644 --- a/shell/gpu/gpu_surface_gl_impeller.cc +++ b/shell/gpu/gpu_surface_gl_impeller.cc @@ -117,7 +117,6 @@ std::unique_ptr GPUSurfaceGLImpeller::AcquireFrame( auto cull_rect = render_target.GetRenderTargetSize(); impeller::Rect dl_cull_rect = impeller::Rect::MakeSize(cull_rect); - const bool reset_host_buffer = surface_frame.submit_info().frame_boundary; #if EXPERIMENTAL_CANVAS auto skia_cull_rect = SkIRect::MakeWH(cull_rect.width, cull_rect.height); @@ -133,9 +132,7 @@ std::unique_ptr GPUSurfaceGLImpeller::AcquireFrame( display_list->Dispatch(impeller_dispatcher, skia_cull_rect); impeller_dispatcher.FinishRecording(); aiks_context->GetContentContext().GetLazyGlyphAtlas()->ResetTextFrames(); - if (reset_host_buffer) { - aiks_context->GetContentContext().GetTransientsBuffer().Reset(); - } + aiks_context->GetContentContext().GetTransientsBuffer().Reset(); return true; #else impeller::DlDispatcher impeller_dispatcher(dl_cull_rect); @@ -143,7 +140,8 @@ std::unique_ptr GPUSurfaceGLImpeller::AcquireFrame( SkIRect::MakeWH(cull_rect.width, cull_rect.height)); auto picture = impeller_dispatcher.EndRecordingAsPicture(); - return aiks_context->Render(picture, render_target, reset_host_buffer); + return aiks_context->Render(picture, render_target, + /*reset_host_buffer=*/false); #endif // EXPERIMENTAL_CANVAS }; diff --git a/shell/gpu/gpu_surface_metal_impeller.mm b/shell/gpu/gpu_surface_metal_impeller.mm index 6c6e4f9e9c17e..933ae1a50aa8e 100644 --- a/shell/gpu/gpu_surface_metal_impeller.mm +++ b/shell/gpu/gpu_surface_metal_impeller.mm @@ -166,7 +166,6 @@ impeller::IRect cull_rect = surface->coverage(); SkIRect sk_cull_rect = SkIRect::MakeWH(cull_rect.GetWidth(), cull_rect.GetHeight()); - const bool reset_host_buffer = surface_frame.submit_info().frame_boundary; impeller::RenderTarget render_target = surface->GetTargetRenderPassDescriptor(); surface->SetFrameBoundary(surface_frame.submit_info().frame_boundary); @@ -183,9 +182,7 @@ display_list->Dispatch(impeller_dispatcher, sk_cull_rect); impeller_dispatcher.FinishRecording(); aiks_context->GetContentContext().GetLazyGlyphAtlas()->ResetTextFrames(); - if (reset_host_buffer) { - aiks_context->GetContentContext().GetTransientsBuffer().Reset(); - } + aiks_context->GetContentContext().GetTransientsBuffer().Reset(); if (!surface->PreparePresent()) { return false; @@ -196,7 +193,7 @@ impeller::DlDispatcher impeller_dispatcher(cull_rect); display_list->Dispatch(impeller_dispatcher, sk_cull_rect); auto picture = impeller_dispatcher.EndRecordingAsPicture(); - auto result = aiks_context->Render(picture, render_target, reset_host_buffer); + auto result = aiks_context->Render(picture, render_target, /*reset_host_buffer=*/true); if (!surface->PreparePresent()) { return false; diff --git a/shell/gpu/gpu_surface_metal_impeller_unittests.mm b/shell/gpu/gpu_surface_metal_impeller_unittests.mm index a5927ff035783..16632279ebaac 100644 --- a/shell/gpu/gpu_surface_metal_impeller_unittests.mm +++ b/shell/gpu/gpu_surface_metal_impeller_unittests.mm @@ -97,7 +97,8 @@ GPUCAMetalLayerHandle GetCAMetalLayer(const SkISize& frame_info) const override ASSERT_TRUE(frame->Submit()); } -TEST(GPUSurfaceMetalImpeller, ResetHostBufferBasedOnFrameBoundary) { +// Because each overlay surface gets its own HostBuffer, we always need to reset. +TEST(GPUSurfaceMetalImpeller, DoesNotResetHostBufferBasedOnFrameBoundary) { auto delegate = std::make_shared(); delegate->SetDevice(); @@ -115,13 +116,13 @@ GPUCAMetalLayerHandle GetCAMetalLayer(const SkISize& frame_info) const override frame->set_submit_info({.frame_boundary = false}); ASSERT_TRUE(frame->Submit()); - EXPECT_EQ(host_buffer.GetStateForTest().current_frame, 0u); + EXPECT_EQ(host_buffer.GetStateForTest().current_frame, 1u); frame = surface->AcquireFrame(SkISize::Make(100, 100)); frame->set_submit_info({.frame_boundary = true}); ASSERT_TRUE(frame->Submit()); - EXPECT_EQ(host_buffer.GetStateForTest().current_frame, 1u); + EXPECT_EQ(host_buffer.GetStateForTest().current_frame, 2u); } #ifdef IMPELLER_DEBUG diff --git a/shell/gpu/gpu_surface_vulkan_impeller.cc b/shell/gpu/gpu_surface_vulkan_impeller.cc index 02a9a4dfd5908..6cd1ea54b400f 100644 --- a/shell/gpu/gpu_surface_vulkan_impeller.cc +++ b/shell/gpu/gpu_surface_vulkan_impeller.cc @@ -80,7 +80,6 @@ std::unique_ptr GPUSurfaceVulkanImpeller::AcquireFrame( return false; } - const bool reset_host_buffer = surface_frame.submit_info().frame_boundary; #if EXPERIMENTAL_CANVAS impeller::TextFrameDispatcher collector(aiks_context->GetContentContext(), impeller::Matrix()); @@ -94,11 +93,8 @@ std::unique_ptr GPUSurfaceVulkanImpeller::AcquireFrame( display_list->Dispatch(impeller_dispatcher, SkIRect::MakeWH(cull_rect.width, cull_rect.height)); impeller_dispatcher.FinishRecording(); - aiks_context->GetContentContext().GetTransientsBuffer().Reset(); aiks_context->GetContentContext().GetLazyGlyphAtlas()->ResetTextFrames(); - if (reset_host_buffer) { - aiks_context->GetContentContext().GetTransientsBuffer().Reset(); - } + aiks_context->GetContentContext().GetTransientsBuffer().Reset(); return true; #else impeller::Rect dl_cull_rect = impeller::Rect::MakeSize(cull_rect); @@ -106,7 +102,8 @@ std::unique_ptr GPUSurfaceVulkanImpeller::AcquireFrame( display_list->Dispatch(impeller_dispatcher, SkIRect::MakeWH(cull_rect.width, cull_rect.height)); auto picture = impeller_dispatcher.EndRecordingAsPicture(); - return aiks_context->Render(picture, render_target, reset_host_buffer); + return aiks_context->Render(picture, render_target, + /*reset_host_buffer=*/false); #endif };