-
Notifications
You must be signed in to change notification settings - Fork 6k
SKP based shader warmup #20643
SKP based shader warmup #20643
Conversation
8cd322f to
b9f6146
Compare
47ae5c2 to
85b7ce9
Compare
626596c to
8d1126f
Compare
0dc5b34 to
46d6fdb
Compare
| #if defined(OS_FUCHSIA) | ||
| #include "lib/sys/cpp/component_context.h" | ||
| #include "third_party/skia/include/ports/SkFontMgr_fuchsia.h" | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need an #endif here or the namespace declarations are stripped out, this will cause problems on non-fuchsia builds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this ifdef block wraps basically the entire file including the close braces on the namespace. I'll take an action item to comment the endif with "// defined(OS_FUCHSIA)" though
| on_create_rasterizer = [this](flutter::Shell& shell) { | ||
| FML_DCHECK(surface_producer_); | ||
|
|
||
| WarmupSkps( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I highly recommend wrapping all of the logic you're adding in a config flag
Otherwise a revert will make you very sad :(
46d6fdb to
d9a50db
Compare
liyuqian
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from the Flutter side with some minor nits.
| namespace flutter { | ||
|
|
||
| sk_sp<SkData> SerializeTypefaceWithoutData(SkTypeface* typeface, void* ctx) { | ||
| return typeface->serialize(SkTypeface::SerializeBehavior::kDontIncludeData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why the old line didn't work. I guess they should both save space, so is it because typeface->serialize(SkTypeface::SerializeBehavior::kDontIncludeData) somehow interfered with the Fuchsia typeface while SkData::MakeEmpty() won't?
Is this line also the reason why we need DeserializeTypefaceWithoutData?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit is from a while back so I don't 100% remember. IIRC even serializing typefaces with SerializeBehavior::kDontIncludeData caused the deserialized SkPictures to not be renderable (or maybe failed to deserialize, i dont quite remember) and talking with the Skia people about it I was advised that if all I wanted to do was warm up shaders they could vend be a special standin typeface which warms up all the typeface shaders and had me file https://bugs.chromium.org/p/skia/issues/detail?id=10404 for it. So basically this just serialized nothing and then on the deserialize path creates the default typeface. Once that skia feature is in DeserializeTypefaceWithoutData will return the special warmup typeface rather than the default typeface.
| mapping->GetSize()); | ||
|
|
||
| ASSERT_TRUE(result == filename); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: add a new line here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
shell/common/shell_unittests.cc
Outdated
| std::string filename = "test"; | ||
|
|
||
| bool success = fml::WriteAtomically(asset_dir_fd, filename.c_str(), | ||
| fml::DataMapping(filename)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: maybe create std::string content = "test" and write it into the file, so we'll have ASSERT_TRUE(result == content); which is less confusing than ASSERT_TRUE(result == filename);.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
303c999 to
7f78a28
Compare
|
The test failure in presubmit looks related to this patch: |
Asset Manager. Gives Asset Manager the ability to find files matching a specific pattern and uses that functionality to implement an entry point in PersistantCache which retreives mappings for all skp files in the Asset Bundle.
Make Engine load all .skp files from persistent cache and draw them on an offscreen surface to warm up shaders.
7f78a28 to
1b152e0
Compare
I'm not seeing this test, do you have a link or instructions on how to get to it? |
1b152e0 to
cd1fe95
Compare
Description
This PR implements SKP based shader warmup within the flutter engine on fuchsia.
Tests
Each commit comes with tests for the contents of that commit. The font tests are disabled because it fails due to https://bugs.chromium.org/p/skia/issues/detail?id=10404 but I left it in so it can be re-enabled when the fix is integrated. Includes new test suites for flutter::AssetManager and flutter_runner::Engine because no tests existed for these classes.