WebGPU: Is it more performant to use a single interleaved GPUBuffer for positions, normals, and UVs? Or should I use separate GPUBuffers?

@Usnul @donmccurdy

I’ve been learning how to use WebGPU.

Right now I’m learning about setVertexBuffer() and how you set bindings that your shader can use. In my exercise code, I’ve decided to use three separate GPUBuffers for positions, normals, and UVs.

My question is, is it more performant to combine positions, normals, and UVs into a single interleaved GPUBuffer, therefore resulting in a single call to setVertexBuffer() instead of three? Or does it not really make a difference? Personally, I would prefer to keep them separate for flexibility, but I’m wondering if there is a measurable performance cost for that.

For a handful of meshes the difference is usually small, so I’d keep them separate while you learn. Interleaving can help memory locality and saves a few setVertexBuffer calls, which matters more with many draw calls. Separate buffers are nicer for passes that only read positions, like depth or shadows. Profile before changing the layout.

For modern GPUs interleaving is often more harmful than useful.

Stick with uninterleaved for most things.

Separate buffers are the right default here, and the extra setVertexBuffer calls are rarely what shows up in a profile. A pass that only needs positions, such as a depth pre-pass, then fetches just that stream instead of pulling normals and UVs along with it. Keep them separate when one attribute changes every frame too, so you are not rewriting the static channels. Interleave only after a capture shows vertex-fetch bandwidth as the limit, and keep each attribute offset 4-byte aligned so the vertex layout stays valid.