From 61608b71fccfdfd72d1e227d5e559ceedb7f2a41 Mon Sep 17 00:00:00 2001 From: Jason Edmeades Date: Mon, 17 Nov 2003 20:04:30 +0000 Subject: [PATCH] If swap mode is discard, clear the backbuffer before moving onto the next frame. --- dlls/d3d8/device.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 622a4b1f6a9..a976e46c820 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -483,6 +483,9 @@ HRESULT WINAPI IDirect3DDevice8Impl_Present(LPDIRECT3DDEVICE8 iface, CONST REC 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 @@ HRESULT WINAPI IDirect3DDevice8Impl_Present(LPDIRECT3DDEVICE8 iface, CONST REC #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; }