[Impeller] Create the golden test screenshotter after setting the Vulkan ICD environment variable (flutter/engine#49948)

This ensures that the test process will load the SwiftShader implementation of Vulkan if a VulkanScreenshotter is instantiated.
This commit is contained in:
Jason Simmons 2024-01-22 14:19:18 -08:00 committed by GitHub
parent e54858b901
commit 81277b90ed

View File

@ -98,13 +98,7 @@ struct GoldenPlaygroundTest::GoldenPlaygroundTestImpl {
GoldenPlaygroundTest::GoldenPlaygroundTest()
: typographer_context_(TypographerContextSkia::Make()),
pimpl_(new GoldenPlaygroundTest::GoldenPlaygroundTestImpl()) {
if (GetParam() == PlaygroundBackend::kMetal) {
pimpl_->screenshotter = std::make_unique<testing::MetalScreenshotter>();
} else if (GetParam() == PlaygroundBackend::kVulkan) {
pimpl_->screenshotter = std::make_unique<testing::VulkanScreenshotter>();
}
}
pimpl_(new GoldenPlaygroundTest::GoldenPlaygroundTestImpl()) {}
GoldenPlaygroundTest::~GoldenPlaygroundTest() = default;
@ -133,6 +127,12 @@ void GoldenPlaygroundTest::SetUp() {
return;
}
if (GetParam() == PlaygroundBackend::kMetal) {
pimpl_->screenshotter = std::make_unique<testing::MetalScreenshotter>();
} else if (GetParam() == PlaygroundBackend::kVulkan) {
pimpl_->screenshotter = std::make_unique<testing::VulkanScreenshotter>();
}
std::string test_name = GetTestName();
if (std::find(kSkipTests.begin(), kSkipTests.end(), test_name) !=
kSkipTests.end()) {