Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 49daef8

Browse files
committed
[Impeller] Turned on swiftshader for golden image tests
1 parent 72fc403 commit 49daef8

File tree

6 files changed

+40
-1
lines changed

6 files changed

+40
-1
lines changed

impeller/golden_tests/BUILD.gn

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,9 @@ if (is_mac) {
7575
"//flutter/impeller/fixtures",
7676
"//third_party/googletest:gtest",
7777
]
78+
79+
if (impeller_enable_vulkan) {
80+
deps += [ "//third_party/swiftshader" ]
81+
}
7882
}
7983
}

impeller/golden_tests/golden_playground_test.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class GoldenPlaygroundTest
2424

2525
void SetUp();
2626

27+
void TearDown();
28+
2729
PlaygroundBackend GetBackend() const;
2830

2931
bool OpenPlaygroundHere(const Picture& picture);

impeller/golden_tests/golden_playground_test_mac.cc

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
#include <dlfcn.h>
6+
#include <filesystem>
7+
58
#include "flutter/impeller/golden_tests/golden_playground_test.h"
69

710
#include "flutter/impeller/aiks/picture.h"
@@ -14,18 +17,30 @@ namespace impeller {
1417
// to also be a golden test, then add the test name here.
1518
static const std::vector<std::string> kSkipTests = {
1619
"impeller_Play_AiksTest_CanRenderLinearGradientManyColorsUnevenStops_Metal",
20+
"impeller_Play_AiksTest_CanRenderLinearGradientManyColorsUnevenStops_"
21+
"Vulkan",
1722
"impeller_Play_AiksTest_CanRenderRadialGradient_Metal",
23+
"impeller_Play_AiksTest_CanRenderRadialGradient_Vulkan",
1824
"impeller_Play_AiksTest_CanRenderRadialGradientManyColors_Metal",
25+
"impeller_Play_AiksTest_CanRenderRadialGradientManyColors_Vulkan",
1926
"impeller_Play_AiksTest_TextFrameSubpixelAlignment_Metal",
27+
"impeller_Play_AiksTest_TextFrameSubpixelAlignment_Vulkan",
2028
"impeller_Play_AiksTest_ColorWheel_Metal",
29+
"impeller_Play_AiksTest_ColorWheel_Vulkan",
2130
"impeller_Play_AiksTest_SolidStrokesRenderCorrectly_Metal",
31+
"impeller_Play_AiksTest_SolidStrokesRenderCorrectly_Vulkan",
2232
"impeller_Play_AiksTest_GradientStrokesRenderCorrectly_Metal",
33+
"impeller_Play_AiksTest_GradientStrokesRenderCorrectly_Vulkan",
2334
"impeller_Play_AiksTest_CoverageOriginShouldBeAccountedForInSubpasses_"
2435
"Metal",
36+
"impeller_Play_AiksTest_CoverageOriginShouldBeAccountedForInSubpasses_"
37+
"Vulkan",
2538
"impeller_Play_AiksTest_SceneColorSource_Metal",
39+
"impeller_Play_AiksTest_SceneColorSource_Vulkan",
2640
// TextRotated is flakey and we can't seem to get it to stabilize on Skia
2741
// Gold.
2842
"impeller_Play_AiksTest_TextRotated_Metal",
43+
"impeller_Play_AiksTest_TextRotated_Vulkan",
2944
};
3045

3146
namespace {
@@ -68,8 +83,22 @@ struct GoldenPlaygroundTest::GoldenPlaygroundTestImpl {
6883
GoldenPlaygroundTest::GoldenPlaygroundTest()
6984
: pimpl_(new GoldenPlaygroundTest::GoldenPlaygroundTestImpl()) {}
7085

86+
void GoldenPlaygroundTest::TearDown() {
87+
ASSERT_FALSE(dlopen("/usr/local/lib/libMoltenVK.dylib", RTLD_NOLOAD));
88+
}
89+
7190
void GoldenPlaygroundTest::SetUp() {
72-
if (GetBackend() != PlaygroundBackend::kMetal) {
91+
std::filesystem::path testing_assets_path =
92+
flutter::testing::GetTestingAssetsPath();
93+
std::filesystem::path target_path = testing_assets_path.parent_path()
94+
.parent_path()
95+
.parent_path()
96+
.parent_path();
97+
std::filesystem::path icd_path = target_path / "vk_swiftshader_icd.json";
98+
setenv("VK_ICD_FILENAMES", icd_path.c_str(), 1);
99+
100+
if (GetBackend() != PlaygroundBackend::kMetal &&
101+
GetBackend() != PlaygroundBackend::kVulkan) {
73102
GTEST_SKIP_("GoldenPlaygroundTest doesn't support this backend type.");
74103
return;
75104
}

impeller/golden_tests/golden_playground_test_stub.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ namespace impeller {
88

99
GoldenPlaygroundTest::GoldenPlaygroundTest() {}
1010

11+
void GoldenPlaygroundTest::TearDown() {}
12+
1113
void GoldenPlaygroundTest::SetUp() {
1214
GTEST_SKIP_("GoldenPlaygroundTest doesn't support this backend type.");
1315
}

impeller/golden_tests/main.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ int main(int argc, char** argv) {
5757
impeller::testing::GoldenDigest::Instance()->Write(
5858
impeller::testing::WorkingDirectory::Instance());
5959
}
60+
6061
return return_code;
6162
}

impeller/renderer/backend/vulkan/context_vk.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ void ContextVK::Setup(Settings settings) {
169169
application_info.setPApplicationName("Impeller");
170170

171171
std::vector<vk::ValidationFeatureEnableEXT> enabled_validations = {
172+
vk::ValidationFeatureEnableEXT::eBestPractices,
172173
vk::ValidationFeatureEnableEXT::eSynchronizationValidation,
173174
};
174175

0 commit comments

Comments
 (0)