Module: wine Branch: refs/heads/master Commit: daa6a3d714e2c222fdf7c51e410920eebe8ad40c URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=daa6a3d714e2c222fdf7c51e...
Author: Stefan Dösinger stefan@codeweavers.com Date: Sat May 13 23:33:00 2006 +0200
wined3d: Support for single buffering.
---
dlls/wined3d/device.c | 41 +++++++++++++++++++++++++++-------------- dlls/wined3d/swapchain.c | 25 +++++++++++++++---------- 2 files changed, 42 insertions(+), 24 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index d6c70f8..a7221ce 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1152,9 +1152,6 @@ HRESULT WINAPI IWineD3DDeviceImpl_Create
D3DCREATEOBJECTINSTANCE(object, SwapChain)
- /* Initialize other useful values */ - object->presentParms.BackBufferCount = 1; /* TODO:? support for gl_aux buffers */ - /********************* * Lookup the window Handle and the relating X window handle ********************/ @@ -1382,18 +1379,34 @@ #endif NULL /* pShared (always null)*/); if (object->frontBuffer != NULL) IWineD3DSurface_SetContainer(object->frontBuffer, (IWineD3DBase *)object); - TRACE("calling rendertarget CB\n"); - hr = D3DCB_CreateRenderTarget((IUnknown *) This->parent, - object->presentParms.BackBufferWidth, - object->presentParms.BackBufferHeight, - object->presentParms.BackBufferFormat, - object->presentParms.MultiSampleType, - object->presentParms.MultiSampleQuality, - TRUE /* Lockable */, - &object->backBuffer, - NULL /* pShared (always null)*/); - if (object->backBuffer != NULL) + if(object->presentParms.BackBufferCount > 0) { + TRACE("calling rendertarget CB\n"); + hr = D3DCB_CreateRenderTarget((IUnknown *) This->parent, + object->presentParms.BackBufferWidth, + object->presentParms.BackBufferHeight, + object->presentParms.BackBufferFormat, + object->presentParms.MultiSampleType, + object->presentParms.MultiSampleQuality, + TRUE /* Lockable */, + &object->backBuffer, + NULL /* pShared (always null)*/); + } else { + object->backBuffer = NULL; + } + + if (object->backBuffer != NULL) { IWineD3DSurface_SetContainer(object->backBuffer, (IWineD3DBase *)object); + ENTER_GL(); + glDrawBuffer(GL_BACK); + checkGLcall("glDrawBuffer(GL_BACK)"); + LEAVE_GL(); + } else { + /* Single buffering - draw to front buffer */ + ENTER_GL(); + glDrawBuffer(GL_FRONT); + checkGLcall("glDrawBuffer(GL_FRONT)"); + LEAVE_GL(); + }
/* Under directX swapchains share the depth stencil, so only create one depth-stencil */ if (pPresentationParameters->EnableAutoDepthStencil) { diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 05e31e4..29c3f1c 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -94,19 +94,24 @@ ULONG WINAPI IWineD3DSwapChainImpl_Relea IWineD3DDevice_SwapChainReleased((IWineD3DDevice *)This->wineD3DDevice, iface);
/* release the ref to the front and back buffer parents */ - IWineD3DSurface_SetContainer(This->frontBuffer, 0); - IWineD3DSurface_GetParent(This->frontBuffer, &bufferParent); - IUnknown_Release(bufferParent); /* once for the get parent */ - if(IUnknown_Release(bufferParent) > 0){ - FIXME("(%p) Something's still holding the front buffer\n",This); + if(This->frontBuffer) { + IWineD3DSurface_SetContainer(This->frontBuffer, 0); + IWineD3DSurface_GetParent(This->frontBuffer, &bufferParent); + IUnknown_Release(bufferParent); /* once for the get parent */ + if(IUnknown_Release(bufferParent) > 0){ + FIXME("(%p) Something's still holding the front buffer\n",This); + } }
- IWineD3DSurface_SetContainer(This->backBuffer, 0); - IWineD3DSurface_GetParent(This->backBuffer, &bufferParent); - IUnknown_Release(bufferParent); /* once for the get parent */ - if(IUnknown_Release(bufferParent) > 0){ - FIXME("(%p) Something's still holding the back buffer\n",This); + if(This->backBuffer) { + IWineD3DSurface_SetContainer(This->backBuffer, 0); + IWineD3DSurface_GetParent(This->backBuffer, &bufferParent); + IUnknown_Release(bufferParent); /* once for the get parent */ + if(IUnknown_Release(bufferParent) > 0){ + FIXME("(%p) Something's still holding the back buffer\n",This); + } } + /* Clean up the context */ /* check that we are the current context first */ if(glXGetCurrentContext() == This->glCtx){