Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
SKP based shader warmup #20643
SKP based shader warmup #20643
Conversation
47ae5c2
to
85b7ce9
626596c
to
8d1126f
0dc5b34
to
46d6fdb
|
|
||
| #if defined(OS_FUCHSIA) | ||
| #include "lib/sys/cpp/component_context.h" | ||
| #include "third_party/skia/include/ports/SkFontMgr_fuchsia.h" | ||
|
|
arbreng
Oct 27, 2020
Contributor
You need an #endif here or the namespace declarations are stripped out, this will cause problems on non-fuchsia builds
You need an #endif here or the namespace declarations are stripped out, this will cause problems on non-fuchsia builds
freiling
Oct 28, 2020
Author
Contributor
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
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( |
arbreng
Oct 27, 2020
Contributor
I highly recommend wrapping all of the logic you're adding in a config flag
Otherwise a revert will make you very sad :(
I highly recommend wrapping all of the logic you're adding in a config flag
Otherwise a revert will make you very sad :(
|
Looks good from the Flutter side with some minor nits. |
| #include "include/core/SkStream.h" | ||
| #include "include/core/SkTypeface.h" | ||
|
|
||
| namespace flutter { | ||
|
|
||
| sk_sp<SkData> SerializeTypefaceWithoutData(SkTypeface* typeface, void* ctx) { | ||
| return typeface->serialize(SkTypeface::SerializeBehavior::kDontIncludeData); |
liyuqian
Oct 28, 2020
Contributor
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?
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?
freiling
Oct 30, 2020
Author
Contributor
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.
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); | ||
| } |
liyuqian
Oct 28, 2020
Contributor
Nit: add a new line here.
Nit: add a new line here.
freiling
Oct 30, 2020
Author
Contributor
Done
Done
| std::string filename = "test"; | ||
|
|
||
| bool success = fml::WriteAtomically(asset_dir_fd, filename.c_str(), | ||
| fml::DataMapping(filename)); |
liyuqian
Oct 28, 2020
Contributor
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);.
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);.
freiling
Oct 30, 2020
Author
Contributor
Done
Done
303c999
to
7f78a28
|
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.
I'm not seeing this test, do you have a link or instructions on how to get to it? |
3105db8
into
flutter:master
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.