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?
#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
MMmh that’s strange MMX_ASMBLIT abilitation in SDL_Blit was enabled with
this line in older versions:
#if (defined(i386) || defined(x86_64)) && defined(GNUC) &&
defined(USE_ASMBLIT)
#define MMX_ASMBLIT
#endif
Anyway I think the version of SDL shipped in libsdl.org is built with
mingw32, so the only users that will have a fallback blit are the ones that
compile SDL themselves with visual studio.
Anyway I’m not sure that SDL_Blit.c is the module called in the usual
SDL_BlitSurface() operations, it’s a fallback module that I think is used
only for very basic ports, anyway the bytecopying memcpy it’s scaring in a
32bit world soon to be 64 :)–
Bye,
Gabry
Anyway I’m not sure that SDL_Blit.c is the module called in the usual
SDL_BlitSurface() operations, it’s a fallback module that I think is
used only for very basic ports, anyway the bytecopying memcpy it’s
scaring in a 32bit world soon to be 64
One thought that occurs is that MMX support is not necessarily going to
be enough in the future. From what I understand Intel will be dropping
MMX upon the release of CPUs supporting SSE4.1 so any support for
integer SIMD is going to have to be SSE2 at a minimum.On Fri, 2008-03-21 at 18:08 +0100, Gabriele Greco wrote:
Copy addresses and emails from any email account to Yahoo! Mail - quick, easy and free. http://uk.docs.yahoo.com/trueswitch2.html