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

Conversation

@gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Jan 18, 2024

fixes flutter/flutter#141705

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@gaaclarke gaaclarke marked this pull request as ready for review January 18, 2024 23:51
@gaaclarke
Copy link
Member Author

making it not a draft so we can get golden image tests

@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

Changes reported for pull request #49849 at sha d76241d

@gaaclarke
Copy link
Member Author

The colors for the golden images are different than the ones we are generating. I verified that the colors are correct by looking at the colors inside the generated png for impeller_Play_AiksTest_CanRenderSweepGradientManyColorsMirror_Vulkan and comparing them against the colors in the source code and they match.

Copy link
Contributor

@matanlurey matanlurey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me. A few questions, most non-blocking

}

const UInt8* MetalScreenshot::GetBytes() const {
const uint8_t* MetalScreenshot::GetBytes() const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(non-blocking) for my own curiosity, what is the difference between UInt8 and uint8_t here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UInt8 comes from Apple's c headers and used in Apple code, uint8_t comes from stdint.h.

FML_CHECK(success);
latch.Wait();

// TODO(gaaclarke): Replace CoreImage requirement with something
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking I understand - this is OSX-only code for MoltenVK?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case we are using swiftshader on macos. The tests should fail if you use moltenvk, there's a check in the TearDown somewhere that makes sure libMoltenVK.dylib isn't loaded.

}
EXPECT_EQ(max_mip_count, blur_required_mip_count);
// The log is FML_DLOG, so only check in debug builds.
#ifndef NDEBUG
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we build the unittests outside of debug mode?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, we run these in release build when we do golden image testing. The reason why was trying to keep the visual result we are looking at as close as possible to what users would see. It may be necessary now too that swiftshader goldens take >3s to generate on debug builds.

}

bool SaveScreenshot(std::unique_ptr<testing::MetalScreenshot> screenshot) {
bool SaveScreenshot(std::unique_ptr<testing::Screenshot> screenshot) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(non-blocking) Could this just be a reference to a screenshot instead of a pointer?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it could have been. In this case taking ownership of the screenshot or not is moot since no one ever uses it after it's saved. The minor downside of that is that in c++ you don't know from the call site if you are working with references or not like you do with rust. So keeping things as smart pointers avoids the situation where you have to make sure you aren't accidentally introducing an implicit copy.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(if I didn't want to take ownership, I would probably have made a reference to a unique_ptr instead of using a reference to a Screenshot for the above reason.)

public:
virtual ~Screenshot() = default;

virtual const uint8_t* GetBytes() const = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we have this neatly seperated it might be nice to ad 1-line comments at least for the non-obvious APIs (like I'm not sure what GetBytesPerRow() does for example, though maybe it's obvious to graphics engineers?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, added docstrings.

@gaaclarke gaaclarke requested a review from matanlurey January 19, 2024 21:53
@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

Changes reported for pull request #49849 at sha 19ffc9d

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 19, 2024
@gaaclarke
Copy link
Member Author

Note for future archeology:

These golden images were previously being generated with metal. This fixes the implementation to actually use vulkan to render the golden images. So if it seems like this PR changed a golden image test, it didn't since the old ones were a lie. I looked at all the diffs and they looked good despite some issue with gamma in the old tests that is now resolved.

@auto-submit auto-submit bot merged commit 83076ac into flutter:main Jan 19, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 20, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jan 20, 2024
…141914)

flutter/engine@d00e55f...a9b87c6

2024-01-20 [email protected] [Impeller] null check vertex buffer. (flutter/engine#49915)
2024-01-19 [email protected] [Impeller] adds vulkan golden images (flutter/engine#49849)
2024-01-19 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Fuchsia] Redo - Use chromium test-scripts to download images and execute tests" (flutter/engine#49908)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App e: impeller will affect goldens

Projects

No open projects
Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

[Impeller] implement golden image tests for vulkan

2 participants