dlls/d3d8/shader.c

Christian Costa titan.costa at wanadoo.fr
Sun Apr 25 07:38:11 CDT 2004


Marcus Meissner wrote:

>Hi,
>
>I was just fixing this code, but I wonder why floorf(s0->w) is overwritten
>right next with tmp_f = powf(2.0f, s0->w);
>
>What is the right version?
>
>Ciao, Marcus
>
>void vshader_expp(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0) {
>  float tmp_f = floorf(s0->w);
>  DWORD tmp_d = 0;
>  tmp_f = powf(2.0f, s0->w);
>  tmp_d = *((DWORD*) &tmp_f) & 0xFFFFFF00;
>
>
>
>  
>
Hi Marcus,

There is a bug in this function. The proper fix is attached.

Bye,
Christian

-------------- next part --------------
Index: shader.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/shader.c,v
retrieving revision 1.23
diff -u -r1.23 shader.c
--- shader.c	23 Apr 2004 21:28:02 -0000	1.23
+++ shader.c	25 Apr 2004 10:30:16 -0000
@@ -126,12 +126,12 @@
 
 void vshader_expp(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0) {
   float tmp_f = floorf(s0->w);
-  DWORD tmp_d = 0;
-  tmp_f = powf(2.0f, s0->w);
-  tmp_d = *((DWORD*) &tmp_f) & 0xFFFFFF00;
+  DWORD tmp_d;
 
   d->x  = powf(2.0f, tmp_f);
   d->y  = s0->w - tmp_f;
+  tmp_f = powf(2.0f, s0->w);
+  tmp_d = *((DWORD*) &tmp_f) & 0xFFFFFF00;
   d->z  = *((float*) &tmp_d);
   d->w  = 1.0f;
   VSTRACE(("executing exp: s0=(%f, %f, %f, %f) => d=(%f, %f, %f, %f)\n",


More information about the wine-devel mailing list