Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@jonahwilliams
Copy link
Contributor

See b/335381180

In an upcoming version of SPIRV tools, these constants are being flagged as invalid. Due to some combination of the macros + inlining we're ending up with multiple precision modifiers on the constants:

third_party/flutter_engine/impeller/entity/shaders/radial_gradient_fill.frag: GLSL to SPIRV failed; Compilation error. 0 error(s) and 1 warning(s).
third_party/flutter_engine/impeller/entity/shaders/radial_gradient_fill.frag:14: warning: '' : all default precisions are highp; use precision statements to quiet warning, e.g.:
third_party/flutter_engine/impeller/entity/shaders/radial_gradient_fill.frag:          "precision mediump int; precision highp float;" 
shaderc: internal error: compilation succeeded but failed to optimize: ID '112' decorated with RelaxedPrecision multiple times is not allowed.
  %float_n0_474999994 = OpConstant %float -0.474999994

We don't really benefit from half precision on these, since we're either using them for equality or can cheaply convert to half precision anyway.

@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 "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use 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.

// 'FilterContents::MorphType' enum class.
const float16_t kMorphTypeDilate = 0.0hf;
const float16_t kMorphTypeErode = 1.0hf;
const float kMorphTypeDilate = 0.0;
Copy link
Member

Choose a reason for hiding this comment

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

Even with these changes, the duplicate constant error is still showing up:

shaderc: internal error: compilation succeeded but failed to optimize: ID '27' decorated with RelaxedPrecision multiple times is not allowed.
  %float_0 = OpConstant %float 0

Also, similar changes are needed to:

const float16_t kBT601LimitedRange = 0.0hf;
const float16_t kBT601FullRange = 1.0hf;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. Sorry, do you mean that even with this change there are still compilation errors?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah that's what I meant. The compiler doesn't like 0 and 1 as constants for this file and yuv_to_rgb_filter.frag.

Copy link
Member

Choose a reason for hiding this comment

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

The latest commit 80579dd fixes the issue 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

woot, thanks for helping with this @jiahaog

@jonahwilliams jonahwilliams changed the title [Impeller] dont use half precision constants. [Impeller] dont use half precision constants / Fixes for SPIRV tools roll Apr 18, 2024
@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 18, 2024
@auto-submit auto-submit bot merged commit 442d14a into flutter:main Apr 18, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 19, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 19, 2024
gilnobrega pushed a commit to gilnobrega/flutter that referenced this pull request Apr 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App e: impeller

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants