-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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] ☂️ Use hardware features to improve performance of advanced blends. #120223
Comments
breadcrumb: gpuweb/gpuweb#442 |
It looks like spirvcross supports this, but we'd need to specifically use MSL 2.0. For example:
And this generates:
This requires setting MSL 2.0 in the compiler and probably in other places too |
All of command line options use --std=ios-metal1.2 too so we'd need to add new targets to build these |
Note that we need to find a way to read from the actual framebuffer that's being written to. If we can't do that, then there's not a way to get around the need to use multiple render passes for custom blend behavior AFAICT (which is where the requirement to store/load the texture is coming from). Metal for iOS has a special feature that let's you read from the framebuffer (which isn't available on MacOS). |
I believe that can be done, see KhronosGroup/SPIRV-Cross#634
becomes
|
Of couse combing the two I get '#extension' : extension not supported: GL_APPLE_shader_framebuffer_fetch. so we might need more tweaks to the build |
ahh nvm, more caveats:
|
So in conclusion, it should be possible but we might need to hack support into impellerc for any rewriting |
So after more investigation, getting the correct code generated out of a particular SPIRV binary is a lot simpler than finding out how to get GLSL to compile to the correct SPIRV code. I have not found any particular mechanism to make this work after a few hours of investigation (that is par for the course though). Some combination of decorations/variable names/ extensions might make this work but its not clear what that is. |
It may be easier to set up a metal source code pipeline that bypasses impellerc, especially since these particular shaders would only ever run on iOS. That leaves some questions about how to setup the bindings, but TBH I could probably write those by hand. |
I managed to get this compiling. Shaders don't actually work yet, but closer! |
TL;DR: I recommend not using
|
This is now done for iOS. Remaining platforms will need to wait until we get to them |
xref: flutter/engine#39567 |
flutter/flutter#120223 for OpenGLES. Checks for support of the framebuffer fetch extension: https://registry.khronos.org/OpenGL/extensions/EXT/EXT_shader_framebuffer_fetch.txt . This is supported on a Pixel 6 at least, we should double check the distribution of the extension. ![d3c](https://github.com/flutter/engine/assets/8975114/d2392dc8-e1b1-4084-ac5d-c5744c651a39)
flutter/flutter#120223 for OpenGLES. Checks for support of the framebuffer fetch extension: https://registry.khronos.org/OpenGL/extensions/EXT/EXT_shader_framebuffer_fetch.txt . This is supported on a Pixel 6 at least, we should double check the distribution of the extension. ![d3c](https://github.com/flutter/engine/assets/8975114/d2392dc8-e1b1-4084-ac5d-c5744c651a39)
I investigated using the Vulkan and Open advanced blend extensions in flutter/engine#47131 What I found was: The pIxel 4xl claimed to support the extension, but downloading a necessary driver update removed support for it. When targetin openGL I've not been able to get the shader source required for the feature accepted, as we target GLSL 100 which does not support layout qualifiers. |
…TACHMENT_ACCESS (#48458) Support framebuffer fetch on devices that have the extension VK_ARM_RASTERIZATION_ORDER_ATTACHMENT_ACCESS which gives us a fairly easy way to add subpass self dependencies. Part of flutter/flutter#120223
This is complete for Metal and Vulkan. |
@bdero @jonahwilliams Does VK_EXT_blend_operation_advanced need to be attempted for Vulkan? Can we cross that out in the original list? |
In order to perform advanced blends today, we:
We can avoid this Rube Goldberg machine by taking better advantage of hardware/API features:
The text was updated successfully, but these errors were encountered: