Skip to content

[Impeller] Reland: Allow attaching specific texture mip levels and slices#187470

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
bdero:bdero/slice-attachments-reland
Jun 3, 2026
Merged

[Impeller] Reland: Allow attaching specific texture mip levels and slices#187470
auto-submit[bot] merged 3 commits into
flutter:masterfrom
bdero:bdero/slice-attachments-reland

Conversation

@bdero

@bdero bdero commented Jun 2, 2026

Copy link
Copy Markdown
Member

Relands #187066, reverted in #187445.

The original PR passed every pre-submit check and merged cleanly, but broke post-submit on Mac and Linux because a concurrent change (#187246, b4e5291940c "add sdf golden variants for OpenGL") added a kOpenGLESSDF variant to PlaygroundBackend that was not present when this PR's CI last ran. CanRenderToMipLevel only skipped kOpenGLES, so on the post-submit master it ran on kOpenGLESSDF and aborted with SIGABRT because the GLES test backend does not support rendering into non-zero mip levels. This reland is identical to #187066 plus the missing kOpenGLESSDF skip in CanRenderToMipLevel, matching the skip pattern that every other GLES-skipping test in renderer_unittests.cc already uses after #187246.

Failing test seen post-submit (Mac mac_unopt build 12910, Linux linux_unopt build 18302): Play/RendererTest.CanRenderToMipLevel/OpenGLESSDF returned/aborted with exit code -6.


Fixes #145014 (the attachment half; uploading specific mip levels and slices already landed).

Impeller could only attach the base mip level and slice of a texture as a render target. This adds mip_level and slice to the HAL Attachment struct so a render pass can target a specific mip level, cube map face, or array layer. The render target size follows the selected mip level.

  • Metal: sets the attachment descriptor's level and slice.
  • Vulkan: creates one 2D attachment view per mip level and layer, and the framebuffer cache is keyed on (sample_count, mip_level, slice) so non-base subresources reuse cached framebuffers.
  • OpenGL ES: attaches the cube face target and mip level, allocates the subresource on demand, and gates non-zero mip levels on ES 3.0 or GL_OES_fbo_render_mipmap. Rendering to cube faces works down to ES 2.0.

Tests cover attachment validation and cross-backend rendering to a slice and to a mip level.

Pre-launch Checklist

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 2, 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 2, 2026

@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 adds support for rendering directly into specific texture subresources, including mip levels and slices (cube map faces or array layers), across the GLES, Metal, and Vulkan backends. It updates the Attachment struct to include mip_level and slice properties, adjusts RenderTarget to compute dimensions based on the targeted mip level, and updates backend-specific texture and render pass implementations to manage and cache subresource-specific framebuffer attachments. Feedback on the GLES implementation identifies a potential narrowing conversion warning in texture_gles.cc where int64_t values are passed to gl.TexImage2D, suggesting explicit casts to GLsizei.

Comment thread engine/src/flutter/impeller/renderer/backend/gles/texture_gles.cc Outdated
bdero added 2 commits June 2, 2026 14:42
…utter#187066)

Fixes flutter#145014 (the attachment half; uploading specific
mip levels and slices already landed).

Impeller could only attach the base mip level and slice of a texture as
a render target. This adds `mip_level` and `slice` to the HAL
`Attachment` struct so a render pass can target a specific mip level,
cube map face, or array layer. The render target size follows the
selected mip level.

- Metal: sets the attachment descriptor's level and slice.
- Vulkan: creates one 2D attachment view per mip level and layer, and
bypasses the framebuffer cache for non-base subresources.
- OpenGL ES: attaches the cube face target and mip level, allocates the
subresource on demand, and gates non-zero mip levels on ES 3.0 or
`GL_OES_fbo_render_mipmap`. Rendering to cube faces works down to ES
2.0.

Tests cover attachment validation, cross-backend rendering to a slice
and to a mip level, and a renderer golden that samples two mip levels.

