Skip to content

[windows]: adjusts uniform buffers to hit hlsl optimization#188538

Merged
auto-submit[bot] merged 8 commits into
flutter:masterfrom
gaaclarke:hlsl-structured-uniforms
Jun 30, 2026
Merged

[windows]: adjusts uniform buffers to hit hlsl optimization#188538
auto-submit[bot] merged 8 commits into
flutter:masterfrom
gaaclarke:hlsl-structured-uniforms

Conversation

@gaaclarke

@gaaclarke gaaclarke commented Jun 24, 2026

Copy link
Copy Markdown
Member

issue #188348

This removes the following class of HLSL warnings:

WARN: ProgramD3D.cpp:711 (rx::ProgramD3D::linkJobImpl): Uniform block 'FragInfo' will be slow to compile. See UniformBlockToStructuredBufferTranslation.md (https://shorturl.at/drFY7) for details.

By putting large uniform arrays into their own uniform buffer the HLSL compiler in ANGLE is able to optimize the compilation using a StructuredBuffer. This removes the warning about long compilation time.

testing: refactor, no logical change

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 24, 2026
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Jun 24, 2026
@gaaclarke

Copy link
Copy Markdown
Member Author

This looks good, we need to do this for KernelSamples too.

@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 25, 2026
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 25, 2026
@gaaclarke
gaaclarke marked this pull request as ready for review June 25, 2026 16:44

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors several shaders and their corresponding host-side rendering code to move large arrays (such as colors, stop pairs, and kernel samples) into dedicated uniform blocks, preventing size and alignment issues on certain graphics platforms. Feedback recommends passing the temporary returned by GenerateBlurInfo directly to LerpHackKernelSamples to enable copy elision and avoid copying a large struct.

@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 25, 2026
@gaaclarke gaaclarke added the CICD Run CI/CD label Jun 25, 2026
@gaaclarke
gaaclarke requested review from b-luk and walley892 June 25, 2026 17:18
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 25, 2026
@gaaclarke gaaclarke added the CICD Run CI/CD label Jun 25, 2026
walley892
walley892 previously approved these changes Jun 29, 2026

@walley892 walley892 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LG as long as the goldens don't change

b-luk
b-luk previously approved these changes Jun 29, 2026

@b-luk b-luk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Just a couple of nits, which I'll leave up to you to decide if you think it's anything worth changing.

float coefficient;
};

/// A larger mirror of GaussianBlurPipeline::FragmentShader::KernelSamples.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is no longer true. GaussianBlurPipeline::FragmentShader::KernelSamples no longer contains sample_count, so this struct is no longer a mirror of it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think the comment is still helpful despite that technicality since it convey's the relationship between them. I think it's better to keep it as-is.

KernelSample samples[kMaxKernelSize];
};

struct LerpHackResult {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is badly named, and it makes the code a bit harder to follow. I don't know the best way to improve it, but I'd be in favor of even just removing it entirely and using a pair<int32_t, GaussianBlurPipeline::FragmentShader::KernelSamples>.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The name of the function that generates this is LerpHackKernelSamples. I wouldn't want to switch to unstructured data since we'd be losing named fields. It's common to have a struct declared for returning multiple values. We could name it LerpHackKernelSamplesResult to be more clear if you like. Dropping some of the name didn't seem to affect the readability I my eyes, let me know.

@b-luk b-luk Jun 29, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe it's not exactly a naming issue. I think what makes it harder to follow is that we no longer have a single struct that directly represents the shader input. The behavior used to be:

  1. GenerateBlurInfo() generates KernalSamples, which is an expanded version of the FragmentShader::KernelSamples shader input.
  2. LerpHackKernelSamples() converts the expanded KernalSamples into the input FragmentShader::KernelSamples, which is bound to the shader.

So there's a single KernalSamples struct which directly maps to a single shader input.

Now it's:

