Skip to content
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] Allow metal shaders to compile through SPIR-V with openGL semantics. #40616

Merged

Conversation

jonahwilliams
Copy link
Member

Fixes flutter/flutter#123409

Using float16sampler2d requires compiling through openGL semantics. We shouldn't do this by default because it prevents us from using the framebuffer fetch extension.

@flutter-dashboard
Copy link

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 (don't just cc him here, he won't see it! He's on Discord!).

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.

@@ -666,12 +676,26 @@ template("_impeller_shaders_vk") {
#
# The SPIR-V version required by the shaders.
#
# @param[options] use_half_textures
#
# Whether the metal shader is using half-precision textures and requires
Copy link
Member

Choose a reason for hiding this comment

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

Can this be the default for Metal? Or is this because it interferes with the other features like framebuffer fetch? Perhaps we can detect that instead of tuning flags? Not sure. I bet this is fine too.

Copy link
Member Author

Choose a reason for hiding this comment

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

It interferes with framebuffer fetch specifically. I think there is a way to make that work but I haven't found it yet. I was planning to handle this as a follow up.

Copy link
Member Author

Choose a reason for hiding this comment

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

There's not really a great way to detect it automatically, since we only really get the chance to inspect the shader after its in a SPIR-V ast and at that point the validation that rejects the f16sampler2d has already run.

@chinmaygarde chinmaygarde changed the title [Impeller] allow metal shaders to compile through SPIR-V with openGL semantics [Impeller] Allow metal shaders to compile through SPIR-V with openGL semantics. Mar 26, 2023
@jonahwilliams
Copy link
Member Author

Friendly ping:) @dnfield @chinmaygarde

@@ -36,6 +36,7 @@ struct Switches {
uint32_t gles_language_version;
std::string metal_version;
std::string entry_point;
bool use_half_textures;
Copy link
Member

Choose a reason for hiding this comment

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

Default initialize all members. This and (if you are in the mood for drive-by changes) the other members in the struct.

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

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 28, 2023
@auto-submit auto-submit bot merged commit 1d506df into flutter:main Mar 28, 2023
37 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 29, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 29, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 29, 2023
zanderso pushed a commit to flutter/flutter that referenced this pull request Mar 29, 2023
…123664)

* 1d506dfd7 [Impeller] Allow metal shaders to compile through SPIR-V with openGL semantics. (flutter/engine#40616)

* 3287e2b36 [Impeller] support half precision uniforms and half precision samplers (flutter/engine#40590)

* 5c1c07fba Revert "Revert "Reland "Default the CanvasKit base URL to local artifacts. (#40293)" (#40470)" (#40700)" (flutter/engine#40717)

* 9e4cedc81 Forward stdout and stderr from dart2wasm when verbose. (flutter/engine#40731)

* 6941c1820 [Impeller] Allow toggling vulkan validation using a command line test flag. (flutter/engine#40728)

* 6ef595829 Roll buildroot to build CanvasKit for speed instead of code size (flutter/engine#40737)

* 5b8e02479 [Impeller] Gaussian blur: Add alpha mask specialization (flutter/engine#40707)

* 6852bea71 Roll Skia from 7311e9220faf to e3eeabb14e9c (4 revisions) (flutter/engine#40745)

* 235e42bea Add an option to malioc_diff.py to print a unified diff (flutter/engine#40732)

* 38e6d772f Roll Dart SDK from 1acd1e649fb7 to 69867ba60bb7 (2 revisions) (flutter/engine#40738)

* d81c4f2c7 [Impeller] migrate texture fill shaders to half precision. (flutter/engine#40735)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller needs tests
Projects
No open projects
Archived in project
2 participants