Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Validation requires vertex buffers to be set, even if they are unused #4999

@kainino0x

Description

@kainino0x

When creating a GPURenderPipeline, it is possible to specify vertex buffers that have no attributes, and therefore is not actually used by the pipeline. However, in draw-time validation, we still require a vertex buffer to be bound to that slot.

We could normalize the descriptor such that { arrayStride, attributes: [] } does the same thing as null.

Additionally, we could optionally skip validation of arrayStride if attributes.length==0, but this doesn't matter.

The motivation for revisiting this is for language bindings such as C: webgpu-native/webgpu-headers#432
We previously discussed this in gpuweb #2864, in which we conservatively chose not to change the JS spec, and decided that webgpu.h should indicate a hole with something other than attributes=[] (we used a WGPUVertexStepMode_VertexBufferNotUsed sentinel value).

Revisiting this with the benefit of time, though, it is very strange that the JS API will validate this thing that is totally unused. I don't really think there's any reasonable bug that this could usefully catch; for example if you forgot to specify any attributes and forgot to bind a vertex buffer, you would still get an error in createRenderPipeline(), as long as the shader attempted to use those attributes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions