Repository navigation
Conversation
Replace the single whole-image layout on TextureSourceVK with a per (mip level, array layer) layout vector, and extend BarrierVK with a subresource range. Accessors default to whole-image/(0,0) so existing callers are unchanged. Groundwork for rendering into individual mip levels.
Read the attached (mip_level, slice) layout for a color attachment's initial layout, and record the render pass's implicit final layout on that subresource only, instead of the whole image. Lets a render pass target a single mip level without desyncing the layout of the others.
Texture to buffer copies gain a source mip level and texture to texture copies gain a destination mip level, threaded through every backend. Metal and Vulkan honor them; GLES rejects levels it cannot address yet.
…is broken Adreno drivers corrupt blit-based mipmap generation, and the sampler workaround that hides it disables mip sampling entirely. This adds a SupportsBlitMipmapGeneration capability (false on affected Adreno Vulkan) and routes AddMipmapGeneration to a render-pass generator when blit generation cannot be trusted. The generator draws the downsample chain into scratch offscreens and copies each level into the target, so target textures need no extra usage flags. Decoded images, subpass targets, and canvas mipmaps all go through the shared helper; GLES keeps glGenerateMipmap.
With render-pass generation in place on devices with broken blit generation, samplers no longer need the base-level clamp. Mip filters now pass through unmodified, which also fixes sampling of hand-uploaded mip chains through Flutter GPU.
bdero
force-pushed
the
bdero/adreno-render-pass-mipgen
branch
from
July 30, 2026 04:27
2fa9077 to
c853e24
Compare
pull Bot
pushed a commit
to Dramaga11/flutter
that referenced
this pull request
Sep 23, 2026
…cts (flutter#190186) Fixes bdero/flutter_scene#241. Related to flutter#161283. Adreno drivers corrupt blit-generated mip chains. The workaround for that rewrote every Vulkan sampler to `MipFilter::kBase`, so nothing in the process could be sampled past its base mip level. But the corruption belongs to the texture whose levels were generated, not to the sampler, so textures with hand-uploaded mip chains (prefiltered environment maps, for one) lost their mip filtering for no reason. Flutter GPU is hit hardest, since it exposes no mipmap generation at all and every mip chain it binds was uploaded by the app. The workaround now lives with the texture. On affected drivers a mipped sampled texture also gets an image view covering only the base level, and `TextureVK::GetSampledImageView` hands that view out for textures those drivers mipped. Generated chains stay unreadable past the base level, every other texture samples as requested, and the sampler library, `SamplerDescriptor`, and `lib/gpu` no longer carry any of it. A texture with `mip_count > 1` whose levels were never written is no longer masked on these devices, which matches its behavior on every other platform. flutter#190264 fixes the generation itself and will delete what is left here. ## 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. - [x] 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
Contributor
|
Hey @bdero! Would you like to continue working on this change? PRs marked as drafts are not typically reviewed, you can mark it ready for review when it is! Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #161283.
Adreno drivers corrupt blit-based mipmap generation, and the existing workaround clamps every Vulkan sampler to the base mip level, which disables mip sampling for all mipped textures on affected devices, including hand-uploaded chains sampled through Flutter GPU. This change generates the mip chain with render passes where the blit path is broken, then removes the sampler clamp so mip filters pass through unmodified.
The generator draws the downsample chain into scratch offscreens and stores each level into the target with same-size copies (only scaled blits corrupt on affected devices), so target textures need no additional usage flags. Dispatch sits behind a new SupportsBlitMipmapGeneration capability inside the shared AddMipmapGeneration helper; healthy devices keep blit generation and GLES keeps glGenerateMipmap. Vulkan image layouts are now tracked per subresource, which rendering into individual mip levels requires and which also fixes a latent attachment layout desync.
Supersedes #189897 and #189966.
Pre-launch Checklist
///).