[SDL] Does SDL support MMX?

sure yes yessure1 at gmail.com
Thu Mar 20 00:11:25 PDT 2008


 I am sure SDL supports MMX ,untill I found the following codes:

In src/stdlib/SDL_string.c:
void *SDL_memcpy(void *dst, const void *src, size_t len)
{
    char *srcp = (char *)src;
    char *dstp = (char *)dst;
    while ( len-- ) {
        *dstp++ = *srcp++;
    }
    return dst;
}
it seems byte to byte copy.
Then in src/video/SDL_blit.c:

#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) &&
SDL_ASSEMBLY_ROUTINES
#define MMX_ASMBLIT
#if (__GNUC__ > 2)  /* SSE instructions aren't in GCC 2. */
#define SSE_ASMBLIT
#endif
#endif

So,in Microsoft's VS, MMX_ASMBLIT and SSE_ASMBLIT are undefined.
Then , static void SDL_BlitCopy(SDL_BlitInfo *info) likes as:

static void SDL_BlitCopy(SDL_BlitInfo *info)
{

 Uint8 *src, *dst;
 int w, h;
 int srcskip, dstskip;

 w = info->d_width*info->dst->BytesPerPixel;
 h = info->d_height;
 src = info->s_pixels;
 dst = info->d_pixels;
 srcskip = w+info->s_skip;
 dstskip = w+info->d_skip;
 while ( h-- ) {
  SDL_memcpy(dst, src, w);
  src += srcskip;
  dst += dstskip;
 }
}

That is say,In WIN32,SDL_blitsurface doesn't use MMX/SSE,even more, copy the
data byte to byte?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20080320/d38dcd1c/attachment.htm 


More information about the SDL mailing list