IT Crowd TV series - famous and funny quote when Jan says not to talk about memory or ram - and Moss laughs and jokes that ram is memory. Jan is head of IT - but has no idea how computers work.
Memory Array - Alignment Buffers and Pains
Going to talk about memory and how it isn't always what you think it is! Especially for long sequential blocks of data!
For example the below implementation copies from
array0
to
array1
! What could be simplier? Both are just an array of floats. However, in WGSL the
array1
is stored as
array< vec3<f32> >
- which is common as you might want to group every 3 values as positions or vectors (x,y,z) - but what you might not be aware of is how it's stored in memory on the GPU!!
As the
vec3<f32>
is a structure - so all structures are aligned to 16 byte boundaries!