Skip to content

[Impeller] Simplify Capabilities into a data-holding type #187704

Description

@bdero

Capabilities is a pure-virtual interface with three full implementations (StandardCapabilities, CapabilitiesGLES, CapabilitiesVK), a builder, and a gmock. Adding one capability flag currently touches around six files, and every backend's accessors are trivial reads of precomputed values, so the polymorphism buys little for the cross-backend data.

The interface conflates two different concerns.

  • Cross-backend capability data (bools, default formats, sizes) is exposed through trivial accessors, identical in shape across backends, that just read precomputed values. This needs no polymorphism.
  • Backend-specific behavior and state (Vulkan extensions, features, and workarounds; GLES limits and ANGLE/ES detection) legitimately differs per backend and is already reached via BackendCast downcasts (1 site for GLES, ~5 for Vulkan).

Proposal

Split the cross-backend capability data from backend-specific state.

  • Make the shared capability surface a concrete data-holding type (fields plus a builder/setters, no virtuals), and delete MockCapabilities.
  • Have CapabilitiesGLES and CapabilitiesVK own a data object and expose their backend-specific methods separately. Context::GetCapabilities() returns the data object.
  • Route the existing BackendCast<CapabilitiesVK>/BackendCast<CapabilitiesGLES> sites through the backend context instead.
  • Fold Vulkan's post-construction mutation (SetPhysicalDevice, ApplyWorkarounds, SetOffscreenFormat) into plain setters, removing the const + mutable workaround.

After this, adding a capability is "add a field, set it where it is computed."

Pure cleanup, no behavior change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: proposalA detailed proposal for a change to Flutterc: tech-debtTechnical debt, code quality, testing, etc.e: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.team-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions