Generating WebGPU Buffer Offsets

WebGPU buffers have strict data type alignment rules to ensure the best shader performance. This web page makes it easy for you to compute the required buffer offsets and buffer size for your needs. Copy and paste a WGSL struct to the text input box below to see the results further down. Note: this page does not currently support WGSL arrays and the use of application defined types, e.g. declared with a separate struct.

wgsl Struct:

Offsets and buffer size: