PDA

View Full Version : float vs. double forms of OpenGL functions



Rob
03-24-2000, 08:33 AM
Is there any speed hit associated with using the double version of the OpenGL functions, as compared to the float version? i.e. is glVertex3f better/faster to use than glVertex3d?

Humus
03-25-2000, 01:51 AM
Well, double consumes twice the memory bandwidth and can't be used with SIMD extensions like 3dnow or sse since they only operate on singleprecision data.
Double also take longer time to do calculations with, especially divisions and squareroots.

dmy
03-25-2000, 02:50 AM
i have made some tests on G200 and TNT, and i found that the float versions are faster.

on the NV10 i don't know.

Dolo/\/\ightY

Eric
03-27-2000, 01:23 AM
I have recently changed the way I used my compiled vertex arrays (i.e. changed from double to float) on my ELSA Erazor X2 (GeForce DDR).

So the answer is : yes, it's much faster !

Eric

lgrosshennig
03-29-2000, 12:55 PM
Hi there!

I'm back again http://www.opengl.org/discussion_boards/ubb/smile.gif

You should use floats there are ton's faster.

Here are the reason:

1. With floats the cpu can cache twice the amount of data in the 1st and 2sec level cache.
2. the cpu only has to transmit only halfe of the data via the PCI/AGP port to the gfx card
3. there is a MAJOR BUG in Win95/98 (at least I call it a BUG)! Win95/98 allocates memory only 4 byte aligned witch gives you a 3 clock penalty for each access (on intel machines, 1 clock on AMD) Check it out!!!

By the way. Internally the Cpu works with double values by default. that means it internaly converts a float into a double, performs the operation and stores the result
as a float (this behaviour can be changed via some cpu intructions, like DirectX does it to gain some extra speed).

Oh, while we are at it (this is off topic I know) Intel cpu's are using the floatingpoint pipeline to perform INTEGER multiplications and divisions (AMD does not)