Skip to content

[Impeller] Make RenderPass commands more granular. #133179

@bdero

Description

@bdero

Follow-up for #132781.

To reduce both cycles and memory pressure when encoding RenderCommands, we could make the RenderPass encoding API more granular to more closely reflect how the backends need to track command state anyhow. The viewport and scissor don't have to be part of every command. Nor do all of the binding types, etc.

If we eventually find ourselves in a world where we want to switch Impeller's HAL to not have pipelines (something which I'm increasingly finding likely), then slimming down RenderCommands will become even more necessary with time, since much of the state that is currently set on pipelines (for example, pipeline blend ops) will need to be moved into the RenderCommand, bloating its size even more.

Our current command encoding setup isn't just wasteful in terms of memory: We also need to optimize for reduction of graphics API traffic, and so we currently check every field of every command for differences and only encode changes that have occurred between commands anyhow.

For packing these smaller commands in a buffer, I would recommend reworking the RenderPass API to take simpler commands (like BindTexture, DrawIndices, SetViewport, etc.) and have these commands encode a discriminated union chunk into the internal encoding buffer. The discriminated union's enum can be used by the backend as an index into a per-backend dispatch table (ordered list of functions) that knows how to handle encoding each of the subcommands.

I'd strongly recommend against any solution that involves boxing individual buffer commands with smart pointers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work liste: 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

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions