[dx98] Clear if discard

Jason Edmeades us at the-edmeades.demon.co.uk
Sun Nov 16 16:59:39 CST 2003


I dont like this fix as it has an overhead on every frame, but a simple 
demo I had just wont work unless I clear the backbuffer after a display 
(It used discard mode).

Changelog

If swap mode is discard, clear the backbuffer before moving onto the 
next frame

Jason
-------------- next part --------------
diff -u3 dlls/d3d8/dx97/device.c dlls/d3d8/device.c
--- dlls/d3d8/dx97/device.c	2003-11-16 14:23:41.000000000 +0000
+++ dlls/d3d8/device.c	2003-11-16 15:24:33.000000000 +0000
@@ -483,6 +483,9 @@
 
     ENTER_GL();
 
+    if (pSourceRect || pDestRect) FIXME("Unhandled present options %p/%p\n", pSourceRect, pDestRect);
+
+
     glXSwapBuffers(This->display, This->drawable);
     /* Dont call checkGLcall, as glGetError is not applicable here */
     TRACE("glXSwapBuffers called, Starting new frame\n");
@@ -541,6 +544,11 @@
 #endif
 
     LEAVE_GL();
+    /* Although this is not strictly required, a simple demo showed this does occur
+       on (at least non-debug) d3d                                                  */
+    if (This->PresentParms.SwapEffect == D3DSWAPEFFECT_DISCARD) {
+       IDirect3DDevice8Impl_Clear(iface, 0, NULL, D3DCLEAR_STENCIL|D3DCLEAR_ZBUFFER|D3DCLEAR_TARGET, 0x00, 1.0, 0);
+    }
 
     return D3D_OK;
 }



More information about the wine-patches mailing list