[D3D8] Handle XYZRHW vertex mode correctly in slow path

Christian Costa titan.costa at wanadoo.fr
Sat May 15 13:34:28 CDT 2004


Hi,

This is very strange that a DX8 game still uses projected vertices.
This means we should handle the XYZRHW mode correctly.
This patch fix the display issue in Red Faction.

Changelog:
Handle XYZRHW vertex mode correctly in slow path.

Christian Costa   titan.costa at wanadoo.fr

-------------- next part --------------
Index: drawprim.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/drawprim.c,v
retrieving revision 1.21
diff -u -r1.21 drawprim.c
--- drawprim.c	10 May 2004 19:57:51 -0000	1.21
+++ drawprim.c	15 May 2004 16:21:36 -0000
@@ -1208,17 +1208,13 @@
         
         /* Position -------------------------------- */
         if (sd->u.s.position.lpData != NULL) {
-            if (1.0f == rhw || rhw < 0.0001f) {
+            if (1.0f == rhw || ((rhw < 0.0001f) && (rhw > -0.0001f))) {
                 VTRACE(("Vertex: glVertex:x,y,z=%f,%f,%f\n", x,y,z));
                 glVertex3f(x, y, z);
             } else {
+                GLfloat w = 1.0 / rhw;
                 VTRACE(("Vertex: glVertex:x,y,z=%f,%f,%f / rhw=%f\n", x,y,z,rhw));
-                /* Disable RHW mode as 'w' coord handling for rhw mode should
-                   not impact screen position whereas in GL it does. This may 
-                   result in very slightly distored textures in rhw mode, but
-                   a very minimal different. In slow mode a possible 'fix' is
-                   glVertex4f(x*rhw,y*rhw,z*rhw,rhw) but not sure this is right */
-                glVertex3f(x,y,z);
+                glVertex4f(x*w, y*w, z*w, w);
             }
         }
 


More information about the wine-patches mailing list