Skip to content

[Flutter GPU] Uniform and texture binds marshal the slot name across the FFI boundary on every call #189819

Closed

Description

@bdero

RenderPass.bindUniform and RenderPass.bindTexture pass the uniform's name as a Dart string handle on every call. The native side then allocates a std::string via tonic::StdStringFromDart and resolves the binding with a string-keyed map lookup, per bind, per draw, per frame, even though the resolution result never changes for a given shader between reloads.

In draw-heavy scenes this is a measurable share of main-thread frame time. In a renderer submitting ~10k draws per frame (2 uniform binds and 1 texture bind per draw), the name marshal and lookups account for roughly 7-12% of the CPU render phase on macOS/Metal in profile mode.

The reflection data is immutable between shader reloads, so the binding can be resolved to a stable index once and reused. Proposal in the linked PR.

Activity

  1. added
    engineflutter/engine related. See also e: labels.
    c: performanceRelates to speed or footprint issues (see "perf:" labels)
    e: impellerImpeller rendering backend issues and features requests
    on Jul 22, 2026
  2. moved this to 🤔 Needs Triage in Flutter GPUon Jul 22, 2026
  3. moved this from 🤔 Needs Triage to ✅ Done in Flutter GPUon Jul 30, 2026
  4. github-actions commented on Aug 13, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  5. locked as resolved and limited conversation to collaborators on Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: performanceRelates to speed or footprint issues (see "perf:" labels)e: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.flutter-gputeam-fluttergpuOwned by Flutter GPU team

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions