-
Notifications
You must be signed in to change notification settings - Fork 335
Description
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.