Repository navigation
Add --shader-report and --fail-on-unused-shaders option to impeller_golden_tests - #193319
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements a pipeline variant recording diagnostic for Impeller to track warmed versus drawn pipeline variants. It introduces the PipelineVariantRecorder utility, adds corresponding unit tests, and integrates report generation into the test suite via the --shader-report flag. Feedback on the implementation highlights a potential null pointer dereference in the ContentContext destructor when accessing pipelines_ without a prior null check.
gaaclarke
left a comment
There was a problem hiding this comment.
The output is inscrutable right now =)
The flag should set the return value as non-zero when there is a warmed pipeline that isn't used. The log should only report the pipelines that are not used. It shouldn't mention used pipelines or how many times they were used.
"spec" is a surprising abbreviation for "specialization constants", "SC" is more clear.
Split the flag in two --shader-report: The big ugly text dump that reports on which variants are prewarmed, but not used - this will be used to inform changes to our prewarming defaults. --fail-on-unused-shaders: A coverage signal that indicates gaps in our testing/completely dead shaders - will be run in CI after the report from the description is handled.
Changed
|
gaaclarke
left a comment
There was a problem hiding this comment.
I want to pull more of this added logic out of ContentContext. I'd like no additions to content_context.h and the only additions to content_context.cc to be macro calls. We can do that by splitting out more logic into it's own file and maybe a bit fancier bookkeeping.
| #ifdef IMPELLER_RECORD_PIPELINE_VARIANTS | ||
| warmed = tVariantRecorder != nullptr; | ||
| if (warmed) { | ||
| recorder_ = tVariantRecorder; | ||
| } | ||
| #endif // IMPELLER_RECORD_PIPELINE_VARIANTS |
There was a problem hiding this comment.
Instead of a scoped conditional compilation, please use a macro instead.
[warmed, recorder_] = IMPELLER_RECORD_PIPELINE_VARIANTS_FOOBAR();
There was a problem hiding this comment.
Resolved I think, didn't follow your exact pattern
gaaclarke
left a comment
There was a problem hiding this comment.
lgtm, thanks that looks much more clean on content_context.cc
|
@gaaclarke, had to do a minor fix for clang_tidy |
|
@gaaclarke I am once again asking for a re-lgtm |
|
autosubmit label was removed for flutter/flutter/193319, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR. |
|
auto label is removed for flutter/flutter/193319, Failed to enqueue flutter/flutter/193319 with HTTP 400: Something went wrong while executing your query on 2026-10-07T15:17:05Z. Please include |
…ter#194055) Add golden tests for previously untested shaders. Follow on from flutter#193319. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant in-code documentation (doc comments with `///`). - [x] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
…er#194597) flutter#193319 revealed that in our golden test suite, 0% of draw calls were handled by a prewarmed pipeline variant. This causes a first-frame shader cache miss 100% of the time - causing in the worst case a full re-compilation + link. This change changes our defaults to better match what we actually request at draw time. Running impeller_golden_tests with --shader-report before this change: ``` Draws covered by warmed variants: 0 of 620,533 (0.0%) ``` Running impeller_golden_tests with --shader-report after this change: ``` Draws covered by warmed variants: 610,441 of 620,533 (98.4%) ``` Without compiling additional variants, we can't get full coverage in our golden suite, but this change is directionally correct toward the goal of eliminating first-frame shader cache misses. Fixes flutter#194595 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant in-code documentation (doc comments with `///`). - [x] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
…olden_tests (flutter#193319) Fixes flutter#193318 Adds a --shader-report option to impeller_golden_tests. When running with this option, the test suite will spit out a report on which shaders were prewarmed, but never used. Adds a --fail-on-unused-shaders option to impeller_golden_tests. When running with this option, the goldens will fail if there are any shaders that are completely unused in the golden tests. Everything is only run in debug builds inside of impeller_golden_tests, so no production impact. --fail-on-unused-shaders is not hooked up to CI yet. Example output for --shader-report: ``` ================================================================================ Impeller pipeline variant usage ================================================================================ 2948 tests run, 55 skipped, 0 failed, filter '*' Legend: SC = specialization constants, +flag = option enabled, "drawn as" = how the same pipeline was actually drawn. -------------------------------------------------------------------------------- Metal 276 variants: 137 warmed (0 drawn) | 0 created lazily, never drawn Draws covered by warmed variants: 0 of 620,223 (0.0%) WARMED BUT NEVER DRAWN (137) - candidates to stop warming Likely cause: 111 of 137 were drawn, but only with other options: 111 depth Always -> GreaterEqual 48 blend SrcOver -> Src 45 format B10G10R10A10XR -> B8G8R8A8UNormInt 26 prim Triangle -> TriangleStrip 16 depth_stencil on -> off 16 msaa 4x -> 1x 4 prim TriangleStrip -> Triangle 2 blend SrcOver -> Dst ... 3 other changes 26 of 137 were never drawn with any options. msaa=1x blend=SrcOver depth=Always stencil=Ignore prim=TriangleStrip format=B8G8R8A8UNormInt Gaussian Pipeline SC=[1] drawn as: depth Always -> GreaterEqual (2,248 draws) TextureDownsample Pipeline drawn as: depth Always -> GreaterEqual (866 draws) TextureDownsampleBounded Pipeline drawn as: depth Always -> GreaterEqual (18 draws) msaa=1x blend=SrcOver depth=Always stencil=Ignore prim=TriangleStrip format=B10G10R10A10XR Gaussian Pipeline SC=[1] drawn as: depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (2,248 draws) TextureDownsample Pipeline drawn as: depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (866 draws) TextureDownsampleBounded Pipeline drawn as: depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (18 draws) msaa=4x blend=SrcOver depth=Always stencil=Ignore prim=Triangle format=B8G8R8A8UNormInt +depth_stencil Circle Pipeline drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip (2,949 draws) Clip Pipeline drawn as: blend SrcOver -> Dst, depth Always -> GreaterEqual, stencil Ignore -> StencilIncrementAll, prim Triangle -> TriangleStrip (390 draws) ComplexRse Pipeline drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip (8 draws) ConicalGradientSsboFill Pipeline SC=[0] never drawn with any options ConicalGradientSsboFill Pipeline SC=[1] drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip (8 draws) ConicalGradientSsboFill Pipeline SC=[2] drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip (4 draws) ConicalGradientSsboFill Pipeline SC=[3] drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip (41 draws) FastGradient Pipeline drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, depth_write off -> on (8 draws) GlyphAtlas Pipeline SC=[1] drawn as: depth Always -> GreaterEqual (690 draws) LinearGradientSsboFill Pipeline drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip (86 draws) RadialGradientSsboFill Pipeline drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip (96 draws) ShadowVertices Pipeline drawn as: depth Always -> GreaterEqual (660 draws) SolidFill Pipeline drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip (2,400 draws) SweepGradientSsboFill Pipeline drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip (36 draws) TextureFill Pipeline drawn as: depth Always -> GreaterEqual (16 draws) TextureFillStrictSrc Pipeline drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip (60 draws) TiledTextureFill Pipeline SC=[1] drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip (418 draws) UberSdf Pipeline drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip (295,723 draws) VerticesUber1 Pipeline SC=[1] drawn as: depth Always -> GreaterEqual (8 draws) VerticesUber2 Pipeline SC=[1] never drawn with any options msaa=4x blend=SrcOver depth=Always stencil=Ignore prim=Triangle format=B10G10R10A10XR +depth_stencil Circle Pipeline drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip, format B10G10R10A10XR -> B8G8R8A8UNormInt (2,949 draws) Clip Pipeline drawn as: blend SrcOver -> Dst, depth Always -> GreaterEqual, stencil Ignore -> StencilIncrementAll, prim Triangle -> TriangleStrip, format B10G10R10A10XR -> B8G8R8A8UNormInt (390 draws) ComplexRse Pipeline drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip, format B10G10R10A10XR -> B8G8R8A8UNormInt (8 draws) ConicalGradientSsboFill Pipeline SC=[0] never drawn with any options ConicalGradientSsboFill Pipeline SC=[1] drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip, format B10G10R10A10XR -> B8G8R8A8UNormInt (8 draws) ConicalGradientSsboFill Pipeline SC=[2] drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip, format B10G10R10A10XR -> B8G8R8A8UNormInt (4 draws) ConicalGradientSsboFill Pipeline SC=[3] drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip, format B10G10R10A10XR -> B8G8R8A8UNormInt (41 draws) FastGradient Pipeline drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt, depth_write off -> on (8 draws) GlyphAtlas Pipeline SC=[1] drawn as: depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (690 draws) LinearGradientSsboFill Pipeline drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip, format B10G10R10A10XR -> B8G8R8A8UNormInt (86 draws) RadialGradientSsboFill Pipeline drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip, format B10G10R10A10XR -> B8G8R8A8UNormInt (96 draws) ShadowVertices Pipeline drawn as: depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (660 draws) SolidFill Pipeline drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip, format B10G10R10A10XR -> B8G8R8A8UNormInt (2,400 draws) SweepGradientSsboFill Pipeline drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip, format B10G10R10A10XR -> B8G8R8A8UNormInt (36 draws) TextureFill Pipeline drawn as: depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (16 draws) TextureFillStrictSrc Pipeline drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip, format B10G10R10A10XR -> B8G8R8A8UNormInt (60 draws) TiledTextureFill Pipeline SC=[1] drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip, format B10G10R10A10XR -> B8G8R8A8UNormInt (418 draws) UberSdf Pipeline drawn as: depth Always -> GreaterEqual, prim Triangle -> TriangleStrip (2 draws) VerticesUber1 Pipeline SC=[1] drawn as: depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (8 draws) VerticesUber2 Pipeline SC=[1] never drawn with any options msaa=4x blend=SrcOver depth=Always stencil=Ignore prim=TriangleStrip format=B8G8R8A8UNormInt +depth_stencil AdvancedBlend Pipeline SC=[0,1] drawn as: msaa 4x -> 1x, blend SrcOver -> Src, depth Always -> GreaterEqual, depth_stencil on -> off (2 draws) AdvancedBlend Pipeline SC=[1,1] drawn as: msaa 4x -> 1x, blend SrcOver -> Src, depth Always -> GreaterEqual, depth_stencil on -> off (2 draws) AdvancedBlend Pipeline SC=[2,1] drawn as: msaa 4x -> 1x, blend SrcOver -> Src, depth Always -> GreaterEqual, depth_stencil on -> off (2 draws) AdvancedBlend Pipeline SC=[3,1] drawn as: msaa 4x -> 1x, blend SrcOver -> Src, depth Always -> GreaterEqual, depth_stencil on -> off (2 draws) AdvancedBlend Pipeline SC=[4,1] drawn as: msaa 4x -> 1x, blend SrcOver -> Src, depth Always -> GreaterEqual, depth_stencil on -> off (2 draws) AdvancedBlend Pipeline SC=[5,1] drawn as: msaa 4x -> 1x, blend SrcOver -> Src, depth Always -> GreaterEqual, depth_stencil on -> off (2 draws) AdvancedBlend Pipeline SC=[6,1] drawn as: msaa 4x -> 1x, blend SrcOver -> Src, depth Always -> GreaterEqual, depth_stencil on -> off (2 draws) AdvancedBlend Pipeline SC=[7,1] drawn as: msaa 4x -> 1x, blend SrcOver -> Src, depth Always -> GreaterEqual, depth_stencil on -> off (2 draws) AdvancedBlend Pipeline SC=[8,1] drawn as: msaa 4x -> 1x, blend SrcOver -> Src, depth Always -> GreaterEqual, depth_stencil on -> off (2 draws) AdvancedBlend Pipeline SC=[9,1] drawn as: msaa 4x -> 1x, blend SrcOver -> Src, depth Always -> GreaterEqual, depth_stencil on -> off (2 draws) AdvancedBlend Pipeline SC=[10,1] drawn as: depth Always -> GreaterEqual (30 draws) AdvancedBlend Pipeline SC=[11,1] drawn as: msaa 4x -> 1x, blend SrcOver -> Src, depth Always -> GreaterEqual, depth_stencil on -> off (2 draws) AdvancedBlend Pipeline SC=[12,1] drawn as: msaa 4x -> 1x, blend SrcOver -> Src, depth Always -> GreaterEqual, depth_stencil on -> off (2 draws) AdvancedBlend Pipeline SC=[13,1] drawn as: msaa 4x -> 1x, blend SrcOver -> Src, depth Always -> GreaterEqual, depth_stencil on -> off (2 draws) AdvancedBlend Pipeline SC=[14,1] drawn as: msaa 4x -> 1x, blend SrcOver -> Src, depth Always -> GreaterEqual, depth_stencil on -> off (2 draws) BorderMaskBlur Pipeline never drawn with any options ColorMatrixColorFilter Pipeline drawn as: depth Always -> GreaterEqual (68 draws) FramebufferBlend Pipeline SC=[0,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual (52 draws) FramebufferBlend Pipeline SC=[1,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual (44 draws) FramebufferBlend Pipeline SC=[2,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual (44 draws) FramebufferBlend Pipeline SC=[3,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual (52 draws) FramebufferBlend Pipeline SC=[4,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual (52 draws) FramebufferBlend Pipeline SC=[5,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual (44 draws) FramebufferBlend Pipeline SC=[6,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual (44 draws) FramebufferBlend Pipeline SC=[7,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual (44 draws) FramebufferBlend Pipeline SC=[8,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual (56 draws) FramebufferBlend Pipeline SC=[9,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual (76 draws) FramebufferBlend Pipeline SC=[10,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual (56 draws) FramebufferBlend Pipeline SC=[11,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual (44 draws) FramebufferBlend Pipeline SC=[12,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual (48 draws) FramebufferBlend Pipeline SC=[13,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual (44 draws) FramebufferBlend Pipeline SC=[14,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual (44 draws) LinearToSrgbFilter Pipeline drawn as: depth Always -> GreaterEqual (8 draws) MorphologyFilter Pipeline SC=[1] drawn as: msaa 4x -> 1x, blend SrcOver -> Src, depth Always -> GreaterEqual, depth_stencil on -> off (48 draws) PorterDuffBlend Pipeline SC=[1,0,0,0,0,0] never drawn with any options PorterDuffBlend Pipeline SC=[1,0,0,0,0,1] drawn as: depth Always -> GreaterEqual (4 draws) PorterDuffBlend Pipeline SC=[1,0,0,0,1,0] never drawn with any options PorterDuffBlend Pipeline SC=[1,0,0,1,-1,0] never drawn with any options PorterDuffBlend Pipeline SC=[1,0,0,1,0,-1] never drawn with any options PorterDuffBlend Pipeline SC=[1,0,0,1,0,0] drawn as: depth Always -> GreaterEqual (20 draws) PorterDuffBlend Pipeline SC=[1,0,1,0,0,0] drawn as: depth Always -> GreaterEqual, prim TriangleStrip -> Triangle (86 draws) PorterDuffBlend Pipeline SC=[1,0,1,1,-1,0] never drawn with any options PorterDuffBlend Pipeline SC=[1,1,-1,0,0,0] never drawn with any options PorterDuffBlend Pipeline SC=[1,1,-1,0,1,0] drawn as: depth Always -> GreaterEqual, prim TriangleStrip -> Triangle (4 draws) PorterDuffBlend Pipeline SC=[1,1,-1,1,-1,0] never drawn with any options PorterDuffBlend Pipeline SC=[1,1,-1,1,0,0] drawn as: depth Always -> GreaterEqual (8 draws) PorterDuffBlend Pipeline SC=[1,1,0,0,0,0] drawn as: depth Always -> GreaterEqual (8 draws) PorterDuffBlend Pipeline SC=[1,1,0,1,-1,0] drawn as: depth Always -> GreaterEqual (6 draws) PorterDuffBlend Pipeline SC=[1,1,0,1,0,0] drawn as: depth Always -> GreaterEqual, format B8G8R8A8UNormInt -> B10G10R10A10XR (4 draws) RrectBlur Pipeline drawn as: depth Always -> GreaterEqual (454 draws) RsuperellipseBlur Pipeline never drawn with any options SrgbToLinearFilter Pipeline never drawn with any options YuvToRgbFilter Pipeline never drawn with any options msaa=4x blend=SrcOver depth=Always stencil=Ignore prim=TriangleStrip format=B10G10R10A10XR +depth_stencil BorderMaskBlur Pipeline never drawn with any options ColorMatrixColorFilter Pipeline drawn as: depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (68 draws) FramebufferBlend Pipeline SC=[0,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (52 draws) FramebufferBlend Pipeline SC=[1,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (44 draws) FramebufferBlend Pipeline SC=[2,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (44 draws) FramebufferBlend Pipeline SC=[3,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (52 draws) FramebufferBlend Pipeline SC=[4,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (52 draws) FramebufferBlend Pipeline SC=[5,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (44 draws) FramebufferBlend Pipeline SC=[6,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (44 draws) FramebufferBlend Pipeline SC=[7,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (44 draws) FramebufferBlend Pipeline SC=[8,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (56 draws) FramebufferBlend Pipeline SC=[9,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (76 draws) FramebufferBlend Pipeline SC=[10,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (56 draws) FramebufferBlend Pipeline SC=[11,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (44 draws) FramebufferBlend Pipeline SC=[12,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (48 draws) FramebufferBlend Pipeline SC=[13,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (44 draws) FramebufferBlend Pipeline SC=[14,1] drawn as: blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (44 draws) LinearToSrgbFilter Pipeline drawn as: depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (8 draws) MorphologyFilter Pipeline SC=[1] drawn as: msaa 4x -> 1x, blend SrcOver -> Src, depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt, depth_stencil on -> off (48 draws) PorterDuffBlend Pipeline SC=[1,0,0,0,0,0] never drawn with any options PorterDuffBlend Pipeline SC=[1,0,0,0,0,1] drawn as: depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (4 draws) PorterDuffBlend Pipeline SC=[1,0,0,0,1,0] never drawn with any options PorterDuffBlend Pipeline SC=[1,0,0,1,-1,0] never drawn with any options PorterDuffBlend Pipeline SC=[1,0,0,1,0,-1] never drawn with any options PorterDuffBlend Pipeline SC=[1,0,0,1,0,0] drawn as: depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (20 draws) PorterDuffBlend Pipeline SC=[1,0,1,0,0,0] drawn as: depth Always -> GreaterEqual, prim TriangleStrip -> Triangle, format B10G10R10A10XR -> B8G8R8A8UNormInt (86 draws) PorterDuffBlend Pipeline SC=[1,0,1,1,-1,0] never drawn with any options PorterDuffBlend Pipeline SC=[1,1,-1,0,0,0] never drawn with any options PorterDuffBlend Pipeline SC=[1,1,-1,0,1,0] drawn as: depth Always -> GreaterEqual, prim TriangleStrip -> Triangle, format B10G10R10A10XR -> B8G8R8A8UNormInt (4 draws) PorterDuffBlend Pipeline SC=[1,1,-1,1,-1,0] never drawn with any options PorterDuffBlend Pipeline SC=[1,1,-1,1,0,0] drawn as: depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (8 draws) PorterDuffBlend Pipeline SC=[1,1,0,0,0,0] drawn as: depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (8 draws) PorterDuffBlend Pipeline SC=[1,1,0,1,-1,0] drawn as: depth Always -> GreaterEqual, format B10G10R10A10XR -> B8G8R8A8UNormInt (6 draws) PorterDuffBlend Pipeline SC=[1,1,0,1,0,0] drawn as: depth Always -> GreaterEqual (4 draws) RrectBlur Pipeline drawn as: depth Always -> GreaterEqual (4 draws) RsuperellipseBlur Pipeline never drawn with any options SrgbToLinearFilter Pipeline never drawn with any options YuvToRgbFilter Pipeline never drawn with any options ``` Example output for --fail-on-unused-shaders: ``` ================================================================================ Unused Impeller shaders ================================================================================ 13 shaders were created by a ContentContext but never drawn with, with any options, on any backend: BorderMaskBlur Pipeline [Metal] ConicalGradientSsboFill Pipeline spec=[0] [Metal] PorterDuffBlend Pipeline spec=[1,0,0,0,0,0] [Metal] PorterDuffBlend Pipeline spec=[1,0,0,0,1,0] [Metal] PorterDuffBlend Pipeline spec=[1,0,0,1,-1,0] [Metal] PorterDuffBlend Pipeline spec=[1,0,0,1,0,-1] [Metal] PorterDuffBlend Pipeline spec=[1,0,1,1,-1,0] [Metal] PorterDuffBlend Pipeline spec=[1,1,-1,0,0,0] [Metal] PorterDuffBlend Pipeline spec=[1,1,-1,1,-1,0] [Metal] RsuperellipseBlur Pipeline [Metal] SrgbToLinearFilter Pipeline [Metal] VerticesUber2 Pipeline spec=[1] [Metal] YuvToRgbFilter Pipeline [Metal] Add a golden test that draws with each of them, or stop creating them. ``` ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant in-code documentation (doc comments with `///`). - [x] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord].
…ter#194055) Add golden tests for previously untested shaders. Follow on from flutter#193319. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant in-code documentation (doc comments with `///`). - [x] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
…er#194597) flutter#193319 revealed that in our golden test suite, 0% of draw calls were handled by a prewarmed pipeline variant. This causes a first-frame shader cache miss 100% of the time - causing in the worst case a full re-compilation + link. This change changes our defaults to better match what we actually request at draw time. Running impeller_golden_tests with --shader-report before this change: ``` Draws covered by warmed variants: 0 of 620,533 (0.0%) ``` Running impeller_golden_tests with --shader-report after this change: ``` Draws covered by warmed variants: 610,441 of 620,533 (98.4%) ``` Without compiling additional variants, we can't get full coverage in our golden suite, but this change is directionally correct toward the goal of eliminating first-frame shader cache misses. Fixes flutter#194595 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant in-code documentation (doc comments with `///`). - [x] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
Fixes #193318
Adds a --shader-report option to impeller_golden_tests. When running with this option, the test suite will spit out a report on which shaders were prewarmed, but never used.
Adds a --fail-on-unused-shaders option to impeller_golden_tests. When running with this option, the goldens will fail if there are any shaders that are completely unused in the golden tests.
Everything is only run in debug builds inside of impeller_golden_tests, so no production impact. --fail-on-unused-shaders is not hooked up to CI yet.
Example output for --shader-report:
Example output for --fail-on-unused-shaders:
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on [Discord].