## 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 documentation (doc comments with `///`).
- [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.
- [ ] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
flutter#187246 added a kOpenGLESSDF variant to PlaygroundBackend after this
PR's CI had last run. CanRenderToMipLevel only skipped kOpenGLES, so it
ran on kOpenGLESSDF and aborted because the GLES test backend does not
support rendering into non-zero mip levels. Match the skip pattern that
every other GLES-skipping test in this file already uses.
@bdero bdero force-pushed the bdero/slice-attachments-reland branch from fcc73e9 to 60de826 Compare June 2, 2026 21:43
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 2, 2026
@bdero bdero added the CICD Run CI/CD label Jun 2, 2026
@flutter-dashboard

This comment was marked as outdated.

@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 2, 2026
@bdero bdero added the CICD Run CI/CD label Jun 2, 2026
@bdero bdero requested review from gaaclarke, jtmcdole and walley892 June 2, 2026 21:51
gaaclarke
gaaclarke previously approved these changes Jun 2, 2026

@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.

thanks!

The std::max<int64_t> expressions are int64_t, and gl.TexImage2D
takes GLsizei (int32) for width/height. Add explicit casts to avoid
narrowing conversion warnings on stricter compiler configurations.
@bdero bdero force-pushed the bdero/slice-attachments-reland branch from 7e4015b to c0c2175 Compare June 3, 2026 00:01
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 3, 2026
@bdero bdero added the CICD Run CI/CD label Jun 3, 2026
@bdero bdero requested a review from gaaclarke June 3, 2026 05:29
@bdero

bdero commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

Oops, had a format issue.

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 3, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue Jun 3, 2026
Merged via the queue into flutter:master with commit 42b1fd2 Jun 3, 2026
206 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 3, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Jun 5, 2026
Roll Flutter from 2ba5420a7049 to 1bdf4af29076 (43 revisions)

flutter/flutter@2ba5420...1bdf4af

2026-06-05 engine-flutter-autoroll@skia.org Roll Packages from 03352b5 to 61bdbb4 (5 revisions) (flutter/flutter#187612)
2026-06-05 engine-flutter-autoroll@skia.org Roll Skia from 6e003d7f69c8 to a47a9a2c8ae5 (1 revision) (flutter/flutter#187610)
2026-06-05 engine-flutter-autoroll@skia.org Roll Dart SDK from aad8be4ce307 to 6a9a0efe66eb (10 revisions) (flutter/flutter#187609)
2026-06-05 engine-flutter-autoroll@skia.org Roll Skia from 494f1bf55f51 to 6e003d7f69c8 (2 revisions) (flutter/flutter#187607)
2026-06-05 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from ZE1Jy9CtVVi-tjBAE... to N_LiSaBSUsE2LDZgG... (flutter/flutter#187597)
2026-06-05 engine-flutter-autoroll@skia.org Roll Skia from 59556fdb8c33 to 494f1bf55f51 (2 revisions) (flutter/flutter#187596)
2026-06-04 engine-flutter-autoroll@skia.org Roll Skia from 8eb107046fd5 to 59556fdb8c33 (1 revision) (flutter/flutter#187590)
2026-06-04 34871572+gmackall@users.noreply.github.com Remove `embedded_android_views_integration_test.dart` (flutter/flutter#187465)
2026-06-04 burak.karahan@mail.ru Remove Material imports from rendering editable tests (flutter/flutter#186951)
2026-06-04 jason-simmons@users.noreply.github.com [Impeller] Wait for the Vulkan device to become idle before destroying Vulkan objects in the AHBSwapchainImplVK destructor (flutter/flutter#187477)
2026-06-04 chris@bracken.jp [iOS] Eliminate unnecessary redeclaration of FlutterDisplayLink (flutter/flutter#187557)
2026-06-04 engine-flutter-autoroll@skia.org Roll Skia from 928ded2a31af to 8eb107046fd5 (1 revision) (flutter/flutter#187583)
2026-06-04 34871572+gmackall@users.noreply.github.com Log stdout in adb.dart (flutter/flutter#187531)
2026-06-04 mvincentong@gmail.com Clarify RouterDelegate popRoute bubbling (flutter/flutter#186875)
2026-06-04 engine-flutter-autoroll@skia.org Roll Skia from 928ded2a31af to 8eb107046fd5 (1 revision) (flutter/flutter#187584)
2026-06-04 1063596+reidbaker@users.noreply.github.com Add updating-android-sdk agent skill for rolling Android SDK in CIPD (flutter/flutter#187576)
2026-06-04 Rusino@users.noreply.github.com Fixing alignment issue (flutter/flutter#187518)
2026-06-04 brackenavaron@gmail.com [Material Cross Imports] Clean up Material Divider usages (flutter/flutter#187300)
2026-06-04 engine-flutter-autoroll@skia.org Roll Skia from cecc0e0da9ae to 928ded2a31af (6 revisions) (flutter/flutter#187574)
2026-06-04 31859944+LongCatIsLooong@users.noreply.github.com Use swift demangle to verify internal Swift symbols (flutter/flutter#186835)
2026-06-04 1063596+reidbaker@users.noreply.github.com Add android 37 platform and build tools to script for android cipd bundle creation (flutter/flutter#187571)
2026-06-04 jason-simmons@users.noreply.github.com [Impeller] Increase the precision of the IPSampleWithTileModeOES coords parameter to match the input coordinates in the tiled_texture_fill_external shader (flutter/flutter#187545)
2026-06-04 engine-flutter-autoroll@skia.org Roll Packages from b11504f to 03352b5 (4 revisions) (flutter/flutter#187569)
2026-06-04 iinozemtsev@google.com Roll Dart SDK to Dart 3.13 beta2 (flutter/flutter#187555)
2026-06-04 engine-flutter-autoroll@skia.org Roll Skia from 611e3f8ceb93 to cecc0e0da9ae (1 revision) (flutter/flutter#187562)
2026-06-04 6655696+guidezpl@users.noreply.github.com Add step to bootstrap Flutter tool in coverage workflow (flutter/flutter#187199)
2026-06-04 engine-flutter-autoroll@skia.org Roll Skia from 4fdb859c8da7 to 611e3f8ceb93 (4 revisions) (flutter/flutter#187554)
2026-06-04 engine-flutter-autoroll@skia.org Roll Skia from 0020aae33f63 to 4fdb859c8da7 (2 revisions) (flutter/flutter#187552)
2026-06-04 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from ap7MhLX4TdpWRrLS_... to ZE1Jy9CtVVi-tjBAE... (flutter/flutter#187550)
2026-06-04 stuartmorgan@google.com Add vector_math to package issue template (flutter/flutter#187536)
2026-06-04 jason-simmons@users.noreply.github.com Manual roll Dart SDK from d39850bf4a01 to 3b70b98fa7c0 (flutter/flutter#187519)
2026-06-04 engine-flutter-autoroll@skia.org Roll Skia from d625048c853a to 0020aae33f63 (20 revisions) (flutter/flutter#187539)
2026-06-04 smille2003@yandex.ru [Impeller][Windows] fix black screen on OpenGL fallback (flutter/flutter#187288)
2026-06-04 97480502+b-luk@users.noreply.github.com Fix unintentionally joined path contours (flutter/flutter#187522)
2026-06-03 matt.boetger@gmail.com fix: resolve issue #177379 by using lazy buildDirectory.dir() API in build.gradle template (flutter/flutter#187127)
2026-06-03 34871572+gmackall@users.noreply.github.com Add a skill for flake analysis (flutter/flutter#187530)
2026-06-03 30870216+gaaclarke@users.noreply.github.com adds linux impeller project flag (flutter/flutter#186982)
2026-06-03 codedoctor@linwood.dev Add support for stylus buttons (flutter/flutter#183369)
2026-06-03 46920873+gabrimatic@users.noreply.github.com Prevent Cubic transform from looping on out-of-range input (flutter/flutter#185875)
2026-06-03 bdero@google.com [Impeller] Reland: Allow attaching specific texture mip levels and slices (flutter/flutter#187470)
2026-06-03 kjlubick@users.noreply.github.com [skia] Update image deserial proc (flutter/flutter#185041)
2026-06-03 112751483+shivanshu877@users.noreply.github.com docs: update Impeller advanced blend docs for framebuffer fetch (flutter/flutter#185457)
2026-06-03 ahmedsameha1@gmail.com Handle#6537 fifth grouped tests (flutter/flutter#183720)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
...
pull Bot pushed a commit to AbhiShake1/flutter that referenced this pull request Jun 9, 2026
…for rendering (flutter#187685)

Fixes flutter#150455

Surfaces the Impeller HAL support for rendering into a specific texture
mip level and slice (landed in flutter#187470) to Flutter GPU.

- Adds `mipLevel` and `slice` (both default 0) to `ColorAttachment` and
`DepthStencilAttachment`. They select the subresource of the attachment
texture to render into: a non-zero mip level, a cube map face, or both.
- Validates, in Dart and unconditionally, that each attachment's
`mipLevel` and `slice` are in range (including the MSAA resolve texture)
and that all attachments resolve to the same size. Out-of-range
subresources and size mismatches are undefined behavior in release,
where the engine-side checks are compiled out.
- Adds `GpuContext.doesSupportFramebufferRenderMipmap`, lifted onto the
base `Capabilities` interface so it can be queried. Rendering into a
cube face is always available. Rendering into a non-zero mip level
returns true on Metal and Vulkan and false on GLES: the GLES texture
storage path yields an incomplete framebuffer for a non-base mip
attachment, so the capability is conservative until that is reworked
(tracked separately). Cube face rendering on GLES is unaffected.

Tests cover rendering into a cube slice, rendering into a non-zero mip
level (gated on the capability), and the range and size validation.

## 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 documentation (doc comments with `///`).
- [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.
- [ ] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…r#11849)

Roll Flutter from 2ba5420a7049 to 1bdf4af29076 (43 revisions)

flutter/flutter@2ba5420...1bdf4af

2026-06-05 engine-flutter-autoroll@skia.org Roll Packages from 03352b5 to 61bdbb4 (5 revisions) (flutter/flutter#187612)
2026-06-05 engine-flutter-autoroll@skia.org Roll Skia from 6e003d7f69c8 to a47a9a2c8ae5 (1 revision) (flutter/flutter#187610)
2026-06-05 engine-flutter-autoroll@skia.org Roll Dart SDK from aad8be4ce307 to 6a9a0efe66eb (10 revisions) (flutter/flutter#187609)
2026-06-05 engine-flutter-autoroll@skia.org Roll Skia from 494f1bf55f51 to 6e003d7f69c8 (2 revisions) (flutter/flutter#187607)
2026-06-05 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from ZE1Jy9CtVVi-tjBAE... to N_LiSaBSUsE2LDZgG... (flutter/flutter#187597)
2026-06-05 engine-flutter-autoroll@skia.org Roll Skia from 59556fdb8c33 to 494f1bf55f51 (2 revisions) (flutter/flutter#187596)
2026-06-04 engine-flutter-autoroll@skia.org Roll Skia from 8eb107046fd5 to 59556fdb8c33 (1 revision) (flutter/flutter#187590)
2026-06-04 34871572+gmackall@users.noreply.github.com Remove `embedded_android_views_integration_test.dart` (flutter/flutter#187465)
2026-06-04 burak.karahan@mail.ru Remove Material imports from rendering editable tests (flutter/flutter#186951)
2026-06-04 jason-simmons@users.noreply.github.com [Impeller] Wait for the Vulkan device to become idle before destroying Vulkan objects in the AHBSwapchainImplVK destructor (flutter/flutter#187477)
2026-06-04 chris@bracken.jp [iOS] Eliminate unnecessary redeclaration of FlutterDisplayLink (flutter/flutter#187557)
2026-06-04 engine-flutter-autoroll@skia.org Roll Skia from 928ded2a31af to 8eb107046fd5 (1 revision) (flutter/flutter#187583)
2026-06-04 34871572+gmackall@users.noreply.github.com Log stdout in adb.dart (flutter/flutter#187531)
2026-06-04 mvincentong@gmail.com Clarify RouterDelegate popRoute bubbling (flutter/flutter#186875)
2026-06-04 engine-flutter-autoroll@skia.org Roll Skia from 928ded2a31af to 8eb107046fd5 (1 revision) (flutter/flutter#187584)
2026-06-04 1063596+reidbaker@users.noreply.github.com Add updating-android-sdk agent skill for rolling Android SDK in CIPD (flutter/flutter#187576)
2026-06-04 Rusino@users.noreply.github.com Fixing alignment issue (flutter/flutter#187518)
2026-06-04 brackenavaron@gmail.com [Material Cross Imports] Clean up Material Divider usages (flutter/flutter#187300)
2026-06-04 engine-flutter-autoroll@skia.org Roll Skia from cecc0e0da9ae to 928ded2a31af (6 revisions) (flutter/flutter#187574)
2026-06-04 31859944+LongCatIsLooong@users.noreply.github.com Use swift demangle to verify internal Swift symbols (flutter/flutter#186835)
2026-06-04 1063596+reidbaker@users.noreply.github.com Add android 37 platform and build tools to script for android cipd bundle creation (flutter/flutter#187571)
2026-06-04 jason-simmons@users.noreply.github.com [Impeller] Increase the precision of the IPSampleWithTileModeOES coords parameter to match the input coordinates in the tiled_texture_fill_external shader (flutter/flutter#187545)
2026-06-04 engine-flutter-autoroll@skia.org Roll Packages from b11504f to 03352b5 (4 revisions) (flutter/flutter#187569)
2026-06-04 iinozemtsev@google.com Roll Dart SDK to Dart 3.13 beta2 (flutter/flutter#187555)
2026-06-04 engine-flutter-autoroll@skia.org Roll Skia from 611e3f8ceb93 to cecc0e0da9ae (1 revision) (flutter/flutter#187562)
2026-06-04 6655696+guidezpl@users.noreply.github.com Add step to bootstrap Flutter tool in coverage workflow (flutter/flutter#187199)
2026-06-04 engine-flutter-autoroll@skia.org Roll Skia from 4fdb859c8da7 to 611e3f8ceb93 (4 revisions) (flutter/flutter#187554)
2026-06-04 engine-flutter-autoroll@skia.org Roll Skia from 0020aae33f63 to 4fdb859c8da7 (2 revisions) (flutter/flutter#187552)
2026-06-04 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from ap7MhLX4TdpWRrLS_... to ZE1Jy9CtVVi-tjBAE... (flutter/flutter#187550)
2026-06-04 stuartmorgan@google.com Add vector_math to package issue template (flutter/flutter#187536)
2026-06-04 jason-simmons@users.noreply.github.com Manual roll Dart SDK from d39850bf4a01 to 3b70b98fa7c0 (flutter/flutter#187519)
2026-06-04 engine-flutter-autoroll@skia.org Roll Skia from d625048c853a to 0020aae33f63 (20 revisions) (flutter/flutter#187539)
2026-06-04 smille2003@yandex.ru [Impeller][Windows] fix black screen on OpenGL fallback (flutter/flutter#187288)
2026-06-04 97480502+b-luk@users.noreply.github.com Fix unintentionally joined path contours (flutter/flutter#187522)
2026-06-03 matt.boetger@gmail.com fix: resolve issue #177379 by using lazy buildDirectory.dir() API in build.gradle template (flutter/flutter#187127)
2026-06-03 34871572+gmackall@users.noreply.github.com Add a skill for flake analysis (flutter/flutter#187530)
2026-06-03 30870216+gaaclarke@users.noreply.github.com adds linux impeller project flag (flutter/flutter#186982)
2026-06-03 codedoctor@linwood.dev Add support for stylus buttons (flutter/flutter#183369)
2026-06-03 46920873+gabrimatic@users.noreply.github.com Prevent Cubic transform from looping on out-of-range input (flutter/flutter#185875)
2026-06-03 bdero@google.com [Impeller] Reland: Allow attaching specific texture mip levels and slices (flutter/flutter#187470)
2026-06-03 kjlubick@users.noreply.github.com [skia] Update image deserial proc (flutter/flutter#185041)
2026-06-03 112751483+shivanshu877@users.noreply.github.com docs: update Impeller advanced blend docs for framebuffer fetch (flutter/flutter#185457)
2026-06-03 ahmedsameha1@gmail.com Handle#6537 fifth grouped tests (flutter/flutter#183720)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
...
via-guy pushed a commit to via-guy/flutter that referenced this pull request Jun 26, 2026
…ices (flutter#187470)

Relands flutter#187066, reverted in flutter#187445.

The original PR passed every pre-submit check and merged cleanly, but
broke post-submit on Mac and Linux because a concurrent change (flutter#187246,
`b4e5291940c` "add sdf golden variants for OpenGL") added a
`kOpenGLESSDF` variant to `PlaygroundBackend` that was not present when
this PR's CI last ran. `CanRenderToMipLevel` only skipped `kOpenGLES`,
so on the post-submit master it ran on `kOpenGLESSDF` and aborted with
SIGABRT because the GLES test backend does not support rendering into
non-zero mip levels. This reland is identical to flutter#187066 plus the
missing `kOpenGLESSDF` skip in `CanRenderToMipLevel`, matching the skip
pattern that every other GLES-skipping test in `renderer_unittests.cc`
already uses after flutter#187246.

Failing test seen post-submit (Mac mac_unopt build 12910, Linux
linux_unopt build 18302):
`Play/RendererTest.CanRenderToMipLevel/OpenGLESSDF` returned/aborted
with exit code -6.

---

Fixes flutter#145014 (the attachment half; uploading specific
mip levels and slices already landed).

Impeller could only attach the base mip level and slice of a texture as
a render target. This adds `mip_level` and `slice` to the HAL
`Attachment` struct so a render pass can target a specific mip level,
cube map face, or array layer. The render target size follows the
selected mip level.

- Metal: sets the attachment descriptor's level and slice.
- Vulkan: creates one 2D attachment view per mip level and layer, and
the framebuffer cache is keyed on `(sample_count, mip_level, slice)` so
non-base subresources reuse cached framebuffers.
- OpenGL ES: attaches the cube face target and mip level, allocates the
subresource on demand, and gates non-zero mip levels on ES 3.0 or
`GL_OES_fbo_render_mipmap`. Rendering to cube faces works down to ES
2.0.

Tests cover attachment validation and cross-backend rendering to a slice
and to a mip level.

## 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 documentation (doc comments with `///`).
- [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.
- [ ] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
via-guy pushed a commit to via-guy/flutter that referenced this pull request Jun 26, 2026
…for rendering (flutter#187685)

Fixes flutter#150455

Surfaces the Impeller HAL support for rendering into a specific texture
mip level and slice (landed in flutter#187470) to Flutter GPU.

- Adds `mipLevel` and `slice` (both default 0) to `ColorAttachment` and
`DepthStencilAttachment`. They select the subresource of the attachment
texture to render into: a non-zero mip level, a cube map face, or both.
- Validates, in Dart and unconditionally, that each attachment's
`mipLevel` and `slice` are in range (including the MSAA resolve texture)
and that all attachments resolve to the same size. Out-of-range
subresources and size mismatches are undefined behavior in release,
where the engine-side checks are compiled out.
- Adds `GpuContext.doesSupportFramebufferRenderMipmap`, lifted onto the
base `Capabilities` interface so it can be queried. Rendering into a
cube face is always available. Rendering into a non-zero mip level
returns true on Metal and Vulkan and false on GLES: the GLES texture
storage path yields an incomplete framebuffer for a non-base mip
attachment, so the capability is conservative until that is reworked
(tracked separately). Cube face rendering on GLES is unaffected.

Tests cover rendering into a cube slice, rendering into a non-zero mip
level (gated on the capability), and the range and size validation.

## 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 documentation (doc comments with `///`).
- [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.
- [ ] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
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.

[Impeller] HAL: Allow attaching and uploading specific Texture mip levels & slices.

3 participants