wined3d: prevent crash in setup_light

Louis. Lenders xerox_xerox2000 at yahoo.co.uk
Thu Feb 9 16:44:55 CST 2006


Hi, need for speed most wanted demo currently crashes
with:

Unhandled exception: denormal float operand in 32-bit
code (0x7f7d46a0)
in 
=>1 0x7f7d46a0 setup_light+0x1b8(iface=0x4000,
lightInfo=0x7cffc2e0)
[/LFS/winecvs/wine/dlls/wined3d/device.c:169] in
wined3d (0x7f7d46a0)

>From what i can tell this means the float is
sufficiently small that my computer can no longer
distinguish it from 0, except that it /knows/ it's not
zero - thus the complaint.

Attached patch hopefully fixes this in a correct way :)


		
___________________________________________________________ 
Win a BlackBerry device from O2 with Yahoo!. Enter now. http://www.yahoo.co.uk/blackberry
-------------- next part --------------
--- /tmp/wine/dlls/wined3d/device.c	2006-02-09 06:49:38.000000000 -0500
+++ /LFS/winecvs/wine/dlls/wined3d/device.c	2006-02-09 18:31:46.000000000 -0500
@@ -21,6 +21,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <float.h>
 #include "config.h"
 #include "wined3d_private.h"
 
@@ -165,7 +166,7 @@
     glLightf(GL_LIGHT0+Index, GL_LINEAR_ATTENUATION,    lightInfo->OriginalParms.Attenuation1);
     checkGLcall("glLightf");
 
-    if ((lightInfo->OriginalParms.Range *lightInfo->OriginalParms.Range) != 0) {
+    if ((lightInfo->OriginalParms.Range *lightInfo->OriginalParms.Range) >= FLT_MIN) {
         quad_att = 1.4/(lightInfo->OriginalParms.Range *lightInfo->OriginalParms.Range);
     } else {
         quad_att = 0; /*  0 or  MAX?  (0 seems to be ok) */


More information about the wine-patches mailing list