Skip to content

[Impeller] Add a flat VertexAttributeFormat for vertex inputs - #188684

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
bdero:bdero/impeller-vertex-attribute-format
Jun 30, 2026
Merged

[Impeller] Add a flat VertexAttributeFormat for vertex inputs#188684
auto-submit[bot] merged 3 commits into
flutter:masterfrom
bdero:bdero/impeller-vertex-attribute-format

Conversation

@bdero

@bdero bdero commented Jun 27, 2026

Copy link
Copy Markdown
Member

Related to #186309.

Adds a VertexAttributeFormat enum and derives it from a reflected ShaderStageIOSlot, then routes the Metal, Vulkan, and GLES backends through it when building their native vertex input format. This replaces three independent switches over the slot's scalar type, bit width, and component count with one shared vocabulary, which is the foundation for the vertex format expansion tracked in the issue.

This is a behavior preserving refactor. Only the formats reflection produces today are reachable, and each backend keeps its existing support set, so GLES still rejects half-float and 32-bit integer attributes while Metal and Vulkan accept them. The one intentional cleanup is that boolean vertex inputs, which are not expressible in a vertex stage, now map to invalid on every backend instead of the previous inconsistent mappings.

New tests cover the format derivation across scalar kinds, component counts, bit widths, and matrix inputs, plus the GLES mapping including the half-float and 32-bit integer formats it rejects.

Pre-launch Checklist

@bdero bdero added the e: impeller Impeller rendering backend issues and features requests label Jun 27, 2026
@github-actions github-actions Bot added the engine flutter/engine related. See also e: labels. label Jun 27, 2026
Introduce a VertexAttributeFormat enum derived from a reflected ShaderStageIOSlot, and route the Metal, Vulkan, and GLES backends through it instead of three independent switches over the slot's scalar type, bit width, and component count.

This is behavior preserving. Only the formats reflection produces today are reachable, and each backend keeps its current support set, so GLES still rejects half-float and 32-bit integer attributes. Boolean vertex inputs, which are not expressible in a vertex stage, now map to invalid on every backend.

Related to flutter#186309.
@bdero
bdero force-pushed the bdero/impeller-vertex-attribute-format branch from 92f6155 to ef4c1b4 Compare June 27, 2026 20:37
@bdero bdero added the CICD Run CI/CD label Jun 27, 2026
@bdero
bdero marked this pull request as ready for review June 27, 2026 21:08

@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 introduces a unified VertexAttributeFormat enum and a GetVertexAttributeFormat helper on ShaderStageIOSlot to centralize vertex attribute format derivation. The GLES, Metal, and Vulkan backends are updated to use this new format, simplifying their vertex format mapping logic, and corresponding unit tests are added. Feedback suggests capturing vec_size by value instead of capturing this in the lambda within GetVertexAttributeFormat to avoid potential compilation issues on older compilers in a constexpr context.

Comment thread engine/src/flutter/impeller/core/shader_types.h Outdated
Avoids capturing this in the constexpr lambda, which can fail
compile-time evaluation on some compilers.
@bdero bdero added CICD Run CI/CD and removed CICD Run CI/CD labels Jun 27, 2026
@bdero
bdero requested a review from gaaclarke June 29, 2026 07:38

@gaaclarke gaaclarke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks!

@gaaclarke
gaaclarke requested a review from walley892 June 29, 2026 23:24
@gaaclarke

Copy link
Copy Markdown
Member

@walley892 I'm confused, I can't remember if bdero needs 2 reviews or not. If so can you please provide a second review. LGTM.

@bdero

bdero commented Jun 30, 2026

Copy link
Copy Markdown
Member Author

I'm confused, I can't remember if bdero needs 2 reviews or not. If so can you please provide a second review. LGTM.

I only need one. :)

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 stuartmorgan@google.com

flutter/flutter@0c80830...ca9f874

