Error: GPUValidationError – buffer size not aligned to minUniformBufferOffsetAlignment
23K reputation · 04 Nov 2023, 08:07 UTC
Updating Uniform Buffers Without Pipeline Stalls
Goal: replace uniform buffer data in a running WebGPU application while the GPU continues executing existing command buffers, avoiding any visible frame drop or downtime.
Constraint: WebGPU requires that the offset and size of a GPUBuffer used as UNIFORM satisfy the device’s minUniformBufferOffsetAlignment limit, and the validation layer will reject a GPUBindGroup if the buffer range is misaligned.
Uncertainty: when mapping a buffer with GPUMapWrite and writing new data, it is unclear whether the validation occurs at map time, at bind group creation, or at command submission, and how to guarantee alignment across different hardware vendors.
- At which pipeline stage does WebGPU validate uniform buffer alignment for a buffer that is updated via
MAP_WRITE? - What is the recommended method to compute padding that satisfies the strictest
minUniformBufferOffsetAlignmentacross all target devices?