Drawing debug text has big impact on FPS

Blitz3D Forums/Blitz3D Beginners Area/Drawing debug text has big impact on FPS

Dax Trajero(Posted 2005) [#1]
I have debug information that can be toggled with the F1 key.

When debug is on, I use the TEXT command to display all my debug variables on screen.

This seems to have a BIG effect on FPS.

Is this normal ?


Shambler(Posted 2005) [#2]
Yes, the built in text command is for debug purposes only, you wouldn't use it in a released game.

Your alternatives are to look in the code archives for code which uses a quad mesh to display text etc. or use something like spritecandy or Fontext.


big10p(Posted 2005) [#3]
I've never noticed a huge speed hit using Text, myself. It seems to be driver related, mostly.

How big a difference are you getting, Dax? What is the FPS with and without Text displayed?


Dax Trajero(Posted 2005) [#4]
300 fps debug on
2000 fps debug off


big10p(Posted 2005) [#5]
Holy shizzle! That is a big difference. What GFX card have you got?


WolRon(Posted 2005) [#6]
You might want to check out my Tutorial website on Speed Tips (it's far from finished but it's a start)


Beaker(Posted 2005) [#7]
Fontext link is in my sig (or in Toolbox on this site).


Dax Trajero(Posted 2005) [#8]
big10p,

I use a Radeon 9800 Pro

the botleneck must be elsewhere in the code I guess - based on your reaction!

Wolron, thanks - will check it out.


big10p(Posted 2005) [#9]
the botleneck must be elsewhere in the code I guess - based on your reaction!
Not neccessarily. It seems the newer GFX cards are more prone to slowdowns with Text as they're geared almost exclusively to accelerating 3d. My aging GF 256 and GF2 GTS cards seem to cope with it quite well.


tonyg(Posted 2005) [#10]
I have a 9800Pro and text commands hardly have any effect on speed.
You might be right that it's something else taking the time.
2700+, 1G RAM, 9800Pro


BlackD(Posted 2005) [#11]
have a 9800Pro and text commands hardly have any effect on speed.

Are you using FLIP or FLIP FALSE? With FLIP, no - you won't noticed much difference as it can easily do it at 60fps. However, with FLIP FALSE, you'll notice framerates drop dramatically with text (or any 2D - but mainly text) on-screen.

It seems the newer GFX cards are more prone to slowdowns with Text as they're geared almost exclusively to accelerating 3d.

With pixel-perfect sprites like the Pixies system or Sprite Control, there's no reason to use 2D graphics commands in 3D at all. I avoid 2D graphics completely now, as mixing 2D/3D has too high a variance on different systems to be worth taking the time to factor in.

+BlackD


Dax Trajero(Posted 2005) [#12]
BlackD

I originally used delta time, but reverted back to
VWAIT FLIP:FALSE for some reason

Why is it FLIP FALSE has such an impact on TEXT ?

I've never heard of Pixies or Sprite Control - what are they?

So far the game I'm writing, a retro 80's arcade game, doesn't have much cpu overhead. Its all fairly simple - 2D sprite collision, background collision, etc...


BlackD(Posted 2005) [#13]
well - it isn't FLIP FALSE that has the impact. Basically, with FLIP FALSE (and no text) you can expect a good 1000 or so FPS. With FLIP, it waits for vsync then FLIPs, so your FPS is limited to 60 (or whatever you've got max refresh set to). So, text takes lots of drawing time - however, when FLIPing with vsync on - you won't notice this impact the framerate as it's happening far faster than the vsync does. With FLIP FALSE, you'll notice it simply because it FLIPs as soon as it can, rather than waiting for vsync. Since text takes a few extra milliseconds to render - this makes the difference.

+BlackD


Dax Trajero(Posted 2005) [#14]
Question - Is the CPU flagged whenever there's a vertical blank / retrace ?


big10p(Posted 2005) [#15]
From the docs:

VWait [frames]
Note that this command is different to the vertical blank waiting mechanism in Flip because Flip will cause the graphics card (as opposed to the CPU) to wait for the next vertical blank. The vertical blank can be disabled on some graphics cards, hence it is quite common to use "VWait : Flip False" to ensure consistent updates on all setups.


For some reason, using "VWait : Flip False" on my PC is giving jittery scolling and doesn't seem to be waiting for the vertical blanking signal properly - I can see tearing. It used to work great so I've no idea what's going on. :/


Shifty Geezer(Posted 2005) [#16]
I originally used delta time, but reverted back to
VWAIT FLIP:FALSE for some reason

Why is it FLIP FALSE has such an impact on TEXT ?

I've never heard of Pixies or Sprite Control - what are they?

Pixies are quads with a texture aligned perfectly with screen pixels
[url]http://www.blitzbasic.com/codearcs/codearcs.php?code=773[/url]
If you use text commands on the texture buffer of a quad (SetBuffer TextureBuffer() : Text 0,0,"woohoo" : SetBuffer BackBuffer()) can you write the text only once and display it every frame on the sprite (or pixie as Skidracer called it).

If you don't use Pixies you get a fuzzyness on the texture.

You can also use camera tricks to set up Pixies to map 1 to 1 to screen coordinates, so you can basically have a large textured sprite and draw on that instead of to the screen.