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

[Impeller] turned on validation errors for one golden image test #49955

Merged
merged 3 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions impeller/golden_tests/golden_playground_test_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ static const std::vector<std::string> 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<std::string> kVulkanValidationTests = {
"impeller_Play_AiksTest_CanRenderTextFrame_Vulkan",
};

namespace {
std::string GetTestName() {
std::string suite_name =
Expand Down Expand Up @@ -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<testing::MetalScreenshotter>();
} else if (GetParam() == PlaygroundBackend::kVulkan) {
pimpl_->screenshotter = std::make_unique<testing::VulkanScreenshotter>();
pimpl_->screenshotter = std::make_unique<testing::VulkanScreenshotter>(
enable_vulkan_validations);
}

std::string test_name = GetTestName();
if (std::find(kSkipTests.begin(), kSkipTests.end(), test_name) !=
kSkipTests.end()) {
GTEST_SKIP_(
Expand Down
2 changes: 1 addition & 1 deletion impeller/golden_tests/vulkan_screenshotter.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace testing {
/// playground backend.
class VulkanScreenshotter : public Screenshotter {
public:
VulkanScreenshotter();
explicit VulkanScreenshotter(bool enable_validations);

std::unique_ptr<Screenshot> MakeScreenshot(
AiksContext& aiks_context,
Expand Down
6 changes: 4 additions & 2 deletions impeller/golden_tests/vulkan_screenshotter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@
}
} // 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<Screenshot> VulkanScreenshotter::MakeScreenshot(
Expand Down