PDA

View Full Version : double precision (glDouble) useful at all or not?



felpy
12-08-2009, 01:15 PM
Does working with GLdoubles improve precision at all?

I've been having precision problems (jitter in vertex positions as well as quarted textures) and thought of switching everything to doubles.

After a couple tests I quickly found it was twice as slow, but then I started googling about it and what I found confused me:

Some people talk about using doubles being totally useless since everything is converted back to single precision when sent to the graphics card.

Some other talk about opengl switching to "sofware rendering", saying it was slower, and though they said nothing about it, you can deduct the precision was effectively improved.

So, does using glDoubles work at all?

Frodak
12-09-2009, 12:00 PM
I think it depends on driver and H/W. For the platform you are on contact the driver supplier and ask them for details.

V-man
12-09-2009, 12:40 PM
http://beyond3d.com/content/news/734
http://developer.amd.com/gpu_assets/Shader%20Model%205-0%20and%20Compute%20Shader.pps
and other such pages

so DX11 which means SM 5.0 GPUs may or may not support double precision. Also, like the pps page says, it will be slow even if the GPU supports it.

MrKaktus
12-11-2009, 02:26 PM
Ok so does GLSL 1.50 support half/double data types or not?
I'm confused, how it looks in DX10.1?

dukey
12-12-2009, 03:25 AM
I was under the impression the hardware only worked on floats. And double precision was essentially over kill.

Dark Photon
12-12-2009, 07:54 AM
Ok so does GLSL 1.50 support half/double data types or not?
double: AFAIK, GLSL doesn't support double yet. NVidia hardware has supported this for about a year I think in CUDA-land (see this (http://www.herikstad.net/2009/05/cuda-and-double-precision-floating.html) for instance). But I don't think that's been pushed up to GLSL.

half: OTOH, while GLSL itself doesn't support different precision floats, NVidia GLSL has supported half types for many years. See NVidia GLSL Release Notes (http://developer.download.nvidia.com/opengl/glsl/glsl_release_notes.pdf). This of course won't work on anything but NVidia. Also note: if you don't define #extension ### where ### >= 110, then you can get to the half* types on NVidia GLSL. Otherwise you can't. If you use half, you can use the __GLSL_CG_DATA_TYPES preprocessor symbol to conditionally map them to the float types on non-NVidia hardware.

Also for more NV GLSL goodies, see NVidia GLSL Compiling Options (http://www.icare3d.org/blog_techno/gpu/nvidia_glsl_compiling_options.html). In particular, fastmath and fastprecision look interesting. Maybe one of those forces float to half?


I was under the impression the hardware only worked on floats. And double precision was essentially over kill.
No for some apps, especially HPC/GPGPU number crunching (OpenCL/CUDA), its essential.

Dark Photon
12-23-2009, 09:46 AM
Ok so does GLSL 1.50 support half/double data types or not?
double: AFAIK, GLSL doesn't support double yet...
More on that, for the archives. Per:

* http://www.nvidia.com/content/GTC/videos/GTC09-1407.flv

(skip to: 1:08:34), OpenGL SM5 support will add double support for vertex attributes, uniforms, transform feedback, and internal computations in shaders.