mesa: Properly set the fog scale (gl_Fog.scale) to +INF when fog start and end are...
authorHenri Verbeet <hverbeet@gmail.com>
Sat, 31 Aug 2013 09:50:16 +0000 (11:50 +0200)
committerHenri Verbeet <hverbeet@gmail.com>
Tue, 10 Sep 2013 20:25:16 +0000 (22:25 +0200)
commitbd77f517585baa1dba70e7cf260828f0d772e61a
tree388b2dc146b3cac487300655a9d68c2d7f6d8ceb
parent09e385ee3bbe1d8bb572f2cdb6aa73401caa71b9
mesa: Properly set the fog scale (gl_Fog.scale) to +INF when fog start and end are equal.

This was originally introduced by commit
ba47aabc9868b410cdfe3bc8b6d25a44a598cba2, but unfortunately the commit message
doesn't go into much detail about why +INF would be a problem here.

A similar issue exists for STATE_FOG_PARAMS_OPTIMIZED, but allowing infinity
there would potentially introduce NaNs where they shouldn't exist, depending
on the values of fog end and the fog coord. Since STATE_FOG_PARAMS_OPTIMIZED
is only used for fixed function (including ARB_fragment_program with fog
option), and the calculation there probably isn't very stable to begin with
when fog start and end are close together, it seems best to just leave it
alone.

This fixes piglit glsl-fs-fogscale, and a couple of Wine D3D tests. No piglit
regressions on Cayman.

Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/program/prog_statevars.c