Repository navigation
[Flutter GPU] Reusable binding sets - #190400
Merged
Merged
Conversation
bdero
marked this pull request as ready for review
August 2, 2026 04:59
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces BindingSet to Flutter GPU, allowing developers to group uniform and texture bindings into a single reusable set to optimize draw calls. The implementation spans both C++ and Dart, with corresponding unit and integration tests added. Feedback focuses on a critical lifetime risk where storing the sampler as a raw pointer (impeller::raw_ptr) in TextureBinding can lead to dangling pointers; it is recommended to use std::shared_ptr instead and update the associated signatures and tests. Additionally, a documentation comment is requested for the public texture field in Dart to comply with the repository's style guide.
This was referenced Aug 2, 2026
Member
|
is this ready for review? |
A BindingSet resolves a group of uniform and texture bindings against shader reflection once at creation. RenderPass.bindSet puts it in one of four slots, so binding a whole material costs one slot assignment instead of per-resource work on every draw.
bdero
force-pushed
the
bdero/flutter-gpu-binding-sets
branch
from
August 6, 2026 00:25
96c921a to
d40fe62
Compare
Member
Author
|
Ready now! |
wolfenrain
approved these changes
Aug 7, 2026
bdero
added a commit
to bdero/flutter_scene
that referenced
this pull request
Oct 4, 2026
A material's textures live as long as the material, but its uniforms are rewritten every draw from the transient allocator, so a shader's resources are not one uniform group. WebGPU models exactly that split as a bind group whose textures are fixed and whose uniform buffer is reached through a dynamic offset, and a bind group cannot be built until its layout is known. GpuBindingLayout is that layout as pure comparable data, canonically ordered so declaration order does not split a cache, and testable without a GPU. GpuBindingSet carries the stable half plus the per-draw uniform entry point. The Flutter GPU backend replays both halves as individual binds, which costs what binding each resource directly costs today, and collapses to one call when flutter/flutter#190400 lands behind an unchanged seam.
bdero
added a commit
to bdero/flutter_scene
that referenced
this pull request
Oct 4, 2026
A material's textures live as long as the material, but its uniforms are rewritten every draw from the transient allocator, so a shader's resources are not one uniform group. WebGPU models exactly that split as a bind group whose textures are fixed and whose uniform buffer is reached through a dynamic offset, and a bind group cannot be built until its layout is known. GpuBindingLayout is that layout as pure comparable data, canonically ordered so declaration order does not split a cache, and testable without a GPU. GpuBindingSet carries the stable half plus the per-draw uniform entry point. The Flutter GPU backend replays both halves as individual binds, which costs what binding each resource directly costs today, and collapses to one call when flutter/flutter#190400 lands behind an unchanged seam.
This was referenced Oct 4, 2026
This was referenced Oct 5, 2026
This was referenced Oct 6, 2026
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.
Fixes #190397.
GpuContext.createBindingSetresolves a group of uniform and texture bindings against shader reflection once, andRenderPass.bindSetputs that set in one of four slots. Binding a whole material is now one slot assignment instead of per-resource work on every draw, and the set's bindings are replayed with borrowed reflection metadata, so no per-binding allocation happens insideDraw.Keys are
UniformSlots rather than names, so a single set can span the vertex and fragment stages. The existingbindUniformandbindTextureare unchanged and are applied after any bound sets, so an individual bind still overrides a set member for that draw.Pre-launch Checklist
///).