this may be stupid, but I really don’t understand it…
In a windowed mode program I have two surfaces (the screen surface and a
backbuffer). Both surfaces are in system memory, and have the same color
depth, pixel format and size, and no alpha component or color keys.
The problem is that a simple backbuffer-to-screen blit like
SDL_BlitSurface (backbuffer, NULL, screen, NULL)
is very slow (it takes about 45ms with 800x600 surfaces at 16bpp).
However, if I use
memcpy (screen->pixels, backbuffer->pixels, screen->pitch*screen->h)
instead of SDL_BlitSurface() it’s much faster (takes about 8ms).
Is there a reason why SDL_BlitSurface() is so slow?
I’m using SDL-1.2.0 on Linux with XFree86-4.0.3, BTW.
Oops, it was a simple and stupid typo in my code :-*
(Rmask and Amask look quite similar… the pixel formats of the two surfaces
were actually different)
Now SDL_BlitSurface() is almost as fast as memcpy().
Sorry for bothering you,
DominicOn Saturday 26 May 2001 00:47, I wrote:
In a windowed mode program I have two surfaces (the screen surface and a
backbuffer). Both surfaces are in system memory, and have the same color
depth, pixel format and size, and no alpha component or color keys.
The problem is that a simple backbuffer-to-screen blit like
SDL_BlitSurface (backbuffer, NULL, screen, NULL)
is very slow (it takes about 45ms with 800x600 surfaces at 16bpp).
However, if I use
memcpy (screen->pixels, backbuffer->pixels, screen->pitch*screen->h)
instead of SDL_BlitSurface() it’s much faster (takes about 8ms).
Now SDL_BlitSurface() is almost as fast as memcpy().
note that it isn’t necessarily safe to copy pitch * height bytes all at once,
since something else might be stored at the end of each line. That’s why
the SDL code does one memcpy (of width * format->BytesPerPixel) per line
In a windowed mode program I have two surfaces (the screen surface and a
backbuffer). Both surfaces are in system memory, and have the same color
depth, pixel format and size, and no alpha component or color keys.
The problem is that a simple backbuffer-to-screen blit like
SDL_BlitSurface (backbuffer, NULL, screen, NULL)
is very slow (it takes about 45ms with 800x600 surfaces at 16bpp).
However, if I use
memcpy (screen->pixels, backbuffer->pixels, screen->pitch*screen->h)
instead of SDL_BlitSurface() it’s much faster (takes about 8ms).
Oops, it was a simple and stupid typo in my code :-*
(Rmask and Amask look quite similar… the pixel formats of the two
surfaces
were actually different)
Now SDL_BlitSurface() is almost as fast as memcpy().
Waitaminute… What IS the correct Amask and Rmask (and Gmask and Bmask) to
make it go fast?_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com