Re: [AD] SSE2 vs malloc()

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]




2005/10/15, Chris <chris.kcat@xxxxxxxxxx>:
On Saturday 15 October 2005 02:28 am, aj wrote:
> You would not be doing SSE2 instructions on video bitmaps, it makes no
> sense to do so.

Depends on what you're doing. As I understand it, for properly implemented
systems, when you lock a bitmap the system gives you a pointer to the VRAM
data to do with what you need (write to it, read from it, whichever). You
can't gaurantee the alignment of that pointer.

Also, it's worth pointing out, that bitmaps are aligned per pixel. Since SSE2
uses 16-byte alignment, that means someone grabbing pixel 2 through 15 of an
8-bit bitmap is grabbing unaligned data.

Part of me thinks the compiler is smart enough to not handle pointer variables
using SSE2 for this very reason.. because it can't know if it's aligned or
not. Instead, it would do this for global or local variables where it can
predetermine the memory address, and it will know where it's aligned and safe
to use SSE2 instructions on.

I think it is possible to use unaligned data with SSE2 too, at least Intel manuals wrote something about that. Only problem is that it is considerably slower than aligned pointers would be.




--
Kalle Last

Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/