diff --git a/ci/builders/mac_host_engine.json b/ci/builders/mac_host_engine.json index 6b985e89bb1e4..368b3fefc0cfe 100644 --- a/ci/builders/mac_host_engine.json +++ b/ci/builders/mac_host_engine.json @@ -146,7 +146,8 @@ "release", "--no-lto", "--prebuilt-dart-sdk", - "--build-embedder-examples" + "--build-embedder-examples", + "--enable-impeller-vulkan" ], "name": "host_release", "ninja": { diff --git a/impeller/golden_tests/BUILD.gn b/impeller/golden_tests/BUILD.gn index d7dc8cfb404a3..8efbb0b7141c5 100644 --- a/impeller/golden_tests/BUILD.gn +++ b/impeller/golden_tests/BUILD.gn @@ -74,6 +74,7 @@ if (is_mac) { "//flutter/impeller/aiks:aiks_unittests_golden", "//flutter/impeller/fixtures", "//third_party/googletest:gtest", + "//third_party/swiftshader", ] } } diff --git a/impeller/golden_tests/golden_playground_test.h b/impeller/golden_tests/golden_playground_test.h index 4f0e5a025c2d6..067d4052a316f 100644 --- a/impeller/golden_tests/golden_playground_test.h +++ b/impeller/golden_tests/golden_playground_test.h @@ -24,6 +24,8 @@ class GoldenPlaygroundTest void SetUp(); + void TearDown(); + PlaygroundBackend GetBackend() const; bool OpenPlaygroundHere(const Picture& picture); diff --git a/impeller/golden_tests/golden_playground_test_mac.cc b/impeller/golden_tests/golden_playground_test_mac.cc index 8f08e41fe2d65..409ee630d9951 100644 --- a/impeller/golden_tests/golden_playground_test_mac.cc +++ b/impeller/golden_tests/golden_playground_test_mac.cc @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include +#include + #include "flutter/impeller/golden_tests/golden_playground_test.h" #include "flutter/impeller/aiks/picture.h" @@ -14,18 +17,30 @@ namespace impeller { // to also be a golden test, then add the test name here. static const std::vector kSkipTests = { "impeller_Play_AiksTest_CanRenderLinearGradientManyColorsUnevenStops_Metal", + "impeller_Play_AiksTest_CanRenderLinearGradientManyColorsUnevenStops_" + "Vulkan", "impeller_Play_AiksTest_CanRenderRadialGradient_Metal", + "impeller_Play_AiksTest_CanRenderRadialGradient_Vulkan", "impeller_Play_AiksTest_CanRenderRadialGradientManyColors_Metal", + "impeller_Play_AiksTest_CanRenderRadialGradientManyColors_Vulkan", "impeller_Play_AiksTest_TextFrameSubpixelAlignment_Metal", + "impeller_Play_AiksTest_TextFrameSubpixelAlignment_Vulkan", "impeller_Play_AiksTest_ColorWheel_Metal", + "impeller_Play_AiksTest_ColorWheel_Vulkan", "impeller_Play_AiksTest_SolidStrokesRenderCorrectly_Metal", + "impeller_Play_AiksTest_SolidStrokesRenderCorrectly_Vulkan", "impeller_Play_AiksTest_GradientStrokesRenderCorrectly_Metal", + "impeller_Play_AiksTest_GradientStrokesRenderCorrectly_Vulkan", "impeller_Play_AiksTest_CoverageOriginShouldBeAccountedForInSubpasses_" "Metal", + "impeller_Play_AiksTest_CoverageOriginShouldBeAccountedForInSubpasses_" + "Vulkan", "impeller_Play_AiksTest_SceneColorSource_Metal", + "impeller_Play_AiksTest_SceneColorSource_Vulkan", // TextRotated is flakey and we can't seem to get it to stabilize on Skia // Gold. "impeller_Play_AiksTest_TextRotated_Metal", + "impeller_Play_AiksTest_TextRotated_Vulkan", }; namespace { @@ -68,8 +83,22 @@ struct GoldenPlaygroundTest::GoldenPlaygroundTestImpl { GoldenPlaygroundTest::GoldenPlaygroundTest() : pimpl_(new GoldenPlaygroundTest::GoldenPlaygroundTestImpl()) {} +void GoldenPlaygroundTest::TearDown() { + ASSERT_FALSE(dlopen("/usr/local/lib/libMoltenVK.dylib", RTLD_NOLOAD)); +} + void GoldenPlaygroundTest::SetUp() { - if (GetBackend() != PlaygroundBackend::kMetal) { + std::filesystem::path testing_assets_path = + flutter::testing::GetTestingAssetsPath(); + std::filesystem::path target_path = testing_assets_path.parent_path() + .parent_path() + .parent_path() + .parent_path(); + std::filesystem::path icd_path = target_path / "vk_swiftshader_icd.json"; + setenv("VK_ICD_FILENAMES", icd_path.c_str(), 1); + + if (GetBackend() != PlaygroundBackend::kMetal && + GetBackend() != PlaygroundBackend::kVulkan) { GTEST_SKIP_("GoldenPlaygroundTest doesn't support this backend type."); return; } diff --git a/impeller/golden_tests/golden_playground_test_stub.cc b/impeller/golden_tests/golden_playground_test_stub.cc index 5114f13d89bc2..392f759b7722d 100644 --- a/impeller/golden_tests/golden_playground_test_stub.cc +++ b/impeller/golden_tests/golden_playground_test_stub.cc @@ -8,6 +8,8 @@ namespace impeller { GoldenPlaygroundTest::GoldenPlaygroundTest() {} +void GoldenPlaygroundTest::TearDown() {} + void GoldenPlaygroundTest::SetUp() { GTEST_SKIP_("GoldenPlaygroundTest doesn't support this backend type."); } diff --git a/testing/run_tests.py b/testing/run_tests.py index f800a474544a6..b3174b1212ea3 100755 --- a/testing/run_tests.py +++ b/testing/run_tests.py @@ -487,9 +487,10 @@ def make_test(name, flags=None, extra_env=None): '1', # Validates accesses to threadgroup memory. 'MTL_SHADER_VALIDATION_TEXTURE_USAGE': '1', # Validates that texture references are not nil. + 'VK_ICD_FILENAMES': os.path.join(build_dir, 'vk_swiftshader_icd.json'), } if is_aarm64(): - extra_env.append({ + extra_env.update({ 'METAL_DEBUG_ERROR_MODE': '0', # Enables metal validation. 'METAL_DEVICE_WRAPPER_TYPE': '1', # Enables metal validation. }) @@ -498,7 +499,7 @@ def make_test(name, flags=None, extra_env=None): build_dir, 'impeller_unittests', executable_filter, - shuffle_flags, + ['--gtest_filter=-*/Vulkan'] + shuffle_flags, coverage=coverage, extra_env=extra_env, # TODO(117122): Remove this allowlist.