wined3d: Get rid of the swapchain destroy callback.
This commit is contained in:
parent
b7582991de
commit
d2e665230a
|
@ -254,13 +254,6 @@ static void *d3d8_get_object(struct d3d8_handle_table *t, DWORD handle, enum d3d
|
|||
return entry->object;
|
||||
}
|
||||
|
||||
static ULONG WINAPI D3D8CB_DestroySwapChain(IWineD3DSwapChain *swapchain)
|
||||
{
|
||||
TRACE("swapchain %p.\n", swapchain);
|
||||
|
||||
return IWineD3DSwapChain_Release(swapchain);
|
||||
}
|
||||
|
||||
static inline IDirect3DDevice8Impl *impl_from_IDirect3DDevice8(IDirect3DDevice8 *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, IDirect3DDevice8Impl, IDirect3DDevice8_iface);
|
||||
|
@ -327,7 +320,7 @@ static ULONG WINAPI IDirect3DDevice8Impl_Release(IDirect3DDevice8 *iface)
|
|||
}
|
||||
HeapFree(GetProcessHeap(), 0, This->decls);
|
||||
|
||||
IWineD3DDevice_Uninit3D(This->WineD3DDevice, D3D8CB_DestroySwapChain);
|
||||
IWineD3DDevice_Uninit3D(This->WineD3DDevice);
|
||||
IWineD3DDevice_ReleaseFocusWindow(This->WineD3DDevice);
|
||||
IWineD3DDevice_Release(This->WineD3DDevice);
|
||||
HeapFree(GetProcessHeap(), 0, This->handle_table.entries);
|
||||
|
@ -3104,7 +3097,7 @@ HRESULT device_init(IDirect3DDevice8Impl *device, struct wined3d *wined3d, UINT
|
|||
|
||||
err:
|
||||
wined3d_mutex_lock();
|
||||
IWineD3DDevice_Uninit3D(device->WineD3DDevice, D3D8CB_DestroySwapChain);
|
||||
IWineD3DDevice_Uninit3D(device->WineD3DDevice);
|
||||
IWineD3DDevice_ReleaseFocusWindow(device->WineD3DDevice);
|
||||
IWineD3DDevice_Release(device->WineD3DDevice);
|
||||
wined3d_mutex_unlock();
|
||||
|
|
|
@ -181,13 +181,6 @@ static UINT vertex_count_from_primitive_count(D3DPRIMITIVETYPE primitive_type, U
|
|||
}
|
||||
}
|
||||
|
||||
static ULONG WINAPI D3D9CB_DestroySwapChain(IWineD3DSwapChain *swapchain)
|
||||
{
|
||||
TRACE("swapchain %p.\n", swapchain);
|
||||
|
||||
return IWineD3DSwapChain_Release(swapchain);
|
||||
}
|
||||
|
||||
/* IDirect3D IUnknown parts follow: */
|
||||
static HRESULT WINAPI IDirect3DDevice9Impl_QueryInterface(LPDIRECT3DDEVICE9EX iface, REFIID riid, LPVOID* ppobj) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
|
@ -266,7 +259,7 @@ static ULONG WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Release(LPDIRECT3DDEV
|
|||
}
|
||||
HeapFree(GetProcessHeap(), 0, This->convertedDecls);
|
||||
|
||||
IWineD3DDevice_Uninit3D(This->WineD3DDevice, D3D9CB_DestroySwapChain);
|
||||
IWineD3DDevice_Uninit3D(This->WineD3DDevice);
|
||||
IWineD3DDevice_ReleaseFocusWindow(This->WineD3DDevice);
|
||||
IWineD3DDevice_Release(This->WineD3DDevice);
|
||||
wined3d_mutex_unlock();
|
||||
|
@ -3377,7 +3370,7 @@ HRESULT device_init(IDirect3DDevice9Impl *device, struct wined3d *wined3d, UINT
|
|||
{
|
||||
ERR("Failed to allocate FVF vertex declaration map memory.\n");
|
||||
wined3d_mutex_lock();
|
||||
IWineD3DDevice_Uninit3D(device->WineD3DDevice, D3D9CB_DestroySwapChain);
|
||||
IWineD3DDevice_Uninit3D(device->WineD3DDevice);
|
||||
IWineD3DDevice_ReleaseFocusWindow(device->WineD3DDevice);
|
||||
IWineD3DDevice_Release(device->WineD3DDevice);
|
||||
wined3d_mutex_unlock();
|
||||
|
|
|
@ -2562,13 +2562,12 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
|
|||
/* If there's a swapchain, it owns the wined3d surfaces. So Destroy
|
||||
* the swapchain
|
||||
*/
|
||||
if(swapchain) {
|
||||
if (swapchain)
|
||||
{
|
||||
/* The backbuffers have the swapchain set as well, but the primary
|
||||
* owns it and destroys it
|
||||
*/
|
||||
if(surfImpl->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) {
|
||||
IWineD3DDevice_UninitGDI(This->wineD3DDevice, D3D7CB_DestroySwapChain);
|
||||
}
|
||||
* owns it and destroys it. */
|
||||
if (surfImpl->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
|
||||
IWineD3DDevice_UninitGDI(This->wineD3DDevice);
|
||||
surfImpl->isRenderTarget = FALSE;
|
||||
} else {
|
||||
if(IWineD3DSurface_Release(wineD3DSurface) == 0)
|
||||
|
@ -2603,7 +2602,7 @@ static HRESULT ddraw_recreate_surfaces(IDirectDrawImpl *This)
|
|||
/* Should happen almost never */
|
||||
FIXME("(%p) Switching to non-opengl surfaces with d3d started. Is this a bug?\n", This);
|
||||
/* Shutdown d3d */
|
||||
IWineD3DDevice_Uninit3D(This->wineD3DDevice, D3D7CB_DestroySwapChain);
|
||||
IWineD3DDevice_Uninit3D(This->wineD3DDevice);
|
||||
}
|
||||
/* Contrary: D3D starting is handled by the caller, because it knows the render target */
|
||||
|
||||
|
@ -2614,13 +2613,6 @@ static HRESULT ddraw_recreate_surfaces(IDirectDrawImpl *This)
|
|||
ddraw_recreate_surfaces_cb);
|
||||
}
|
||||
|
||||
ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *swapchain)
|
||||
{
|
||||
TRACE("swapchain %p.\n", swapchain);
|
||||
|
||||
return IWineD3DSwapChain_Release(swapchain);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* ddraw_create_surface
|
||||
*
|
||||
|
@ -2898,7 +2890,7 @@ static HRESULT ddraw_attach_d3d_device(IDirectDrawImpl *ddraw, IDirectDrawSurfac
|
|||
{
|
||||
ERR("Error allocating an array for the converted vertex decls.\n");
|
||||
ddraw->declArraySize = 0;
|
||||
hr = IWineD3DDevice_Uninit3D(ddraw->wineD3DDevice, D3D7CB_DestroySwapChain);
|
||||
hr = IWineD3DDevice_Uninit3D(ddraw->wineD3DDevice);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,9 +51,6 @@ typedef struct IDirect3DMaterialImpl IDirect3DMaterialImpl;
|
|||
typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl;
|
||||
typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl;
|
||||
|
||||
/* Callbacks for implicit object destruction */
|
||||
extern ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) DECLSPEC_HIDDEN;
|
||||
|
||||
/* Global critical section */
|
||||
extern CRITICAL_SECTION ddraw_cs DECLSPEC_HIDDEN;
|
||||
|
||||
|
|
|
@ -372,7 +372,7 @@ static ULONG WINAPI ddraw_surface7_Release(IDirectDrawSurface7 *iface)
|
|||
HeapFree(GetProcessHeap(), 0, ddraw->decls);
|
||||
ddraw->numConvertedDecls = 0;
|
||||
|
||||
if (FAILED(IWineD3DDevice_Uninit3D(ddraw->wineD3DDevice, D3D7CB_DestroySwapChain)))
|
||||
if (FAILED(IWineD3DDevice_Uninit3D(ddraw->wineD3DDevice)))
|
||||
{
|
||||
/* Not good */
|
||||
ERR("(%p) Failed to uninit 3D\n", This);
|
||||
|
@ -392,8 +392,10 @@ static ULONG WINAPI ddraw_surface7_Release(IDirectDrawSurface7 *iface)
|
|||
This->wineD3DSwapChain = NULL; /* Uninit3D releases the swapchain */
|
||||
ddraw->d3d_initialized = FALSE;
|
||||
ddraw->d3d_target = NULL;
|
||||
} else {
|
||||
IWineD3DDevice_UninitGDI(ddraw->wineD3DDevice, D3D7CB_DestroySwapChain);
|
||||
}
|
||||
else
|
||||
{
|
||||
IWineD3DDevice_UninitGDI(ddraw->wineD3DDevice);
|
||||
This->wineD3DSwapChain = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,13 +59,6 @@ static ULONG STDMETHODCALLTYPE dxgi_swapchain_AddRef(IDXGISwapChain *iface)
|
|||
return refcount;
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE destroy_swapchain(IWineD3DSwapChain *swapchain)
|
||||
{
|
||||
TRACE("swapchain %p\n", swapchain);
|
||||
|
||||
return IWineD3DSwapChain_Release(swapchain);
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE dxgi_swapchain_Release(IDXGISwapChain *iface)
|
||||
{
|
||||
struct dxgi_swapchain *This = (struct dxgi_swapchain *)iface;
|
||||
|
@ -87,7 +80,7 @@ static ULONG STDMETHODCALLTYPE dxgi_swapchain_Release(IDXGISwapChain *iface)
|
|||
}
|
||||
else
|
||||
{
|
||||
hr = IWineD3DDevice_Uninit3D(wined3d_device, destroy_swapchain);
|
||||
hr = IWineD3DDevice_Uninit3D(wined3d_device);
|
||||
IWineD3DDevice_Release(wined3d_device);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
|
|
@ -2126,8 +2126,7 @@ static HRESULT WINAPI device_unload_resource(struct wined3d_resource *resource,
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface,
|
||||
D3DCB_DESTROYSWAPCHAINFN D3DCB_DestroySwapChain)
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface)
|
||||
{
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
|
@ -2266,7 +2265,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface,
|
|||
for (i = 0; i < This->swapchain_count; ++i)
|
||||
{
|
||||
TRACE("Releasing the implicit swapchain %u.\n", i);
|
||||
if (D3DCB_DestroySwapChain((IWineD3DSwapChain *)This->swapchains[i]) > 0)
|
||||
if (IWineD3DSwapChain_Release((IWineD3DSwapChain *)This->swapchains[i]))
|
||||
{
|
||||
FIXME("(%p) Something's still holding the implicit swapchain\n", This);
|
||||
}
|
||||
|
@ -2290,14 +2289,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface,
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_UninitGDI(IWineD3DDevice *iface, D3DCB_DESTROYSWAPCHAINFN D3DCB_DestroySwapChain) {
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_UninitGDI(IWineD3DDevice *iface)
|
||||
{
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < This->swapchain_count; ++i)
|
||||
{
|
||||
TRACE("Releasing the implicit swapchain %u.\n", i);
|
||||
if (D3DCB_DestroySwapChain((IWineD3DSwapChain *)This->swapchains[i]) > 0)
|
||||
if (IWineD3DSwapChain_Release((IWineD3DSwapChain *)This->swapchains[i]))
|
||||
{
|
||||
FIXME("(%p) Something's still holding the implicit swapchain\n", This);
|
||||
}
|
||||
|
|
|
@ -2162,7 +2162,6 @@ interface IWineD3DDeviceParent : IUnknown
|
|||
[out] IWineD3DSwapChain **swapchain
|
||||
);
|
||||
}
|
||||
typedef ULONG (__stdcall *D3DCB_DESTROYSWAPCHAINFN)(IWineD3DSwapChain *pSwapChain);
|
||||
typedef HRESULT (__stdcall *D3DCB_ENUMRESOURCES)(struct wined3d_resource *resource, void *pData);
|
||||
|
||||
[
|
||||
|
@ -2531,10 +2530,8 @@ interface IWineD3DDevice : IUnknown
|
|||
[in] WINED3DPRESENT_PARAMETERS *present_parameters
|
||||
);
|
||||
HRESULT Uninit3D(
|
||||
[in] D3DCB_DESTROYSWAPCHAINFN destroy_swapchain_callback
|
||||
);
|
||||
HRESULT UninitGDI(
|
||||
[in] D3DCB_DESTROYSWAPCHAINFN destroy_swapchain_callback
|
||||
);
|
||||
void SetMultithreaded(
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue