From 867d175c2db6519bc992341c1379efed041eaf8c Mon Sep 17 00:00:00 2001 From: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Date: Tue, 23 Jan 2024 10:16:55 -0800 Subject: [PATCH] [Impeller] turned on validation errors for one golden image test (flutter/engine#49955) issue https://github.com/flutter/flutter/issues/142017 This just turns on the validations for one test since not everything passes yet with them turned on across the board. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../golden_tests/golden_playground_test_mac.cc | 17 +++++++++++++++-- .../golden_tests/vulkan_screenshotter.h | 2 +- .../golden_tests/vulkan_screenshotter.mm | 6 ++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/engine/src/flutter/impeller/golden_tests/golden_playground_test_mac.cc b/engine/src/flutter/impeller/golden_tests/golden_playground_test_mac.cc index a465a33e76..c8bbe289d6 100644 --- a/engine/src/flutter/impeller/golden_tests/golden_playground_test_mac.cc +++ b/engine/src/flutter/impeller/golden_tests/golden_playground_test_mac.cc @@ -60,6 +60,12 @@ static const std::vector kSkipTests = { "impeller_Play_AiksTest_CaptureContext_Vulkan", }; +/// TODO(https://github.com/flutter/flutter/issues/142017): Turn on validation +/// for all vulkan tests. +static const std::vector kVulkanValidationTests = { + "impeller_Play_AiksTest_CanRenderTextFrame_Vulkan", +}; + namespace { std::string GetTestName() { std::string suite_name = @@ -127,13 +133,20 @@ void GoldenPlaygroundTest::SetUp() { return; } + bool enable_vulkan_validations = false; + std::string test_name = GetTestName(); + if (std::find(kVulkanValidationTests.begin(), kVulkanValidationTests.end(), + test_name) != kVulkanValidationTests.end()) { + enable_vulkan_validations = true; + } + if (GetParam() == PlaygroundBackend::kMetal) { pimpl_->screenshotter = std::make_unique(); } else if (GetParam() == PlaygroundBackend::kVulkan) { - pimpl_->screenshotter = std::make_unique(); + pimpl_->screenshotter = std::make_unique( + enable_vulkan_validations); } - std::string test_name = GetTestName(); if (std::find(kSkipTests.begin(), kSkipTests.end(), test_name) != kSkipTests.end()) { GTEST_SKIP_( diff --git a/engine/src/flutter/impeller/golden_tests/vulkan_screenshotter.h b/engine/src/flutter/impeller/golden_tests/vulkan_screenshotter.h index 78d8e639f9..b48ad61df9 100644 --- a/engine/src/flutter/impeller/golden_tests/vulkan_screenshotter.h +++ b/engine/src/flutter/impeller/golden_tests/vulkan_screenshotter.h @@ -18,7 +18,7 @@ namespace testing { /// playground backend. class VulkanScreenshotter : public Screenshotter { public: - VulkanScreenshotter(); + explicit VulkanScreenshotter(bool enable_validations); std::unique_ptr MakeScreenshot( AiksContext& aiks_context, diff --git a/engine/src/flutter/impeller/golden_tests/vulkan_screenshotter.mm b/engine/src/flutter/impeller/golden_tests/vulkan_screenshotter.mm index 5633faf832..1daaee4cd8 100644 --- a/engine/src/flutter/impeller/golden_tests/vulkan_screenshotter.mm +++ b/engine/src/flutter/impeller/golden_tests/vulkan_screenshotter.mm @@ -64,10 +64,12 @@ std::unique_ptr ReadTexture( } } // namespace -VulkanScreenshotter::VulkanScreenshotter() { +VulkanScreenshotter::VulkanScreenshotter(bool enable_validations) { FML_CHECK(::glfwInit() == GLFW_TRUE); + PlaygroundSwitches playground_switches; + playground_switches.enable_vulkan_validation = enable_validations; playground_ = - PlaygroundImpl::Create(PlaygroundBackend::kVulkan, PlaygroundSwitches{}); + PlaygroundImpl::Create(PlaygroundBackend::kVulkan, playground_switches); } std::unique_ptr VulkanScreenshotter::MakeScreenshot(