  1. GenerateBlurInfo() generates KernalSamples, which is an expanded version of (FragmentShader::FragInfo::sample_count + FragmentShader::KernelSamples).
  2. LerpHackKernelSamples() converts KernalSamples into LerpHackResult, which is the non-expanded version of (FragmentShader::FragInfo::sample_count + FragmentShader::KernelSamples).
  3. The two parts of LerpHackResult get split up to be bound to two different inputs in the shader.

We end up with two intermediate KernalSamples and LerpHackResult structs, and neither of them map directly to a shader input field.

I don't know a good way to clean this up, so I'm not blocking submission. The new version isn't super complex. Once you look at it enough you can see what's going on. But I think it does force the reader to juggle a bunch more types/fields/subfields in their head to understand the flow of data compared to the old version. And for many of the new fields it's not immediately clear/intuitive what they represent within the data flow.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yea, it's less clear, our hand was forced based on hlsl's requirements. It looks like c++26 will have std::inplace_vector which may clean this up a bit. We won't need the struct anymore after that.

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 29, 2026
@auto-submit

auto-submit Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/188538, because - The status or check suite Linux linux_unopt has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 29, 2026
@gaaclarke
gaaclarke dismissed stale reviews from b-luk and walley892 via 87c4efc June 29, 2026 18:42
@gaaclarke
gaaclarke requested a review from b-luk June 29, 2026 18:43
KernelSample samples[kMaxKernelSize];
};

struct LerpHackResult {

@b-luk b-luk Jun 29, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe it's not exactly a naming issue. I think what makes it harder to follow is that we no longer have a single struct that directly represents the shader input. The behavior used to be:

  1. GenerateBlurInfo() generates KernalSamples, which is an expanded version of the FragmentShader::KernelSamples shader input.
  2. LerpHackKernelSamples() converts the expanded KernalSamples into the input FragmentShader::KernelSamples, which is bound to the shader.

So there's a single KernalSamples struct which directly maps to a single shader input.

Now it's:

  1. GenerateBlurInfo() generates KernalSamples, which is an expanded version of (FragmentShader::FragInfo::sample_count + FragmentShader::KernelSamples).
  2. LerpHackKernelSamples() converts KernalSamples into LerpHackResult, which is the non-expanded version of (FragmentShader::FragInfo::sample_count + FragmentShader::KernelSamples).
  3. The two parts of LerpHackResult get split up to be bound to two different inputs in the shader.

We end up with two intermediate KernalSamples and LerpHackResult structs, and neither of them map directly to a shader input field.

I don't know a good way to clean this up, so I'm not blocking submission. The new version isn't super complex. Once you look at it enough you can see what's going on. But I think it does force the reader to juggle a bunch more types/fields/subfields in their head to understand the flow of data compared to the old version. And for many of the new fields it's not immediately clear/intuitive what they represent within the data flow.

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 29, 2026
@flutter-dashboard

Copy link
Copy Markdown

CI had a failure that stopped further tests from running. We need to investigate to determine the root cause.

SHA at time of execution: 87c4efc.

Possible causes:

