LPD3DXFONT is slow

Started by
9 comments, last by Hassanbasil 14 years, 1 month ago
Hello everyone, Using LPD3DXFONT is really slow that i lose over 700 FPS when i use it, is there any other method for drawing text? i tried CD3DFont but it gives even worse results ( over 1900 FPS loss.. )
Advertisement
FPS is a meaningless number. If you loose 700 FPS and go from 2000 FPS to 1300 FPS, that's a microscopic performance difference. If you lose 700 FSP going from 701 FPS to 1 FPS, that's a huge difference.

Exactly how much of a difference does it make? How much text are you drawing? Can we see your code?
from 2000 to 1300, how can it be "meaningless", when its about 35% loss?, here's some code:

                //text drawing method                char FPS[50];		float fps = myCore->GetFPS ( );		sprintf_s ( FPS, 20, "hasX engine\nFPS : %d", (int)fps );		myCore->DrawText ( 10, 10, FPS, 255, 175, 75, 225, 0 );                //render                RECT rect;		rect.top = TextV.y;		rect.left = TextV.x;		TEXTMETRICA met;		TextV.font->GetTextMetricsA ( &met );		rect.right = rect.left + ( met.tmHeight*strlen ( TextV.Text ) ) + 10;		rect.bottom = rect.top + ( ( met.tmHeight + 2 ) * numLines ) + 10;		TextV.font->DrawTextA ( NULL, TextV.Text, strlen ( TextV.Text ), &rect, DT_NOCLIP, TextV.color );
2000 FPS is 0.5ms per frame
1300 FPS is 0.77ms per frame

That's a difference of 0.27ms per frame, which is nothing - and there'll be too much background noise for that to be remotely accurate. You need to put more load on the system before you can profile

If you're drawing multiple lines of text, you can get better performance by specifying a sprite for the first parameter to DrawText() (And use the same sprite for all draw calls).
Quote:Original post by Evil Steve
If you're drawing multiple lines of text, you can get better performance by specifying a sprite for the first parameter to DrawText() (And use the same sprite for all draw calls).


well, i get the same FPS whether writing 1 line or 10 lines, so i think its not a "noticeable" performance improve

Quote:Original post by Evil Steve
2000 FPS is 0.5ms per frame
1300 FPS is 0.77ms per frame

That's a difference of 0.27ms per frame, which is nothing


i see, thank you for the reply.
Quote:Original post by Hassanbasil
Quote:Original post by Evil Steve
If you're drawing multiple lines of text, you can get better performance by specifying a sprite for the first parameter to DrawText() (And use the same sprite for all draw calls).


well, i get the same FPS whether writing 1 line or 10 lines, so i think its not a "noticeable" performance improve
Maybe not at the moment, but as you add more to your engine and it becomes CPU bound, that could gain you some FPS.
Quote:Original post by Evil Steve
Quote:Original post by Hassanbasil
Quote:Original post by Evil Steve
If you're drawing multiple lines of text, you can get better performance by specifying a sprite for the first parameter to DrawText() (And use the same sprite for all draw calls).


well, i get the same FPS whether writing 1 line or 10 lines, so i think its not a "noticeable" performance improve
Maybe not at the moment, but as you add more to your engine and it becomes CPU bound, that could gain you some FPS.


I see, i shall try that when i go into sprites
Quote:( over 1900 FPS loss.. )


Just a little note, although E.S.'s answer is really comprehensive:
Seems you're having really HUGE FPS which means your application is doing/drawing almost nothing (or really nothing?). You cannot wonder that when you add something, your FPS drops a lot ;)
Quote:
from 2000 to 1300, how can it be "meaningless", when its about 35% loss?, here's some code:

While I would disagree that FPS is a "meaningless" number, it is mostly-useless as a performance metric because it is a nonlinear measurement.
Does your app actually do anything yet? I don't think I've seen 2000 fps on app doing nothing and drawing a blank screen.

This topic is closed to new replies.

Advertisement