One fullscreen blit in 800x600x32 -> 20 fps :(

Started by
23 comments, last by Astral 23 years, 9 months ago
from 0,0 to 800,600 goes a length of 801,601 pixels.
You are supposed to make your rects 0,0 to width,height of the screen wich is in itself one pixel more than the screen(surface, whatever) so the correct rects are 0,0,800,600
The idea is that the last line and column do not belong to the surface(and to allow the computing of width and height with only one subtraction)

By the way, I think BltFast will also use acceleration, it will just be faster than Blt if there isn't any availlable.

You might want to check how long the blitting to the backbuffer and the Flip itself take (The Flip can be conditioned by the refresh rate, but at 30 fps that shouldn't have much weight.)

Edited by - alexmoura on June 28, 2000 3:55:40 PM
Advertisement
So if you pass it a 0,0,799,599 rect it'll stretch it by one pixel hence killing performance? Damn.
Seems like a weird way to pass dimensions (good - the point about fast dimension calcs is a good one - but unexpected), and at the very least the SDK ought to mention this point seeing as most people will give it a 0,0,799,599 rect seeing as that's the pixels on the screen.

p.s. - BltFast does use hardware acceleration. So does Blt. Both only use it on vidmem->vidmem blts. If a system memory surface is involved in any way, the blt gets handled by the CPU instead of the video hardware.

p.p.s. - I noticed on the first post that Astral's app uses the same background image every frame. Astral, if your background doesn't change, there's no need to redraw it every frame anyways. Are you familiar with the concept of "dirty squares"? It basically involves only updating the area directly around your sprites each frame instead of erasing the entire screen... I'm sure there's a tutorial on it somewhere (it's also called "dirty rectangles", "dirty blitting", "smart blitting", "smart refresh" or something like that.), but I don't have a url for ya. Sorry.

Edited by - PyroBoy on June 28, 2000 8:23:53 PM
Just a little info I thought I''d post.

A while back I did some quick little performance tests. Basically I made up a "screen" on an system memory surface, then copied it myself onto the back buffer. I tested this at most resolutions, but at 800x600x32 I got 31 fps or so. Noticing this I think your offscreen surfaces are not in vid-mem for some reason...

-Zims
quote:Original post by PyroBoy
... the SDK ought to mention this point seeing as most people will give it a 0,0,799,599 rect seeing as that''s the pixels on the screen.


quote:the SDK
[DestRect is] Address of a RECT structure that defines the upper-left and lower-right points of the rectangle to blit to on the destination surface...


A common mistake, points aren''t really pixels.
If you specified 800x600 as the right and bottom, it would fill everthing from 0 through just-less-than-the-800th pixel and same for height. (point 0,0 is before the pixel at 0, 0).
here is point 0,0
/
\/
O ---- 0
/pixel@/
/__0x0_/
0______0 <- is point 1,1
___________________________Freeware development:ruinedsoft.com
Hmm yes sorry, it''s a mistake. (0,0) to (800,600), not to (801,601) as i said (and not (799,599)). The dimensions of your rect should be (width+1,height+1).

Y.

This topic is closed to new replies.

Advertisement