I would like to attempt to implement this feature request 
(https://bugs.freepascal.org/view.php?id=34031 for my boss) which has the 
SetLength intrinsic return aligned memory. We need this for the Metal framework 
which requires all vertex buffer memory to aligned on 4k boundaries so we can’t 
use dynamic arrays in their current form (see the bug report for example code).

I’ve looked at the dynamic array implementation (dynarr.inc) and it appears 
that I could over allocate and extend the header (tdynarray) to include an 
extra field which stores the amount of padding until the actual array elements 
start (which is aligned). It would complicit the code to some extent however 
because the current design relies on lots of pointer math.

Is this ok that I add this? Marco said in the comments there was a need so I 
assume this is a go but I wanted to ask first.

Regards,
        Ryan Joseph

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to