Floating Point Mode

Get answers to all your basic programming questions. No Ogre questions, please!
jeckil
Gnoblar
Posts: 9
Joined: Mon Feb 09, 2004 6:32 am
Location: Mexico City

Floating Point Mode

Post by jeckil »

Hello all, its been a while since I visited the site, Looking good 1.0.0 release! thank you sinbad & crew for such a great resource for the independent developer.

My question is that i noticed a 'Floating Point Mode' Menu now on the ogre launcher? can someone explain what is that for and the differences between Consistent Fastest?

Thanks

P.S. if there was a post about this i apologize, plese link me to the thread thanks
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

DirectX, by default, switches the floating point unit to single precision (32 bit) mode for your entire program. This means that operations on doubles will not be done in 64 bit precision but 32 bit. It might also give other stability issues with physics packages.
Consistent mode fixes this by switching the precision before and after D3D calls. Microsoft says this can harm performance but testing using the Ogre demos didn't find any difference in speed.
User avatar
Goosey
Halfling
Posts: 88
Joined: Wed Sep 29, 2004 3:33 am
Location: Ohio, USA

Post by Goosey »

I ran through some of the demo's with both floating point modes and let each one run for about 5 minutes without touching mouse.

My results were that on average consistant mode had about 4% lower average framerate. So certainly not a huge performance hit, but it is measurable.

The demos I tested: Demo_Grass, Demo_Shadows, Demo_VolumeTex, and Demo_Water. All fullscreen, 1024x768x32, vsync off, anti aliasing: none. I have an ATI Radeon9800XT with latest drivers, and an Athlon64 2800 processor.

How much does OGRE (ignoring any possible 3rd party packages) benefit from consistant mode?
I <3 the OGRE Wiki, and SO SHOULD YOU! :)
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

Except for Demo_VolumeTex the demos you tested make heavy use of floating point aritmetic, not D3D calls. This makes it not strange you got a fps increase, as the FPU is cheating in your own program as well. In this case, it's not the FPU precision switching that causes the loss.

You should test on the D3D bound demos that don't use much floating point math themselves but stress the card (DynTex, CelShading, Fresnel).

OGRE itself doesn't care about the lost precision, only when you're doing things like physics (that need the precision) it matters.
User avatar
Goosey
Halfling
Posts: 88
Joined: Wed Sep 29, 2004 3:33 am
Location: Ohio, USA

Post by Goosey »

I tried those 3 Demos wumpus, results are as you were predicting. Nearly identical framerate between fastest/consistant, with about 0.41% higher performance in fastest (really, this was only detectable in Demo_CelShading because the super-high framerate made the distinction more visable. But we are splitting hairs between an average of 1225 and 1220).

So I guess the conclusion is to not be afraid to use Consistant by default, unless you are doing a large amount of FPU operations (like some of my original tests)?
I <3 the OGRE Wiki, and SO SHOULD YOU! :)