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

It should be possible to unbind a bind group / vertex buffer #3787

@litherum

Description

@litherum

Right now, the spec for setBindGroup() says:

bindGroup, of type GPUBindGroup, non-nullable, required

The spec for setVertexBuffer() indicates the buffer argument is neither nullable nor optional.

As the spec stands right now, this isn't a big deal; if you set more bind groups or vertex buffers than the shaders use, that's no problem; the extra ones are just ... unused. There's no need to try to conserve bind group slots or vertex buffer slots inside a render pass, because the number of slots you get is fixed at device creation time.

This changes in the presence of #2749 . For that issue, the CG has a tentative agreement that we can add a new limit for the number of bind groups plus the number of vertex buffers. (This is because both bind groups and vertex buffers end up consuming the same Metal resources, so the new WebGPU limit is on the sum of them, rather than on each one individually).

But, once you have a limit on the sum of them, now they become worthy of being conserved - it's totally legit for an application to want to unbind a vertex buffer to try to make room for a bind group. So we should let people unbind stuff.

Mechanically, this proposal is just to let the bind group parameter to setBindGroup() and the vertex buffer parameter to setVertexBuffer() to be nullable.

Metadata

Metadata

Assignees

Labels

copyeditingPure editorial stuff (copyediting, *.bs file syntax, etc.)

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions