Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Impeller] adds a plus advanced blend for f16 pixel formats #51589

Merged
merged 25 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ed6da6a
[Impeller] adds wide gamut golden tests
gaaclarke Mar 15, 2024
b51b9a2
updated golden
gaaclarke Mar 18, 2024
55135b8
moved to a magic name
gaaclarke Mar 26, 2024
509f20b
[Impeller] fixes alpha blend for plus blend mode
gaaclarke Mar 15, 2024
47498e1
[Impeller] made plus an advanced blend
gaaclarke Mar 21, 2024
c2a9d68
fixed the blending math (jasons test passes now)
gaaclarke Mar 22, 2024
d3e714e
fixed ColorBlendReturnsExpectedResults test
gaaclarke Mar 25, 2024
85e93d7
refactored the geometry tests to not be dependent on order
gaaclarke Mar 25, 2024
dacb1e4
removed single plus test, renamed the overlapping one
gaaclarke Mar 25, 2024
418c811
fixed Play/AiksTest.PaintBlendModeIsRespected/OpenGLES
gaaclarke Mar 25, 2024
c3aa8cc
moved the test to the new magic name, removed the blending test
gaaclarke Mar 26, 2024
5b5e6ca
gave golden image tests the magic name feature
gaaclarke Mar 26, 2024
7953bd7
resurrected the old blend
gaaclarke Mar 26, 2024
eb03810
added switch for the advancedblend
gaaclarke Mar 26, 2024
9a8ee6f
added tests for the magic test name
gaaclarke Mar 27, 2024
7ca79f6
renamed some variables
gaaclarke Mar 27, 2024
337876d
moved things to match how they were
gaaclarke Mar 27, 2024
669a096
factored out the shared blend function
gaaclarke Mar 27, 2024
cc8ab6a
factored out shared function
gaaclarke Mar 27, 2024
90330f4
added skip for non metal tests
gaaclarke Mar 27, 2024
2650ee0
fixed opengl run
gaaclarke Mar 27, 2024
afa7908
updated goldens
gaaclarke Mar 27, 2024
7081ef7
updated goldens
gaaclarke Mar 27, 2024
5025ec1
added support for colorfilters
gaaclarke Mar 27, 2024
202f56d
format
gaaclarke Mar 27, 2024
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
Prev Previous commit
Next Next commit
moved to a magic name
  • Loading branch information
gaaclarke committed Mar 27, 2024
commit 55135b887e311ce17d9ccada922afab94284ced1
4 changes: 0 additions & 4 deletions impeller/golden_tests/golden_playground_test_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@ void GoldenPlaygroundTest::SetUp() {
setenv("VK_ICD_FILENAMES", icd_path.c_str(), 1);

switch (GetParam()) {
case PlaygroundBackend::kMetalWideGamut:
pimpl_->screenshotter = std::make_unique<testing::MetalScreenshotter>(
/*enable_wide_gamut=*/true);
break;
case PlaygroundBackend::kMetal:
pimpl_->screenshotter = std::make_unique<testing::MetalScreenshotter>(
/*enable_wide_gamut=*/false);
Expand Down
9 changes: 2 additions & 7 deletions impeller/golden_tests/metal_screenshotter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@
MetalScreenshotter::MetalScreenshotter(bool enable_wide_gamut) {
FML_CHECK(::glfwInit() == GLFW_TRUE);
PlaygroundSwitches switches;
if (enable_wide_gamut) {
switches.enable_wide_gamut = true;
playground_ =
PlaygroundImpl::Create(PlaygroundBackend::kMetalWideGamut, switches);
} else {
playground_ = PlaygroundImpl::Create(PlaygroundBackend::kMetal, switches);
}
switches.enable_wide_gamut = enable_wide_gamut;
playground_ = PlaygroundImpl::Create(PlaygroundBackend::kMetal, switches);
}

std::unique_ptr<Screenshot> MetalScreenshotter::MakeScreenshot(
Expand Down
2 changes: 1 addition & 1 deletion impeller/playground/compute_playground_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void ComputePlaygroundTest::SetUp() {
return;
}

SetupContext(GetParam());
SetupContext(GetParam(), switches_);
SetupWindow();

start_time_ = fml::TimePoint::Now().ToEpochDelta();
Expand Down
9 changes: 3 additions & 6 deletions impeller/playground/playground.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ namespace impeller {

std::string PlaygroundBackendToString(PlaygroundBackend backend) {
switch (backend) {
case PlaygroundBackend::kMetalWideGamut:
return "MetalWideGamut";
case PlaygroundBackend::kMetal:
return "Metal";
case PlaygroundBackend::kOpenGLES:
Expand Down Expand Up @@ -100,8 +98,6 @@ std::shared_ptr<Context> Playground::MakeContext() const {

bool Playground::SupportsBackend(PlaygroundBackend backend) {
switch (backend) {
case PlaygroundBackend::kMetalWideGamut:
[[fallthrough]];
case PlaygroundBackend::kMetal:
#if IMPELLER_ENABLE_METAL
return true;
Expand All @@ -124,10 +120,11 @@ bool Playground::SupportsBackend(PlaygroundBackend backend) {
FML_UNREACHABLE();
}

void Playground::SetupContext(PlaygroundBackend backend) {
void Playground::SetupContext(PlaygroundBackend backend,
const PlaygroundSwitches& switches) {
FML_CHECK(SupportsBackend(backend));

impl_ = PlaygroundImpl::Create(backend, switches_);
impl_ = PlaygroundImpl::Create(backend, switches);
if (!impl_) {
FML_LOG(WARNING) << "PlaygroundImpl::Create failed.";
return;
Expand Down
6 changes: 2 additions & 4 deletions impeller/playground/playground.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class PlaygroundImpl;

enum class PlaygroundBackend {
kMetal,
kMetalWideGamut,
kOpenGLES,
kVulkan,
};
Expand All @@ -37,8 +36,6 @@ constexpr inline RuntimeStageBackend PlaygroundBackendToRuntimeStageBackend(
PlaygroundBackend backend) {
switch (backend) {
case PlaygroundBackend::kMetal:
[[fallthrough]];
case PlaygroundBackend::kMetalWideGamut:
return RuntimeStageBackend::kMetal;
case PlaygroundBackend::kOpenGLES:
return RuntimeStageBackend::kOpenGLES;
Expand All @@ -60,7 +57,8 @@ class Playground {

static bool ShouldOpenNewPlaygrounds();

void SetupContext(PlaygroundBackend backend);
void SetupContext(PlaygroundBackend backend,
const PlaygroundSwitches& switches);

void SetupWindow();

Expand Down
3 changes: 0 additions & 3 deletions impeller/playground/playground_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ std::unique_ptr<PlaygroundImpl> PlaygroundImpl::Create(
PlaygroundSwitches switches) {
switch (backend) {
#if IMPELLER_ENABLE_METAL
case PlaygroundBackend::kMetalWideGamut:
switches.enable_wide_gamut = true;
return std::make_unique<PlaygroundImplMTL>(switches);
case PlaygroundBackend::kMetal:
return std::make_unique<PlaygroundImplMTL>(switches);
#endif // IMPELLER_ENABLE_METAL
Expand Down
10 changes: 7 additions & 3 deletions impeller/playground/playground_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ void PlaygroundTest::SetUp() {

ImpellerValidationErrorsSetFatal(true);

SetupContext(GetParam());
// Test names that end with "WideGamut" will render with wide gamut support.
std::string test_name = flutter::testing::GetCurrentTestName();
PlaygroundSwitches switches = switches_;
switches.enable_wide_gamut =
test_name.find("WideGamut/") != std::string::npos;

SetupContext(GetParam(), switches);
SetupWindow();
}

Expand Down Expand Up @@ -62,8 +68,6 @@ std::string PlaygroundTest::GetWindowTitle() const {
stream << "Impeller Playground for '"
<< flutter::testing::GetCurrentTestName() << "' ";
switch (GetBackend()) {
case PlaygroundBackend::kMetalWideGamut:
[[fallthrough]];
case PlaygroundBackend::kMetal:
break;
case PlaygroundBackend::kOpenGLES:
Expand Down
6 changes: 3 additions & 3 deletions impeller/playground/playground_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ class PlaygroundTest : public Playground,
""; \
INSTANTIATE_TEST_SUITE_P( \
Play, playground, \
::testing::Values( \
PlaygroundBackend::kMetal, PlaygroundBackend::kMetalWideGamut, \
PlaygroundBackend::kOpenGLES, PlaygroundBackend::kVulkan), \
::testing::Values(PlaygroundBackend::kMetal, \
PlaygroundBackend::kOpenGLES, \
PlaygroundBackend::kVulkan), \
[](const ::testing::TestParamInfo<PlaygroundTest::ParamType>& info) { \
return PlaygroundBackendToString(info.param); \
});
Expand Down
3 changes: 1 addition & 2 deletions impeller/runtime_stage/runtime_stage_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ TEST_P(RuntimeStageTest, CanReadUniforms) {

ASSERT_TRUE(stage->IsValid());
switch (GetBackend()) {
case PlaygroundBackend::kMetalWideGamut:
[[fallthrough]];
case PlaygroundBackend::kMetal:
[[fallthrough]];
case PlaygroundBackend::kOpenGLES: {
ASSERT_EQ(stage->GetUniforms().size(), 17u);
{
Expand Down
Loading