Archived

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

ID3DXFont::DrawText = FPS drop 400 -> 275?!?!

This topic is 5060 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I''m using ID3DXFont::DrawText method to display some text in my game, but it seems to have a huge performance hit. What i am using it for is displaying the number of frames per second. I also used an external program (FRAPS) to monitor the FPS of my game so i could see what the difference was when i switch it on and off... I was amazed by the results, it seems that my FPS without drawing the font is 400. While when i switch the font back on it, i get an FPS of 275.. I am sure its the ID3DXFont::DrawText, because i commented out that line alone, leaving all the fps calculation in there even know it wasn''t being displayed. Has anybody else noticed this? what gives? Would i be better off writing my own class to draw fonts from bitmaps?

Share on other sites
quote:
Original post by SpaceDude
I''m using ID3DXFont::DrawText method to display some text in my game, but it seems to have a huge performance hit. What i am using it for is displaying the number of frames per second. I also used an external program (FRAPS) to monitor the FPS of my game so i could see what the difference was when i switch it on and off...

I was amazed by the results, it seems that my FPS without drawing the font is 400. While when i switch the font back on it, i get an FPS of 275.. I am sure its the ID3DXFont::DrawText, because i commented out that line alone, leaving all the fps calculation in there even know it wasn''t being displayed.

That doesn''t mean much. FPS is not linear. You go from 2.5 ms per frame to 3.8 ms. If that''s just overhead that happens once it''s no big deal.
If you go from 100 to 90 fps you''re inclined to say it''s a small decrease in speed. But then you go from 10 ms to 11 ms per frame, almost the same.

Share on other sites
Which version of DX are you using? 8 or 9? I ask because the DX8 version of ID3DXFont was incredibly and unusably slow. It''s a lot faster now (and great and easy to use) in DX9.

Dustin Franklin
Mircrosoft DirectX MVP

Share on other sites
quote:
Original post by circlesoft
Which version of DX are you using? 8 or 9? I ask because the DX8 version of ID3DXFont was incredibly and unusably slow. It''s a lot faster now (and great and easy to use) in DX9 Summer Update version

| TripleBuffer Software |
| Plug-in Manager :: System Information Class :: C++ Debug Kit :: DirectX Tutorials :: Awesome Books |

Share on other sites
Make sure you have the Directx 9 Summer Update too, ID3DXFont was improved in that update.

Share on other sites
@IFooBar:
maybe you should try making your posts less subtle

@Jingo:
that''s what IFooBar said

@SpaceDude:
circlesoft is correct, frames per second is NOT a good way of determining your application speed at-a-glance. I find it much more useful to output milliseconds taken (or in my case, microseconds) per frame, which is a much easier to use benchmark.

Chris Pergrossi
My Realm | "Good Morning, Dave"

Share on other sites
are they still planning on removing CD3DFONT? I heard they were.

Share on other sites
I''m using DirectX 9, i''m not sure about the summer update though... I''m at work now, i''ll check when i get home... thanks!

PS: FrameTime = 1/FPS, so doesn''t really matter what u use as long as u know what it is. Even a drop from 100 fps to 90 fps is ridiculous just for displaying some text.

Share on other sites
Well if you have the summer update you can use
ID3DXFont::PreloadCharacters, ID3DXFont::PreloadText or ID3DXFont::PreloadGlyphs
to increase the framerate quite a lot. I had the same problem with the framerate, it was taking up something like 30% of the execution time to draw the fps counter. Its less than 1% now.

quote:
Original post by c t o a n
@Jingo:
that's what IFooBar said

My mistake

[edited by - Jingo on March 18, 2004 9:14:37 AM]

Share on other sites
quote:
Original post by SpaceDude
I''m using DirectX 9, i''m not sure about the summer update though... I''m at work now, i''ll check when i get home... thanks!

PS: FrameTime = 1/FPS, so doesn''t really matter what u use as long as u know what it is. Even a drop from 100 fps to 90 fps is ridiculous just for displaying some text.

Considering the work it does, it''s actually pretty reasonable. D3DXFont is a high quality text renderer. If you want to favour speed over quality, then it isn''t a good choice for you.

D3DFont (in the Common directory of the SDK) should be faster while still having decent output quality.

Stay Casual,

Ken
Drunken Hyena

Share on other sites
Ok cool... i installed the summer update, and my fps is now around 415 with drawing the font, and 420 without... so i''ve actually gained some FPS overall... thanks guys

Share on other sites
Here''s a possibly stupid question...

I''m currently using DX8.something with my engine. If I install the DX9 SDK, but keep everything the same, will D3DXFont be the version 9 or 8 one??

quote:
Original post by circlesoft
Which version of DX are you using? 8 or 9? I ask because the DX8 version of ID3DXFont was incredibly and unusably slow. It''s a lot faster now (and great and easy to use) in DX9.

<a href=''http://www.circlesoft.mjpba.com/''><img src=''http://www.circlesoft.mjpba.com/images/archibald_100.jpg'' border=''0''></a> <a href=''http://www.gdod.mjpba.com/''><img src=''http://www.circlesoft.mjpba.com/images/gdod.jpg'' border=''0''></a>
<a href=''http://www.circlesoft.mjpba.com/''><font size="1" color="#FFFFFF">Dustin Franklin </font></a>
<font size="1">Mircrosoft DirectX MVP</font>

Share on other sites
quote:
Original post by Anonymous Poster
I''m currently using DX8.something with my engine. If I install the DX9 SDK, but keep everything the same, will D3DXFont be the version 9 or 8 one??
IIRC, it totally depends on the headers you use and the libs you link against.

D3DXFont version 8
==================
- Lib d3dx8.lib

D3DXFont version 9
==================
- Lib d3dx9.lib

I think that may be how it works...

Share on other sites
It''ll depend on which header/lib you use. The Font API changed in the summer update, so just ramping up the D3DX version won''t cut it.

I like pie.