2026-06-30 34871572+gmackall@users.noreply.github.com [tool] Don't require a Flutter compile task when staging jniLibs (flutter/flutter#188805)
2026-06-30 jason-simmons@users.noreply.github.com [Impeller] Fix potential overflow when allocating buffers at the next power of two size (flutter/flutter#188742)
2026-06-30 bkonyi@google.com [Framework/Tool] Decouple preview theme imports (flutter/flutter#188176)
2026-06-30 kustermann@google.com Add import of `dart:_js_interop_wasm` in sdk rewriter tool (flutter/flutter#188620)
2026-06-30 15619084+vashworth@users.noreply.github.com Detach LLDB and print stack trace on process stop (flutter/flutter#188576)
2026-06-30 robert.ancell@canonical.com [Linux] Fix FlCompositorOpenGL.pixels comment (flutter/flutter#188754)
2026-06-30 bkonyi@google.com [flutter_tools] Fix crash in flutter create when pubspec.yaml is empty (flutter/flutter#188385)
2026-06-30 engine-flutter-autoroll@skia.org Roll Packages from 656ccaa to 274ed3e (23 revisions) (flutter/flutter#188792)
2026-06-30 jason-simmons@users.noreply.github.com In AndroidImageGenerator, check that the destination pixel buffer has sufficient capacity for the decoded data (flutter/flutter#188752)
2026-06-30 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#188773)
2026-06-30 bdero@google.com [Impeller] Add a flat VertexAttributeFormat for vertex inputs (flutter/flutter#188684)
2026-06-30 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#188764)
2026-06-30 engine-flutter-autoroll@skia.org Roll Dart SDK from 0cb483880b6b to e1bdb9ce3327 (2 revisions) (flutter/flutter#188763)
2026-06-29 matt.boetger@gmail.com Handle 'no permissions' adb device state (flutter/flutter#187248)
2026-06-29 30870216+gaaclarke@users.noreply.github.com [windows]: adjusts uniform buffers to hit hlsl optimization (flutter/flutter#188538)
2026-06-29 engine-flutter-autoroll@skia.org Roll Skia from bfb7860cb9c7 to 71947c4110b0 (9 revisions) (flutter/flutter#188747)
2026-06-29 codefu@google.com ci: extract wait-for-engine-build logic into a reusable composite action (flutter/flutter#188748)
2026-06-29 okorohelijah@google.com Provide guided migration logs when iOS app crashes on simulator (flutter/flutter#188736)
2026-06-29 154381524+flutteractionsbot@users.noreply.github.com Revert "[flutter_tools] Track asset transformer dependencies for hot reload" (flutter/flutter#188751)
2026-06-29 34871572+gmackall@users.noreply.github.com Migrate ABI splits to new AGP dsl (flutter/flutter#188369)
2026-06-29 60122246+xiaowei-guan@users.noreply.github.com Add Impeller+OpenGLES startup benchmark for mokey (flutter/flutter#188495)
2026-06-29 louisehsu@google.com Increase macOS minimum supported version from 10.15 to 12 to support Xcode 27  (flutter/flutter#188520)
2026-06-29 30870216+gaaclarke@users.noreply.github.com Moves test ownership validation to flutter/flutter (flutter/flutter#188655)
2026-06-29 angy.avv.94@hotmail.it Add --flavor support for Windows desktop builds (flutter/flutter#187034)
2026-06-29 awolff@google.com Android_hardware_smoke_test: Enable pixel exact local file comparator to read goldens from flutter asset URI (flutter/flutter#188587)
2026-06-29 64674824+yashas-hm@users.noreply.github.com [flutter_tools] Use DeviceHub.app for iOS simulator path on Xcode 27+ (flutter/flutter#187910)
2026-06-29 engine-flutter-autoroll@skia.org Roll Skia from 111e7582d081 to bfb7860cb9c7 (2 revisions) (flutter/flutter#188731)
2026-06-29 jacksongardner@google.com Use `revert` label instead of `revert_wf` (flutter/flutter#188639)
2026-06-29 bkonyi@google.com Properly await Dart Development Service shutdown with timeout (flutter/flutter#188387)
2026-06-29 bkonyi@google.com [flutter_tools] Track asset transformer dependencies for hot reload (flutter/flutter#187947)
2026-06-29 bkonyi@google.com [Tool] Tolerate malformed UTF-8 in process streaming decoders (flutter/flutter#188453)
2026-06-29 nshahan@google.com [flutter_tools] Use new ddc modules in test (flutter/flutter#188240)
2026-06-29 engine-flutter-autoroll@skia.org Roll Packages from c1f7d92 to 656ccaa (12 revisions) (flutter/flutter#188728)
2026-06-29 robert.ancell@canonical.com Remove unused fields (flutter/flutter#188705)
2026-06-29 robert.ancell@canonical.com Clear text input handler widget on view dispose (flutter/flutter#188701)
2026-06-29 robert.ancell@canonical.com Free compositor in view renderer finalize to avoid use-after-free (flutter/flutter#188702)
2026-06-29 robert.ancell@canonical.com [linux] Use GWeakRef in mock signal handler test helper (flutter/flutter#188700)
2026-06-29 Rusino@users.noreply.github.com Fixing few related editing issues with LTR/RTL text (flutter/flutter#188503)
2026-06-29 bdero@google.com [Flutter GPU] Add Texture.fromImage to wrap a ui.Image texture (flutter/flutter#188605)
2026-06-29 bdero@google.com [Flutter GPU] Honor the enable argument in RenderPass.setDepthWriteEnable (flutter/flutter#188715)
2026-06-29 engine-flutter-autoroll@skia.org Roll Skia from ba1942d8c3e1 to 111e7582d081 (1 revision) (flutter/flutter#188721)
2026-06-29 engine-flutter-autoroll@skia.org Roll Skia from 587d8befe1ee to ba1942d8c3e1 (6 revisions) (flutter/flutter#188717)
2026-06-29 mosum@google.com Remove some refs to package:intl (flutter/flutter#188504)
2026-06-29 jhy03261997@gmail.com [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 stuartmorgan@google.com

flutter/flutter@0c80830...ca9f874

2026-06-30 34871572+gmackall@users.noreply.github.com [tool] Don't require a Flutter compile task when staging jniLibs (flutter/flutter#188805)
2026-06-30 jason-simmons@users.noreply.github.com [Impeller] Fix potential overflow when allocating buffers at the next power of two size (flutter/flutter#188742)
2026-06-30 bkonyi@google.com [Framework/Tool] Decouple preview theme imports (flutter/flutter#188176)
2026-06-30 kustermann@google.com Add import of `dart:_js_interop_wasm` in sdk rewriter tool (flutter/flutter#188620)
2026-06-30 15619084+vashworth@users.noreply.github.com Detach LLDB and print stack trace on process stop (flutter/flutter#188576)
2026-06-30 robert.ancell@canonical.com [Linux] Fix FlCompositorOpenGL.pixels comment (flutter/flutter#188754)
2026-06-30 bkonyi@google.com [flutter_tools] Fix crash in flutter create when pubspec.yaml is empty (flutter/flutter#188385)
2026-06-30 engine-flutter-autoroll@skia.org Roll Packages from 656ccaa to 274ed3e (23 revisions) (flutter/flutter#188792)
2026-06-30 jason-simmons@users.noreply.github.com In AndroidImageGenerator, check that the destination pixel buffer has sufficient capacity for the decoded data (flutter/flutter#188752)
2026-06-30 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#188773)
2026-06-30 bdero@google.com [Impeller] Add a flat VertexAttributeFormat for vertex inputs (flutter/flutter#188684)
2026-06-30 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#188764)
2026-06-30 engine-flutter-autoroll@skia.org Roll Dart SDK from 0cb483880b6b to e1bdb9ce3327 (2 revisions) (flutter/flutter#188763)
2026-06-29 matt.boetger@gmail.com Handle 'no permissions' adb device state (flutter/flutter#187248)
2026-06-29 30870216+gaaclarke@users.noreply.github.com [windows]: adjusts uniform buffers to hit hlsl optimization (flutter/flutter#188538)
2026-06-29 engine-flutter-autoroll@skia.org Roll Skia from bfb7860cb9c7 to 71947c4110b0 (9 revisions) (flutter/flutter#188747)
2026-06-29 codefu@google.com ci: extract wait-for-engine-build logic into a reusable composite action (flutter/flutter#188748)
2026-06-29 okorohelijah@google.com Provide guided migration logs when iOS app crashes on simulator (flutter/flutter#188736)
2026-06-29 154381524+flutteractionsbot@users.noreply.github.com Revert "[flutter_tools] Track asset transformer dependencies for hot reload" (flutter/flutter#188751)
2026-06-29 34871572+gmackall@users.noreply.github.com Migrate ABI splits to new AGP dsl (flutter/flutter#188369)
2026-06-29 60122246+xiaowei-guan@users.noreply.github.com Add Impeller+OpenGLES startup benchmark for mokey (flutter/flutter#188495)
2026-06-29 louisehsu@google.com Increase macOS minimum supported version from 10.15 to 12 to support Xcode 27  (flutter/flutter#188520)
2026-06-29 30870216+gaaclarke@users.noreply.github.com Moves test ownership validation to flutter/flutter (flutter/flutter#188655)
2026-06-29 angy.avv.94@hotmail.it Add --flavor support for Windows desktop builds (flutter/flutter#187034)
2026-06-29 awolff@google.com Android_hardware_smoke_test: Enable pixel exact local file comparator to read goldens from flutter asset URI (flutter/flutter#188587)
2026-06-29 64674824+yashas-hm@users.noreply.github.com [flutter_tools] Use DeviceHub.app for iOS simulator path on Xcode 27+ (flutter/flutter#187910)
2026-06-29 engine-flutter-autoroll@skia.org Roll Skia from 111e7582d081 to bfb7860cb9c7 (2 revisions) (flutter/flutter#188731)
2026-06-29 jacksongardner@google.com Use `revert` label instead of `revert_wf` (flutter/flutter#188639)
2026-06-29 bkonyi@google.com Properly await Dart Development Service shutdown with timeout (flutter/flutter#188387)
2026-06-29 bkonyi@google.com [flutter_tools] Track asset transformer dependencies for hot reload (flutter/flutter#187947)
2026-06-29 bkonyi@google.com [Tool] Tolerate malformed UTF-8 in process streaming decoders (flutter/flutter#188453)
2026-06-29 nshahan@google.com [flutter_tools] Use new ddc modules in test (flutter/flutter#188240)
2026-06-29 engine-flutter-autoroll@skia.org Roll Packages from c1f7d92 to 656ccaa (12 revisions) (flutter/flutter#188728)
2026-06-29 robert.ancell@canonical.com Remove unused fields (flutter/flutter#188705)
2026-06-29 robert.ancell@canonical.com Clear text input handler widget on view dispose (flutter/flutter#188701)
2026-06-29 robert.ancell@canonical.com Free compositor in view renderer finalize to avoid use-after-free (flutter/flutter#188702)
2026-06-29 robert.ancell@canonical.com [linux] Use GWeakRef in mock signal handler test helper (flutter/flutter#188700)
2026-06-29 Rusino@users.noreply.github.com Fixing few related editing issues with LTR/RTL text (flutter/flutter#188503)
2026-06-29 bdero@google.com [Flutter GPU] Add Texture.fromImage to wrap a ui.Image texture (flutter/flutter#188605)
2026-06-29 bdero@google.com [Flutter GPU] Honor the enable argument in RenderPass.setDepthWriteEnable (flutter/flutter#188715)
2026-06-29 engine-flutter-autoroll@skia.org Roll Skia from ba1942d8c3e1 to 111e7582d081 (1 revision) (flutter/flutter#188721)
2026-06-29 engine-flutter-autoroll@skia.org Roll Skia from 587d8befe1ee to ba1942d8c3e1 (6 revisions) (flutter/flutter#188717)
2026-06-29 mosum@google.com Remove some refs to package:intl (flutter/flutter#188504)
2026-06-29 jhy03261997@gmail.com [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.

2 participants