diff --git a/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.cc b/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.cc index ff8ebaeec8..caf346c8bc 100644 --- a/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.cc +++ b/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.cc @@ -138,13 +138,11 @@ void ImGui_ImplImpeller_Shutdown() { } void ImGui_ImplImpeller_RenderDrawData(ImDrawData* draw_data, - impeller::RenderPass& render_pass) { + impeller::RenderPass& render_pass, + impeller::HostBuffer& host_buffer) { if (draw_data->CmdListsCount == 0) { return; // Nothing to render. } - auto host_buffer = impeller::HostBuffer::Create( - render_pass.GetContext()->GetResourceAllocator(), - render_pass.GetContext()->GetIdleWaiter()); using VS = impeller::ImguiRasterVertexShader; using FS = impeller::ImguiRasterFragmentShader; @@ -178,7 +176,7 @@ void ImGui_ImplImpeller_RenderDrawData(ImDrawData* draw_data, VS::UniformBuffer uniforms; uniforms.mvp = impeller::Matrix::MakeOrthographic(display_rect.GetSize()) .Translate(-display_rect.GetOrigin()); - auto vtx_uniforms = host_buffer->EmplaceUniform(uniforms); + auto vtx_uniforms = host_buffer.EmplaceUniform(uniforms); size_t vertex_buffer_offset = 0; size_t index_buffer_offset = total_vtx_bytes; @@ -284,5 +282,5 @@ void ImGui_ImplImpeller_RenderDrawData(ImDrawData* draw_data, vertex_buffer_offset += draw_list_vtx_bytes; index_buffer_offset += draw_list_idx_bytes; } - host_buffer->Reset(); + host_buffer.Reset(); } diff --git a/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.h b/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.h index cfb624a61c..163dac8f9a 100644 --- a/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.h +++ b/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.h @@ -7,6 +7,7 @@ #include +#include "impeller/core/host_buffer.h" #include "third_party/imgui/imgui.h" namespace impeller { @@ -23,6 +24,7 @@ IMGUI_IMPL_API void ImGui_ImplImpeller_Shutdown(); IMGUI_IMPL_API void ImGui_ImplImpeller_RenderDrawData( ImDrawData* draw_data, - impeller::RenderPass& renderpass); + impeller::RenderPass& renderpass, + impeller::HostBuffer& host_buffer); #endif // FLUTTER_IMPELLER_PLAYGROUND_IMGUI_IMGUI_IMPL_IMPELLER_H_ diff --git a/engine/src/flutter/impeller/playground/playground.cc b/engine/src/flutter/impeller/playground/playground.cc index 7f6521b539..f588a54049 100644 --- a/engine/src/flutter/impeller/playground/playground.cc +++ b/engine/src/flutter/impeller/playground/playground.cc @@ -9,6 +9,7 @@ #include "fml/closure.h" #include "fml/time/time_point.h" +#include "impeller/core/host_buffer.h" #include "impeller/playground/image/backends/skia/compressed_image_skia.h" #include "impeller/playground/image/decompressed_image.h" #include "impeller/renderer/command_buffer.h" @@ -148,6 +149,9 @@ bool Playground::IsPlaygroundEnabled() const { } void Playground::TeardownWindow() { + if (host_buffer_) { + host_buffer_.reset(); + } if (context_) { context_->Shutdown(); } @@ -303,8 +307,13 @@ bool Playground::OpenPlaygroundHere( return false; } pass->SetLabel("ImGui Render Pass"); + if (!host_buffer_) { + host_buffer_ = HostBuffer::Create(context_->GetResourceAllocator(), + context_->GetIdleWaiter()); + } - ImGui_ImplImpeller_RenderDrawData(ImGui::GetDrawData(), *pass); + ImGui_ImplImpeller_RenderDrawData(ImGui::GetDrawData(), *pass, + *host_buffer_); pass->EncodeCommands(); diff --git a/engine/src/flutter/impeller/playground/playground.h b/engine/src/flutter/impeller/playground/playground.h index 9bf16f2e95..0481211fd1 100644 --- a/engine/src/flutter/impeller/playground/playground.h +++ b/engine/src/flutter/impeller/playground/playground.h @@ -10,6 +10,7 @@ #include "flutter/fml/status.h" #include "flutter/fml/time/time_delta.h" +#include "impeller/core/host_buffer.h" #include "impeller/core/runtime_types.h" #include "impeller/core/texture.h" #include "impeller/geometry/point.h" @@ -130,6 +131,7 @@ class Playground { std::shared_ptr context_; Point cursor_position_; ISize window_size_ = ISize{1024, 768}; + std::shared_ptr host_buffer_; void SetCursorPosition(Point pos); diff --git a/engine/src/flutter/testing/run_tests.py b/engine/src/flutter/testing/run_tests.py index c25f862591..d334108c8d 100755 --- a/engine/src/flutter/testing/run_tests.py +++ b/engine/src/flutter/testing/run_tests.py @@ -553,7 +553,7 @@ def run_cc_tests(build_dir, executable_filter, coverage, capture_core_dump): '--enable_vulkan_validation', '--enable_playground', '--playground_timeout_ms=4000', - '--gtest_filter="*ColorWheel/Vulkan"', + '--gtest_filter="*ColorWheel*"', ], coverage=coverage, extra_env=extra_env,