这是indexloc提供的服务,不要输入任何密码
Skip to content

Allow render bundles to inherit state #5171

@kainino0x

Description

@kainino0x

The original investigation #382 showed that render bundles could not inherit any state due to restrictions of the backends, Vulkan in particular. If we drop the constraint that we render bundles need to be implementable on Vulkan secondary command buffers (and require implementations to record-and-replay instead), we have a lot more flexibility. This is an initial write-up of what we could do.

  • Vulkan secondary command buffers inherit nothing
  • D3D12 bundles inherit everything except PSO (and primitive topology but that's part of our PSO too)
  • Metal ICBs have options: inheritBuffers and inheritPipelineState
    • inheritBuffers probably includes argument buffers, uniform/storage buffers, vertex, and index buffers but this needs to be verified.

So the first step would be to add the equivalent of Metal's inheritBuffers. In addition to vertex/index buffers, this should include bind groups (this requires an implementation which uses argument buffers exclusively for bindings - also note #5142 could impact this).

Depending on the implementation of immediates, they could be inherited - setVertexBytes, etc. are presumably not inherited - see #5118.

[export] - One thing I don't know about either D3D12 or Metal is whether bindings changed inside the bundle are "exported" back to the primary command buffer. This also needs to be investigated. Metal does not allow setting buffers (bind groups) inside an ICB with inheritBuffers = true. So this is a non-issue.

When recording such a bundle, we need:

  • An option that says the bundle inherits bind groups (or possibly which bind groups it inherits, depending on [export]) and can't bind any of its own
  • Validation to prevent overwriting those bind groups? (depending on [export])

And when replaying:

  • We don't clear the bind group state after executing this type of bundle (but tbd whether the state could have changed [export] it is always exactly the same as before executing the bundle)

Related:

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiWebGPU APIneeds investigationRequires an investigation into implementation constraints

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions