[Impeller] starts running vulkan golden image tests with swiftshader (flutter/engine#41958)

fixes https://github.com/flutter/flutter/issues/126022

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
gaaclarke
2023-05-12 13:34:55 -07:00
committed by GitHub
parent e87d7155d2
commit 015608f15e
6 changed files with 40 additions and 4 deletions

View File

@@ -146,7 +146,8 @@
"release",
"--no-lto",
"--prebuilt-dart-sdk",
"--build-embedder-examples"
"--build-embedder-examples",
"--enable-impeller-vulkan"
],
"name": "host_release",
"ninja": {

View File

@@ -74,6 +74,7 @@ if (is_mac) {
"//flutter/impeller/aiks:aiks_unittests_golden",
"//flutter/impeller/fixtures",
"//third_party/googletest:gtest",
"//third_party/swiftshader",
]
}
}

View File

@@ -24,6 +24,8 @@ class GoldenPlaygroundTest
void SetUp();
void TearDown();
PlaygroundBackend GetBackend() const;
bool OpenPlaygroundHere(const Picture& picture);

View File

@@ -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 <dlfcn.h>
#include <filesystem>
#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<std::string> 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;
}

View File

@@ -8,6 +8,8 @@ namespace impeller {
GoldenPlaygroundTest::GoldenPlaygroundTest() {}
void GoldenPlaygroundTest::TearDown() {}
void GoldenPlaygroundTest::SetUp() {
GTEST_SKIP_("GoldenPlaygroundTest doesn't support this backend type.");
}

View File

@@ -487,9 +487,10 @@ def run_cc_tests(build_dir, executable_filter, coverage, capture_core_dump):
'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 run_cc_tests(build_dir, executable_filter, coverage, capture_core_dump):
build_dir,
'impeller_unittests',
executable_filter,
shuffle_flags,
['--gtest_filter=-*/Vulkan'] + shuffle_flags,
coverage=coverage,
extra_env=extra_env,
# TODO(117122): Remove this allowlist.