wined3d: Support for single buffering.

This commit is contained in:
Stefan Dösinger 2006-05-13 23:33:00 +02:00 committed by Alexandre Julliard
parent 2f724834f8
commit daa6a3d714
2 changed files with 42 additions and 24 deletions

View File

@ -1152,9 +1152,6 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevice* ifac
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 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevice* ifac
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) {

View File

@ -94,19 +94,24 @@ ULONG WINAPI IWineD3DSwapChainImpl_Release(IWineD3DSwapChain *iface) {
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){