  • Configuration Changes: The .ci.yaml file might have been modified between the creation of this pull request and the start of this test run. This can lead to ci yaml validation errors.
  • Infrastructure Issues: Problems with the CI environment itself (e.g., quota) could have caused the failure.

A blank commit, or merging to head, will be required to resume running CI for this PR.

Error Details:

FormatException: ERROR: Linux test_ownership is a new builder added. it needs to be marked bringup: true
If ci.yaml wasn't changed, try `git fetch upstream && git merge upstream/master`

Stack trace:

#0      CiYaml._validate (package:cocoon_service/src/model/ci_yaml/ci_yaml.dart:395:7)
#1      new CiYaml (package:cocoon_service/src/model/ci_yaml/ci_yaml.dart:128:7)
#2      new CiYamlSet (package:cocoon_service/src/model/ci_yaml/ci_yaml.dart:48:23)
#3      CiYamlFetcher._getCiYaml (package:cocoon_service/src/service/scheduler/ci_yaml_fetcher.dart:124:12)
<asynchronous suspension>
#4      Scheduler.getPresubmitTargets (package:cocoon_service/src/service/scheduler.dart:1084:20)
<asynchronous suspension>
#5      Scheduler._getTestsForStage (package:cocoon_service/src/service/scheduler.dart:1368:14)
<asynchronous suspension>
#6      Scheduler._runCiTestingStage (package:cocoon_service/src/service/scheduler.dart:1408:30)
<asynchronous suspension>
#7      Scheduler.proceedToCiTestingStage (package:cocoon_service/src/service/scheduler.dart:1516:7)
<asynchronous suspension>
#8      Scheduler._closeSuccessfulEngineBuildStage (package:cocoon_service/src/service/scheduler.dart:1341:5)
<asynchronous suspension>
#9      Scheduler.processCheckRunCompleted (package:cocoon_service/src/service/scheduler.dart:1273:11)
<asynchronous suspension>
#10     PresubmitLuciSubscription.post (package:cocoon_service/src/request_handlers/presubmit_luci_subscription.dart:176:9)
<asynchronous suspension>
#11     RequestHandler.service (package:cocoon_service/src/request_handling/request_handler.dart:42:20)
<asynchronous suspension>
#12     SubscriptionHandler.service (package:cocoon_service/src/request_handling/subscription_handler.dart:134:5)
<asynchronous suspension>
#13     createServer.<anonymous closure> (package:cocoon_service/server.dart:448:7)
<asynchronous suspension>
#14     main.<anonymous closure>.<anonymous closure> (file:///app/app_dart/bin/gae_server.dart:187:9)
<asynchronous suspension>

@auto-submit

auto-submit Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/188538, because - The status or check suite Linux linux_fuchsia_tests has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 29, 2026
@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 29, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Jun 29, 2026
@gaaclarke

Copy link
Copy Markdown
Member Author

this may benefit #188338

Merged via the queue into flutter:master with commit 5b26d9a Jun 30, 2026
203 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 30, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Jul 7, 2026
…#12081)

Manual roll Flutter from 0c80830e465b to ca9f874f5284 (119 revisions)

Manual roll requested by [email protected]

flutter/flutter@0c80830...ca9f874

2026-06-30 [email protected] [tool] Don't require a Flutter compile task when staging jniLibs (flutter/flutter#188805)
2026-06-30 [email protected] [Impeller] Fix potential overflow when allocating buffers at the next power of two size (flutter/flutter#188742)
2026-06-30 [email protected] [Framework/Tool] Decouple preview theme imports (flutter/flutter#188176)
2026-06-30 [email protected] Add import of `dart:_js_interop_wasm` in sdk rewriter tool (flutter/flutter#188620)
2026-06-30 [email protected] Detach LLDB and print stack trace on process stop (flutter/flutter#188576)
2026-06-30 [email protected] [Linux] Fix FlCompositorOpenGL.pixels comment (flutter/flutter#188754)
2026-06-30 [email protected] [flutter_tools] Fix crash in flutter create when pubspec.yaml is empty (flutter/flutter#188385)
2026-06-30 [email protected] Roll Packages from 656ccaa to 274ed3e (23 revisions) (flutter/flutter#188792)
2026-06-30 [email protected] In AndroidImageGenerator, check that the destination pixel buffer has sufficient capacity for the decoded data (flutter/flutter#188752)
2026-06-30 [email protected] Roll pub packages (flutter/flutter#188773)
2026-06-30 [email protected] [Impeller] Add a flat VertexAttributeFormat for vertex inputs (flutter/flutter#188684)
2026-06-30 [email protected] Roll pub packages (flutter/flutter#188764)
2026-06-30 [email protected] Roll Dart SDK from 0cb483880b6b to e1bdb9ce3327 (2 revisions) (flutter/flutter#188763)
2026-06-29 [email protected] Handle 'no permissions' adb device state (flutter/flutter#187248)
2026-06-29 [email protected] [windows]: adjusts uniform buffers to hit hlsl optimization (flutter/flutter#188538)
2026-06-29 [email protected] Roll Skia from bfb7860cb9c7 to 71947c4110b0 (9 revisions) (flutter/flutter#188747)
2026-06-29 [email protected] ci: extract wait-for-engine-build logic into a reusable composite action (flutter/flutter#188748)
2026-06-29 [email protected] Provide guided migration logs when iOS app crashes on simulator (flutter/flutter#188736)
2026-06-29 [email protected] Revert "[flutter_tools] Track asset transformer dependencies for hot reload" (flutter/flutter#188751)
2026-06-29 [email protected] Migrate ABI splits to new AGP dsl (flutter/flutter#188369)
2026-06-29 [email protected] Add Impeller+OpenGLES startup benchmark for mokey (flutter/flutter#188495)
2026-06-29 [email protected] Increase macOS minimum supported version from 10.15 to 12 to support Xcode 27  (flutter/flutter#188520)
2026-06-29 [email protected] Moves test ownership validation to flutter/flutter (flutter/flutter#188655)
2026-06-29 [email protected] Add --flavor support for Windows desktop builds (flutter/flutter#187034)
2026-06-29 [email protected] Android_hardware_smoke_test: Enable pixel exact local file comparator to read goldens from flutter asset URI (flutter/flutter#188587)
2026-06-29 [email protected] [flutter_tools] Use DeviceHub.app for iOS simulator path on Xcode 27+ (flutter/flutter#187910)
2026-06-29 [email protected] Roll Skia from 111e7582d081 to bfb7860cb9c7 (2 revisions) (flutter/flutter#188731)
2026-06-29 [email protected] Use `revert` label instead of `revert_wf` (flutter/flutter#188639)
2026-06-29 [email protected] Properly await Dart Development Service shutdown with timeout (flutter/flutter#188387)
2026-06-29 [email protected] [flutter_tools] Track asset transformer dependencies for hot reload (flutter/flutter#187947)
2026-06-29 [email protected] [Tool] Tolerate malformed UTF-8 in process streaming decoders (flutter/flutter#188453)
2026-06-29 [email protected] [flutter_tools] Use new ddc modules in test (flutter/flutter#188240)
2026-06-29 [email protected] Roll Packages from c1f7d92 to 656ccaa (12 revisions) (flutter/flutter#188728)
2026-06-29 [email protected] Remove unused fields (flutter/flutter#188705)
2026-06-29 [email protected] Clear text input handler widget on view dispose (flutter/flutter#188701)
2026-06-29 [email protected] Free compositor in view renderer finalize to avoid use-after-free (flutter/flutter#188702)
2026-06-29 [email protected] [linux] Use GWeakRef in mock signal handler test helper (flutter/flutter#188700)
2026-06-29 [email protected] Fixing few related editing issues with LTR/RTL text (flutter/flutter#188503)
2026-06-29 [email protected] [Flutter GPU] Add Texture.fromImage to wrap a ui.Image texture (flutter/flutter#188605)
2026-06-29 [email protected] [Flutter GPU] Honor the enable argument in RenderPass.setDepthWriteEnable (flutter/flutter#188715)
2026-06-29 [email protected] Roll Skia from ba1942d8c3e1 to 111e7582d081 (1 revision) (flutter/flutter#188721)
2026-06-29 [email protected] Roll Skia from 587d8befe1ee to ba1942d8c3e1 (6 revisions) (flutter/flutter#188717)
2026-06-29 [email protected] Remove some refs to package:intl (flutter/flutter#188504)
2026-06-29 [email protected] [VPAT] Update a11y assessment app FAB example to announce value change when it's updated. (flutter/flutter#188466)
...
kalyujniy pushed a commit to brickit-app/camera that referenced this pull request Jul 8, 2026
…flutter#12081)

Manual roll Flutter from 0c80830e465b to ca9f874f5284 (119 revisions)

Manual roll requested by [email protected]

flutter/flutter@0c80830...ca9f874

2026-06-30 [email protected] [tool] Don't require a Flutter compile task when staging jniLibs (flutter/flutter#188805)
2026-06-30 [email protected] [Impeller] Fix potential overflow when allocating buffers at the next power of two size (flutter/flutter#188742)
2026-06-30 [email protected] [Framework/Tool] Decouple preview theme imports (flutter/flutter#188176)
2026-06-30 [email protected] Add import of `dart:_js_interop_wasm` in sdk rewriter tool (flutter/flutter#188620)
2026-06-30 [email protected] Detach LLDB and print stack trace on process stop (flutter/flutter#188576)
2026-06-30 [email protected] [Linux] Fix FlCompositorOpenGL.pixels comment (flutter/flutter#188754)
2026-06-30 [email protected] [flutter_tools] Fix crash in flutter create when pubspec.yaml is empty (flutter/flutter#188385)
2026-06-30 [email protected] Roll Packages from 656ccaa to 274ed3e (23 revisions) (flutter/flutter#188792)
2026-06-30 [email protected] In AndroidImageGenerator, check that the destination pixel buffer has sufficient capacity for the decoded data (flutter/flutter#188752)
2026-06-30 [email protected] Roll pub packages (flutter/flutter#188773)
2026-06-30 [email protected] [Impeller] Add a flat VertexAttributeFormat for vertex inputs (flutter/flutter#188684)
2026-06-30 [email protected] Roll pub packages (flutter/flutter#188764)
2026-06-30 [email protected] Roll Dart SDK from 0cb483880b6b to e1bdb9ce3327 (2 revisions) (flutter/flutter#188763)
2026-06-29 [email protected] Handle 'no permissions' adb device state (flutter/flutter#187248)
2026-06-29 [email protected] [windows]: adjusts uniform buffers to hit hlsl optimization (flutter/flutter#188538)
2026-06-29 [email protected] Roll Skia from bfb7860cb9c7 to 71947c4110b0 (9 revisions) (flutter/flutter#188747)
2026-06-29 [email protected] ci: extract wait-for-engine-build logic into a reusable composite action (flutter/flutter#188748)
2026-06-29 [email protected] Provide guided migration logs when iOS app crashes on simulator (flutter/flutter#188736)
2026-06-29 [email protected] Revert "[flutter_tools] Track asset transformer dependencies for hot reload" (flutter/flutter#188751)
2026-06-29 [email protected] Migrate ABI splits to new AGP dsl (flutter/flutter#188369)
2026-06-29 [email protected] Add Impeller+OpenGLES startup benchmark for mokey (flutter/flutter#188495)
2026-06-29 [email protected] Increase macOS minimum supported version from 10.15 to 12 to support Xcode 27  (flutter/flutter#188520)
2026-06-29 [email protected] Moves test ownership validation to flutter/flutter (flutter/flutter#188655)
2026-06-29 [email protected] Add --flavor support for Windows desktop builds (flutter/flutter#187034)
2026-06-29 [email protected] Android_hardware_smoke_test: Enable pixel exact local file comparator to read goldens from flutter asset URI (flutter/flutter#188587)
2026-06-29 [email protected] [flutter_tools] Use DeviceHub.app for iOS simulator path on Xcode 27+ (flutter/flutter#187910)
2026-06-29 [email protected] Roll Skia from 111e7582d081 to bfb7860cb9c7 (2 revisions) (flutter/flutter#188731)
2026-06-29 [email protected] Use `revert` label instead of `revert_wf` (flutter/flutter#188639)
2026-06-29 [email protected] Properly await Dart Development Service shutdown with timeout (flutter/flutter#188387)
2026-06-29 [email protected] [flutter_tools] Track asset transformer dependencies for hot reload (flutter/flutter#187947)
2026-06-29 [email protected] [Tool] Tolerate malformed UTF-8 in process streaming decoders (flutter/flutter#188453)
2026-06-29 [email protected] [flutter_tools] Use new ddc modules in test (flutter/flutter#188240)
2026-06-29 [email protected] Roll Packages from c1f7d92 to 656ccaa (12 revisions) (flutter/flutter#188728)
2026-06-29 [email protected] Remove unused fields (flutter/flutter#188705)
2026-06-29 [email protected] Clear text input handler widget on view dispose (flutter/flutter#188701)
2026-06-29 [email protected] Free compositor in view renderer finalize to avoid use-after-free (flutter/flutter#188702)
2026-06-29 [email protected] [linux] Use GWeakRef in mock signal handler test helper (flutter/flutter#188700)
2026-06-29 [email protected] Fixing few related editing issues with LTR/RTL text (flutter/flutter#188503)
2026-06-29 [email protected] [Flutter GPU] Add Texture.fromImage to wrap a ui.Image texture (flutter/flutter#188605)
2026-06-29 [email protected] [Flutter GPU] Honor the enable argument in RenderPass.setDepthWriteEnable (flutter/flutter#188715)
2026-06-29 [email protected] Roll Skia from ba1942d8c3e1 to 111e7582d081 (1 revision) (flutter/flutter#188721)
2026-06-29 [email protected] Roll Skia from 587d8befe1ee to ba1942d8c3e1 (6 revisions) (flutter/flutter#188717)
2026-06-29 [email protected] Remove some refs to package:intl (flutter/flutter#188504)
2026-06-29 [email protected] [VPAT] Update a11y assessment app FAB example to announce value change when it's updated. (flutter/flutter#188466)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD e: impeller Impeller rendering backend issues and features requests engine flutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants