d3d9: Finish the COM cleanup of the IDirect3DDevice9Ex iface.

This commit is contained in:
Michael Stefaniuc 2011-04-24 21:34:30 +02:00 committed by Alexandre Julliard
parent 5f57cc1451
commit d5739cd2c3
13 changed files with 31 additions and 33 deletions

View File

@ -281,7 +281,7 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer9Impl *buffer, IDirect3DDevice9Im
return hr;
}
buffer->parentDevice = (IDirect3DDevice9Ex *)device;
buffer->parentDevice = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(buffer->parentDevice);
return D3D_OK;
@ -544,7 +544,7 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer9Impl *buffer, IDirect3DDevice9Impl
return hr;
}
buffer->parentDevice = (IDirect3DDevice9Ex *)device;
buffer->parentDevice = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(buffer->parentDevice);
return D3D_OK;

View File

@ -480,7 +480,7 @@ HRESULT cubetexture_init(IDirect3DCubeTexture9Impl *texture, IDirect3DDevice9Imp
return hr;
}
texture->parentDevice = (IDirect3DDevice9Ex *)device;
texture->parentDevice = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(texture->parentDevice);
return D3D_OK;

View File

@ -162,14 +162,10 @@ void filter_caps(D3DCAPS9* pCaps) DECLSPEC_HIDDEN;
*/
typedef struct IDirect3DDevice9Impl
{
/* IUnknown fields */
const IDirect3DDevice9ExVtbl *lpVtbl;
IDirect3DDevice9Ex IDirect3DDevice9Ex_iface;
const IWineD3DDeviceParentVtbl *device_parent_vtbl;
LONG ref;
/* IDirect3DDevice9 fields */
IWineD3DDevice *WineD3DDevice;
LONG ref;
IWineD3DDevice *WineD3DDevice;
/* Avoids recursion with nested ReleaseRef to 0 */
BOOL inDestruction;

View File

@ -183,7 +183,7 @@ static UINT vertex_count_from_primitive_count(D3DPRIMITIVETYPE primitive_type, U
static inline IDirect3DDevice9Impl *impl_from_IDirect3DDevice9Ex(IDirect3DDevice9Ex *iface)
{
return CONTAINING_RECORD(iface, IDirect3DDevice9Impl, lpVtbl);
return CONTAINING_RECORD(iface, IDirect3DDevice9Impl, IDirect3DDevice9Ex_iface);
}
static HRESULT WINAPI IDirect3DDevice9Impl_QueryInterface(IDirect3DDevice9Ex *iface, REFIID riid,
@ -2213,7 +2213,8 @@ static IDirect3DVertexDeclaration9 *getConvertedDecl(IDirect3DDevice9Impl *This,
hr = vdecl_convert_fvf(fvf, &elements);
if (hr != S_OK) return NULL;
hr = IDirect3DDevice9Impl_CreateVertexDeclaration((IDirect3DDevice9Ex *) This, elements, &pDecl);
hr = IDirect3DDevice9Impl_CreateVertexDeclaration(&This->IDirect3DDevice9Ex_iface, elements,
&pDecl);
HeapFree(GetProcessHeap(), 0, elements); /* CreateVertexDeclaration makes a copy */
if (hr != S_OK) return NULL;
@ -3142,22 +3143,23 @@ static inline struct IDirect3DDevice9Impl *device_from_device_parent(IWineD3DDev
- FIELD_OFFSET(struct IDirect3DDevice9Impl, device_parent_vtbl));
}
static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface,
REFIID riid, void **object)
{
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
return IDirect3DDevice9Impl_QueryInterface((IDirect3DDevice9Ex *)This, riid, object);
return IDirect3DDevice9Impl_QueryInterface(&This->IDirect3DDevice9Ex_iface, riid, object);
}
static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
{
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
return IDirect3DDevice9Impl_AddRef((IDirect3DDevice9Ex *)This);
return IDirect3DDevice9Impl_AddRef(&This->IDirect3DDevice9Ex_iface);
}
static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
{
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
return IDirect3DDevice9Impl_Release((IDirect3DDevice9Ex *)This);
return IDirect3DDevice9Impl_Release(&This->IDirect3DDevice9Ex_iface);
}
/* IWineD3DDeviceParent methods */
@ -3218,7 +3220,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
"\tmultisample_quality %u, lockable %u, surface %p\n",
iface, container_parent, width, height, format, multisample_type, multisample_quality, lockable, surface);
hr = IDirect3DDevice9Impl_CreateRenderTarget((IDirect3DDevice9Ex *)This, width, height,
hr = IDirect3DDevice9Impl_CreateRenderTarget(&This->IDirect3DDevice9Ex_iface, width, height,
d3dformat_from_wined3dformat(format), multisample_type, multisample_quality, lockable,
(IDirect3DSurface9 **)&d3d_surface, NULL);
if (FAILED(hr))
@ -3249,9 +3251,9 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
"\tmultisample_quality %u, discard %u, surface %p\n",
iface, width, height, format, multisample_type, multisample_quality, discard, surface);
hr = IDirect3DDevice9Impl_CreateDepthStencilSurface((IDirect3DDevice9Ex *)This, width, height,
d3dformat_from_wined3dformat(format), multisample_type, multisample_quality, discard,
(IDirect3DSurface9 **)&d3d_surface, NULL);
hr = IDirect3DDevice9Impl_CreateDepthStencilSurface(&This->IDirect3DDevice9Ex_iface, width,
height, d3dformat_from_wined3dformat(format), multisample_type, multisample_quality,
discard, (IDirect3DSurface9 **)&d3d_surface, NULL);
if (FAILED(hr))
{
ERR("(%p) CreateDepthStencilSurface failed, returning %#x\n", iface, hr);
@ -3260,7 +3262,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
*surface = d3d_surface->wineD3DSurface;
IWineD3DSurface_AddRef(*surface);
d3d_surface->container = (IUnknown *)This;
d3d_surface->container = (IUnknown *)&This->IDirect3DDevice9Ex_iface;
/* Implicit surfaces are created with an refcount of 0 */
IDirect3DSurface9_Release((IDirect3DSurface9 *)d3d_surface);
@ -3333,7 +3335,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
local_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz;
local_parameters.PresentationInterval = present_parameters->PresentationInterval;
hr = IDirect3DDevice9Impl_CreateAdditionalSwapChain((IDirect3DDevice9Ex *)This,
hr = IDirect3DDevice9Impl_CreateAdditionalSwapChain(&This->IDirect3DDevice9Ex_iface,
&local_parameters, &d3d_swapchain);
if (FAILED(hr))
{
@ -3402,7 +3404,7 @@ HRESULT device_init(IDirect3DDevice9Impl *device, struct wined3d *wined3d, UINT
if (mode)
FIXME("Ignoring display mode.\n");
device->lpVtbl = &Direct3DDevice9_Vtbl;
device->IDirect3DDevice9Ex_iface.lpVtbl = &Direct3DDevice9_Vtbl;
device->device_parent_vtbl = &d3d9_wined3d_device_parent_vtbl;
device->ref = 1;

View File

@ -516,7 +516,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3D9ExImpl_CreateDeviceEx(IDirect3
}
TRACE("Created device %p.\n", object);
*device = (IDirect3DDevice9Ex *)object;
*device = &object->IDirect3DDevice9Ex_iface;
return D3D_OK;
}

View File

@ -179,7 +179,7 @@ HRESULT query_init(IDirect3DQuery9Impl *query, IDirect3DDevice9Impl *device, D3D
return hr;
}
query->parentDevice = (IDirect3DDevice9Ex *)device;
query->parentDevice = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(query->parentDevice);
return D3D_OK;

View File

@ -144,7 +144,7 @@ HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader, IDirect3DDevice9Im
return hr;
}
shader->parentDevice = (IDirect3DDevice9Ex *)device;
shader->parentDevice = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(shader->parentDevice);
return D3D_OK;
@ -271,7 +271,7 @@ HRESULT pixelshader_init(IDirect3DPixelShader9Impl *shader, IDirect3DDevice9Impl
return hr;
}
shader->parentDevice = (IDirect3DDevice9Ex *)device;
shader->parentDevice = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(shader->parentDevice);
return D3D_OK;

View File

@ -159,7 +159,7 @@ HRESULT stateblock_init(IDirect3DStateBlock9Impl *stateblock, IDirect3DDevice9Im
}
}
stateblock->parentDevice = (IDirect3DDevice9Ex *)device;
stateblock->parentDevice = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(stateblock->parentDevice);
return D3D_OK;

View File

@ -402,7 +402,7 @@ HRESULT surface_init(IDirect3DSurface9Impl *surface, IDirect3DDevice9Impl *devic
return hr;
}
surface->parentDevice = (IDirect3DDevice9Ex *)device;
surface->parentDevice = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(surface->parentDevice);
return D3D_OK;

View File

@ -285,7 +285,7 @@ HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl
return hr;
}
swapchain->parentDevice = (IDirect3DDevice9Ex *)device;
swapchain->parentDevice = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(swapchain->parentDevice);
return D3D_OK;

View File

@ -467,7 +467,7 @@ HRESULT texture_init(IDirect3DTexture9Impl *texture, IDirect3DDevice9Impl *devic
return hr;
}
texture->parentDevice = (IDirect3DDevice9Ex *)device;
texture->parentDevice = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(texture->parentDevice);
return D3D_OK;

View File

@ -406,7 +406,7 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declaration,
return hr;
}
declaration->parentDevice = (IDirect3DDevice9Ex *)device;
declaration->parentDevice = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(declaration->parentDevice);
return D3D_OK;

View File

@ -453,7 +453,7 @@ HRESULT volumetexture_init(IDirect3DVolumeTexture9Impl *texture, IDirect3DDevice
return hr;
}
texture->parentDevice = (IDirect3DDevice9Ex *)device;
texture->parentDevice = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(texture->parentDevice);
return D3D_OK;