Archived

This topic is now archived and is closed to further replies.

crazemanx

Speed of DirectDraw clipper

Recommended Posts

I have a clipper set to my whole back buffer surface and am using Blt to copy various sprites onto is. This may sound silly but is there any reason why I shouldnt do this, and clip the sprites myself? Is there a speed penalty that comes from using the clipper for all my Blt operations?

Share this post


Link to post
Share on other sites
Um, yes and no.

Yes - there is a speed penalty. Each pixel must be tested against the bounds of the clip rectangle - so that''s 4 cmp/jmps right there.

No - you probably won''t gain any speed by doing it yourself. Sure, check that the sprite isn''t completely off the screen, but leave the pixel-by-pixel stuff to DirectX. I hate to say it, but the guys and girls at M$ probably know what they''re doing.

Superpig
- saving pigs from untimely fates

Share this post


Link to post
Share on other sites
well, you never know ...

i agree that the people at microsoft probably know what they are doing, but its not absolute that their code is the fastest in every situation.

why not create your own clipper, and then compare timings for both? perhaps you will learn a little more about graphics (clipping in this case), and who knows, you might be able to implement a faster function given that you know more about your game then microsoft does.

( example: ) microsofts code may indeed be fast, but you may be able to make a faster function because you have more information about how your game is setup and runs. a classic example is i guess a fps like doom. because of how they set up their worlds, and what they knew about movement in the world, they were able to do things quite faster than a true 3D world (level).

just some thoughts. :-)

- jeremiah
http://fakemind.com

Edited by - fakemind on November 15, 2001 2:09:00 PM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The clipper will just resize the sprites, so only the rectangles are clipped. This is not done pixel-by-pixel.
So it''s not much of a speedhit. And for DirectX transformed vertices (that would be DX Graphics, or DX8, where you don''t have the Blt anymore) you need to do the clipping yourself anyway...

Share this post


Link to post
Share on other sites
One word: Profile. I''ve never experienced a problem with the DD clipper. They may cause a slow down if you are blittin hundreds of sprite, I don''t know. But rgardless, your game, my game, and his game are all different and the clipper may or may not affect the frame rate. The only way to be sure is to porfile with a DD clippper, then your own, and comp the results. If your framerate is acceptable (i.e., smooth) then don''t evrn worry about profiling.

Share this post


Link to post
Share on other sites