[dx87] Misc fixes

Jason Edmeades us at the-edmeades.demon.co.uk
Wed Oct 29 15:40:46 CST 2003


More misc d3d8 fixes...

Changelog
Correct writing to back buffer in non-ortho mode, and ensure the line 
stipple is passed correctly to enable proper wireframe support

Jason
-------------- next part --------------
Index: dlls/d3d8/device.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/device.c,v
retrieving revision 1.84
diff -u -r1.84 device.c
--- dlls/d3d8/device.c	3 Oct 2003 03:35:53 -0000	1.84
+++ dlls/d3d8/device.c	28 Oct 2003 21:36:07 -0000
@@ -3121,7 +3121,7 @@
        checkGLcall("Disable oldTextureDimensions");
        if (This->StateBlock->texture_state[Stage][D3DTSS_COLOROP] != D3DTOP_DISABLE) {
           glEnable(This->UpdateStateBlock->textureDimensions[Stage]);
-          checkGLcall("Disable new texture dimensions");
+          checkGLcall("glEnable new texture dimensions");
        }
 
        /* If Alpha arg1 is texture then handle the special case when there changes between a
Index: dlls/d3d8/stateblock.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/stateblock.c,v
retrieving revision 1.11
diff -u -r1.11 stateblock.c
--- dlls/d3d8/stateblock.c	30 Sep 2003 00:21:07 -0000	1.11
+++ dlls/d3d8/stateblock.c	28 Oct 2003 21:36:08 -0000
@@ -80,7 +80,7 @@
     }
     IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FILLMODE, D3DFILL_SOLID);
     IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_SHADEMODE, D3DSHADE_GOURAUD);
-    lp.wRepeatFactor = 0; lp.wLinePattern = 0; IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_LINEPATTERN, (DWORD) &lp);
+    lp.wRepeatFactor = 0; lp.wLinePattern = 0; IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_LINEPATTERN, *(DWORD *)&lp);
     IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_ZWRITEENABLE, TRUE);
     IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_ALPHATESTENABLE, FALSE);
     IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_LASTPIXEL, TRUE);
Index: dlls/d3d8/surface.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/surface.c,v
retrieving revision 1.25
diff -u -r1.25 surface.c
--- dlls/d3d8/surface.c	7 Oct 2003 03:31:46 -0000	1.25
+++ dlls/d3d8/surface.c	28 Oct 2003 21:36:09 -0000
@@ -330,6 +330,44 @@
         glPixelZoom(1.0, -1.0);
         vcheckGLcall("glPixelZoom");
 
+        /* glDrawPixels transforms the raster position as though it was a vertex -
+           we want to draw at screen position 0,0 - Set up ortho (rhw) mode as   
+           per drawprim (and leave set - it will sort itself out due to last_was_rhw */
+        if (!This->Device->last_was_rhw) {
+
+            double X, Y, height, width, minZ, maxZ;
+            This->Device->last_was_rhw = TRUE;
+
+            /* Transformed already into viewport coordinates, so we do not need transform
+               matrices. Reset all matrices to identity and leave the default matrix in world 
+               mode.                                                                         */
+            glMatrixMode(GL_MODELVIEW);
+            checkGLcall("glMatrixMode");
+            glLoadIdentity();
+            checkGLcall("glLoadIdentity");
+
+            glMatrixMode(GL_PROJECTION);
+            checkGLcall("glMatrixMode");
+            glLoadIdentity();
+            checkGLcall("glLoadIdentity");
+
+            /* Set up the viewport to be full viewport */
+            X      = This->Device->StateBlock->viewport.X;
+            Y      = This->Device->StateBlock->viewport.Y;
+            height = This->Device->StateBlock->viewport.Height;
+            width  = This->Device->StateBlock->viewport.Width;
+            minZ   = This->Device->StateBlock->viewport.MinZ;
+            maxZ   = This->Device->StateBlock->viewport.MaxZ;
+            TRACE("Calling glOrtho with %f, %f, %f, %f\n", width, height, -minZ, -maxZ);
+            glOrtho(X, X + width, Y + height, Y, -minZ, -maxZ);
+            checkGLcall("glOrtho");
+
+            /* Window Coord 0 is the middle of the first pixel, so translate by half
+               a pixel (See comment above glTranslate below)                         */
+            glTranslatef(0.5, 0.5, 0);
+            checkGLcall("glTranslatef(0.5, 0.5, 0)");
+        }
+
 	if (This == This->Device->backBuffer) {
 	  glDrawBuffer(GL_BACK);
 	} else if (This == This->Device->frontBuffer) {


More information about the wine-patches mailing list