Commit 0f10ac93 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Create the wined3d swapchain when setting the cooperative level.

parent 39278596
......@@ -98,7 +98,6 @@ struct IDirectDrawImpl
DWORD orig_bpp;
/* D3D things */
IDirectDrawSurfaceImpl *d3d_target;
HWND d3d_window;
IDirect3DDeviceImpl *d3ddevice;
int d3dversion;
......
......@@ -361,12 +361,11 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
ddraw_handle_table_destroy(&This->handle_table);
TRACE("Releasing target %p %p\n", This->target, This->ddraw->d3d_target);
TRACE("Releasing target %p.\n", This->target);
/* Release the render target and the WineD3D render target
* (See IDirect3D7::CreateDevice for more comments on this)
*/
IDirectDrawSurface7_Release(&This->target->IDirectDrawSurface7_iface);
IDirectDrawSurface7_Release(&This->ddraw->d3d_target->IDirectDrawSurface7_iface);
TRACE("Target release done\n");
This->ddraw->d3ddevice = NULL;
......@@ -6914,7 +6913,6 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDi
* In most cases, those surfaces are the same anyway, but this will simply
* add another ref which is released when the device is destroyed. */
IDirectDrawSurface7_AddRef(&target->IDirectDrawSurface7_iface);
IDirectDrawSurface7_AddRef(&ddraw->d3d_target->IDirectDrawSurface7_iface);
ddraw->d3ddevice = device;
......
......@@ -453,20 +453,12 @@ void ddraw_surface_destroy(IDirectDrawSurfaceImpl *This)
static void ddraw_surface_cleanup(IDirectDrawSurfaceImpl *surface)
{
IDirectDrawImpl *ddraw = surface->ddraw;
BOOL destroy_swapchain = FALSE;
IDirectDrawSurfaceImpl *surf;
IUnknown *ifaceToRelease;
UINT i;
TRACE("surface %p.\n", surface);
if ((ddraw->d3d_initialized && surface == ddraw->d3d_target
&& DefaultSurfaceType == SURFACE_OPENGL)
|| ((surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
&& DefaultSurfaceType != SURFACE_OPENGL))
destroy_swapchain = TRUE;
/* The refcount test shows that the palette is detached when the surface
* is destroyed. */
IDirectDrawSurface7_SetPalette(&surface->IDirectDrawSurface7_iface, NULL);
......@@ -495,9 +487,6 @@ static void ddraw_surface_cleanup(IDirectDrawSurfaceImpl *surface)
/* Destroy the root surface. */
ddraw_surface_destroy(surface);
if (ddraw->wined3d_swapchain && destroy_swapchain)
ddraw_destroy_swapchain(ddraw);
/* Reduce the ddraw refcount */
if (ifaceToRelease)
IUnknown_Release(ifaceToRelease);
......
......@@ -3309,7 +3309,7 @@ static void SetRenderTargetTest(void)
ok(hr == DD_OK, "IDirect3DDevice7_GetRenderTarget failed, hr=0x%08x\n", hr);
refcount = getRefcount((IUnknown*) oldrt);
todo_wine ok(refcount == 3, "Refcount should be 3, returned is %d\n", refcount);
ok(refcount == 3, "Refcount should be 3, returned is %d\n", refcount);
refcount = getRefcount((IUnknown*) failrt);
ok(refcount == 1, "Refcount should be 1, returned is %d\n", refcount);
......@@ -3318,7 +3318,7 @@ static void SetRenderTargetTest(void)
ok(hr != D3D_OK, "IDirect3DDevice7_SetRenderTarget succeeded\n");
refcount = getRefcount((IUnknown*) oldrt);
todo_wine ok(refcount == 2, "Refcount should be 2, returned is %d\n", refcount);
ok(refcount == 2, "Refcount should be 2, returned is %d\n", refcount);
refcount = getRefcount((IUnknown*) failrt);
ok(refcount == 2, "Refcount should be 2, returned is %d\n", refcount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment