Martin Konrad wrote:
The strange thing is that when I only
use about 5 blits, everything is fine, ie. the blits take almost no
time at all, and SDL_Flip() is waiting about 1/60 second for sync.
But when I do about 20 blits, the first blit takes 1/60 second, the
other blits and SDL_Flip() take almost no time. When I use fills
instead of blits, the same problem happens.
Maybe you’re reaching a driver or hardware-specific limit on the number
of blits or operations that can be queued for asynchronous execution?
Do you know a good way of handling the many blits then?
I’m not sure if the many blits are the real problem, because the other
programs that run too slow don’t do that many blits.
Have you tried doing 40 blits, or 60, to see if the performance degrades
further? It might be a one-time penalty that you pay for more than N
blits that won’t prove significant when a lot more blits are being done.
The weird part of what you’ve said is that you’ve implied that the 1st
blit can take longer in the 20-blit version even before the code 'knows’
that there are more than 5 blits in total. If it only applies to the 2nd
frame and so on, it would make more sense.
I tried the program a bit more, and unfortunately I must admit that I wrote
something wrong about the numbers. But, the numbers I got recently were even
more strange. And there’s a difference betwenn fill and blit numbers.
The main loop currently looks like this:
for (int i = 0; i < 200; i++) {
int t1, t2, ta, tb;
for (int j = 0; j < 10; j++) {
ta = SDL_GetTicks();
SDL_FillRect(screen, 0, 0xABCD);
/*SDL_BlitSurface(srfc1, 0, screen, 0);
SDL_BlitSurface(srfc1, 0, screen, 0);
SDL_BlitSurface(srfc1, 0, screen, 0);
SDL_BlitSurface(srfc1, 0, screen, 0);*/
tb = SDL_GetTicks();
printf("blit: %3d\n", tb - ta);
}
t1 = SDL_GetTicks();
SDL_Flip(screen);
t2 = SDL_GetTicks();
printf("flip: %3d\n----------\n", t2-t1);
}
(At the beginning of the program I’m switching to high priority.)
srfc1 is a 16 bit hw-surface with a size of 64x64 pixels.
But even if this program can’t put out any values that say something
correct, why are my programs running too slow on XP? They run much slower than on
Win98.–
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr f?r 1 ct/ Min. surfen!