Closed reczkok closed 1 week ago
I am wondering if we could simplify this fix by always allocating a buffer rounded up to the alignment of the data-type. This would remove the need to check if the type we are writing to is a primitive, but would allocate more memory than necessary in some cases.
The only case when this would make a difference is when we have a buffer of just vec3
. I don't think this would be a big deal but this would also mean our vec3
buffers are not the same size as WebGPU's. I think this could lead to some migration bugs.
What if we always create buffers that are aligned, but write the minimum amount of bytes (unaligned). This should cover the case of any existing WebGPU buffer, and our own allocations. Would this raise any WebGPU errors?
I don't think there would be any errors. Both writeBuffer()
and copyBufferToBuffer()
let us specify the size in bytes so there should be no problem with that.
Description in #307
closes #307