[Liboil] Packed data formats.
ds at schleef.org
Sat May 12 12:55:13 PDT 2007
On Thu, May 10, 2007 at 02:03:50PM +0100, Robert Scott wrote:
> Hi all,
> I was wondering what peoples attitudes were to adding functions for dealing
> with packed/interleaved data formats to liboil.
> Of course, I understand that this effectively doubles alignment issues (in
> some cases, quadruples them), but the reason I ask is that I've been working
> recently with a few libraries that are very keen on their interleaved data
> and, naturally, I've been building a few SIMD inner loops for dealing with
> The two examples I'll cite are fftw, which interleaves its real and imaginary
> data*, and opengl's vertex arrays and vertex buffer objects, which deals with
> interleaved vertex coordinates.
> For these two reasons alone, I'd argue that it would be good to include at
> least a few conversion/packing/unpacking routines in liboil.
> Thoughts? Is this wanted/not wanted?
Interleaved data is fine, especially for things like complex numbers
or 4-vectors. It's not really any different than ARGB pixels, which
are already supported.
At some point, liboil will probably grow some extra types specifically
for the simpler versions of interleaved data. It already has a
pseudo-type internally for ARGB u8 pixels.
The alignment issue isn't too complicated. You either allow or
disallow unaligned units. Functions operating on ARGB pixels require
4-byte alignment. The simple solution is to require 16-byte alignment
for f32 4-vectors (for example), perhaps only required for destination
arrays (since unaligned reads are less expensive). Additonal functions
could always be added later for unaligned processing.
More information about the Liboil