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
Enable Skia's Vulkan backend on all non-mobile platforms, and test SwiftShader Vulkan on all GL unittests platforms #29520
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
27b0ad1
to
ab2206e
Compare
da7911f
to
b19b709
Compare
This comment has been minimized.
This comment has been minimized.
fc51cc3
to
5a6713e
Compare
9498104
to
f2789cf
Compare
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.
Mostly LGTM except I don't think setting shell_enable_vulkan to true unconditionally is what we want for iOS and Android.
testing/test_vulkan_context.h
Outdated
public: | ||
TestVulkanContext(); | ||
~TestVulkanContext(); | ||
bool is_valid(); |
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: bool IsValid() const;
.
The case because its OOL and the const
because of const-correctness.
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.
fml::RefPtr<vulkan::VulkanProcTable> vk_; | ||
std::unique_ptr<vulkan::VulkanApplication> application_; | ||
std::unique_ptr<vulkan::VulkanDevice> logical_device_; | ||
}; |
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.
FML_DISALLOW_COPY_AND_ASSIGN
explicitly even though this can't really be copied because of the unique pointers.
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.
testing/test_vulkan_context.h
Outdated
bool is_valid(); | ||
|
||
private: | ||
bool valid_; |
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.
Default to false here in case we add additional ctors and forget to initialize the scalar explicitly in one of them? Your call.
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.
sgtm, done.
#endif // VULKAN_LINK_STATICALLY | ||
return !!handle_; |
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.
lol, I never thought of this to avoid an explicit bool cast without actually using an explicit cast. Love it.
tools/gn
Outdated
@@ -308,6 +308,12 @@ def to_gn_args(args): | |||
gn_args['skia_use_metal'] = True | |||
gn_args['shell_enable_metal'] = True | |||
|
|||
# Enable Vulkan on all platforms. | |||
gn_args['skia_use_vulkan'] = True | |||
gn_args['shell_enable_vulkan'] = True |
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 believe this will compile the vulkan shell component even on iOS and Android. The desire is to compile Vulkan on all host unit-test targets right?
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.
My intention was to enable Vulkan support for all libflutter platform distributions including iOS, so that embedder writers have the option to target just Vulkan and use translation ICDs like MoltenVK. Partially because I want it, but also just because we can. :)
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.
With that, you run into the issue of bumping up the binary size on those target. And we are pretty sensitive to that metric.
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'll disable this for Android/iOS for the time being and leave a note since it's easier to flip on than flip off later.
48b7b09
to
1fda20c
Compare
@chinmaygarde Could you give this another look when you get a moment? I think this should be good to go. |
… test SwiftShader Vulkan on all GL unittests platforms (flutter/engine#29520)
… test SwiftShader Vulkan on all GL unittests platforms (flutter/engine#29520)
How is this supposed to work on macos? I get build error when it tries to compile |
@knopp The embedder unittests link Swiftshader, which is one of several Vulkan ICDs that support MacOS. Could you open an issue with the error you're getting/repro steps and tag me on it? |
@bdero, nevermind, I think the problem was missing |
Previous commit: flutter@cdbb428 Add test context for loading swiftshader so update Remove unused things Prereqs to GPUSurfaceVulkan rewrite Comment typos
… test SwiftShader Vulkan on all GL unittests platforms (flutter#29520)" Causes the following build breakage (Win32): [19/1564] CXX obj/flutter/vulkan/vulkan.vulkan_window.obj FAILED: obj/flutter/vulkan/vulkan.vulkan_window.obj ninja -t msvc -e environment.x64 -- ../../buildtools/windows-x64/clang/bin/clang-cl.exe /nologo /showIncludes @obj/flutter/vulkan/vulkan.vulkan_window.obj.rsp /c ../../flutter/vulkan/vulkan_window.cc /Foobj/flutter/vulkan/vulkan.vulkan_window.obj /Fdobj/flutter/vulkan/vulkan_cc.pdb ../../flutter/vulkan/vulkan_window.cc(125,24): error: no member named 'MakeVulkan' in 'GrDirectContext' GrDirectContext::MakeVulkan(backend_context, options); ~~~~~~~~~~~~~~~~~^ 1 error generated. This reverts commit bba38c0.
Previous commit: flutter@cdbb428 Add test context for loading swiftshader so update Remove unused things Prereqs to GPUSurfaceVulkan rewrite Comment typos
Previous commit: flutter@cdbb428 Add test context for loading swiftshader so update Remove unused things Prereqs to GPUSurfaceVulkan rewrite Comment typos
Previous commit: flutter@cdbb428 Add test context for loading swiftshader so update Remove unused things Prereqs to GPUSurfaceVulkan rewrite Comment typos
Previous commit: flutter@cdbb428 Add test context for loading swiftshader so update Remove unused things Prereqs to GPUSurfaceVulkan rewrite Comment typos
Previous commit: flutter@cdbb428 Add test context for loading swiftshader so update Remove unused things Prereqs to GPUSurfaceVulkan rewrite Comment typos
Previous commit: flutter@cdbb428 Add test context for loading swiftshader so update Remove unused things Prereqs to GPUSurfaceVulkan rewrite Comment typos
Previous commit: flutter@cdbb428 Add test context for loading swiftshader so update Remove unused things Prereqs to GPUSurfaceVulkan rewrite Comment typos
Previous commit: flutter@cdbb428 Add test context for loading swiftshader so update Remove unused things Prereqs to GPUSurfaceVulkan rewrite Comment typos
Previous commit: flutter@cdbb428 Add test context for loading swiftshader so update Remove unused things Prereqs to GPUSurfaceVulkan rewrite Comment typos
Previous commit: flutter@cdbb428 Add test context for loading swiftshader so update Remove unused things Prereqs to GPUSurfaceVulkan rewrite Comment typos
Previous commit: flutter@cdbb428 Add test context for loading swiftshader so update Remove unused things Prereqs to GPUSurfaceVulkan rewrite Comment typos
Previous commit: flutter@cdbb428 Add test context for loading swiftshader so update Remove unused things Prereqs to GPUSurfaceVulkan rewrite Comment typos
Previous commit: flutter@cdbb428 Add test context for loading swiftshader so update Remove unused things Prereqs to GPUSurfaceVulkan rewrite Comment typos
Previous commit: flutter@cdbb428 Add test context for loading swiftshader so update Remove unused things Prereqs to GPUSurfaceVulkan rewrite Comment typos
Patches that need to land before this is merged: