From b9e4578125307c6aeca26d53d079395ff5ec7757 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Sun, 8 Sep 2024 21:59:22 -0700 Subject: [PATCH 1/4] duh. --- shell/gpu/gpu_surface_metal_impeller.mm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/shell/gpu/gpu_surface_metal_impeller.mm b/shell/gpu/gpu_surface_metal_impeller.mm index 6c6e4f9e9c17e..abcca2d2f17ee 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; From 2b305734e8b472d4a236a237b858277af5a20c02 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Sun, 8 Sep 2024 22:16:42 -0700 Subject: [PATCH 2/4] Update gpu_surface_metal_impeller.mm --- shell/gpu/gpu_surface_metal_impeller.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/gpu/gpu_surface_metal_impeller.mm b/shell/gpu/gpu_surface_metal_impeller.mm index abcca2d2f17ee..933ae1a50aa8e 100644 --- a/shell/gpu/gpu_surface_metal_impeller.mm +++ b/shell/gpu/gpu_surface_metal_impeller.mm @@ -193,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; From 88935687deb2a11e7351b38da44368b81cac7bb3 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 9 Sep 2024 09:21:09 -0700 Subject: [PATCH 3/4] ++ --- shell/gpu/gpu_surface_metal_impeller_unittests.mm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 From 27757ae928d6fee9719411292e70533193daad6e Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Mon, 9 Sep 2024 09:34:12 -0700 Subject: [PATCH 4/4] ++ --- shell/gpu/gpu_surface_gl_impeller.cc | 8 +++----- shell/gpu/gpu_surface_vulkan_impeller.cc | 9 +++------ 2 files changed, 6 insertions(+), 11 deletions(-) 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_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 };