wined3d: Devices don't need parents.

This commit is contained in:
Henri Verbeet 2010-08-31 18:41:37 +02:00 committed by Alexandre Julliard
parent 658b048940
commit 2ef400901d
8 changed files with 22 additions and 37 deletions

View File

@ -2796,7 +2796,7 @@ HRESULT device_init(IDirect3DDevice8Impl *device, IWineD3D *wined3d, UINT adapte
if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu();
wined3d_mutex_lock();
hr = IWineD3D_CreateDevice(wined3d, adapter, device_type, focus_window, flags, (IUnknown *)device,
hr = IWineD3D_CreateDevice(wined3d, adapter, device_type, focus_window, flags,
(IWineD3DDeviceParent *)&device->device_parent_vtbl, &device->WineD3DDevice);
if (FAILED(hr))
{

View File

@ -2857,7 +2857,7 @@ HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapte
if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu();
wined3d_mutex_lock();
hr = IWineD3D_CreateDevice(wined3d, adapter, device_type, focus_window, flags, (IUnknown *)device,
hr = IWineD3D_CreateDevice(wined3d, adapter, device_type, focus_window, flags,
(IWineD3DDeviceParent *)&device->device_parent_vtbl, &device->WineD3DDevice);
if (FAILED(hr))
{

View File

@ -5722,7 +5722,7 @@ HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type)
return E_OUTOFMEMORY;
}
hr = IWineD3D_CreateDevice(ddraw->wineD3D, WINED3DADAPTER_DEFAULT, device_type, NULL, 0, (IUnknown *)ddraw,
hr = IWineD3D_CreateDevice(ddraw->wineD3D, WINED3DADAPTER_DEFAULT, device_type, NULL, 0,
(IWineD3DDeviceParent *)&ddraw->device_parent_vtbl, &ddraw->wineD3DDevice);
if (FAILED(hr))
{

View File

@ -394,7 +394,7 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
FIXME("Ignoring adapter type.\n");
EnterCriticalSection(&dxgi_cs);
hr = IWineD3D_CreateDevice(wined3d, adapter_ordinal, WINED3DDEVTYPE_HAL, NULL, 0,
(IUnknown *)device, wined3d_device_parent, &device->wined3d_device);
wined3d_device_parent, &device->wined3d_device);
IWineD3DDeviceParent_Release(wined3d_device_parent);
IWineD3D_Release(wined3d);
LeaveCriticalSection(&dxgi_cs);

View File

@ -815,19 +815,21 @@ HRESULT device_clear_render_targets(IWineD3DDeviceImpl *device, UINT rt_count, I
* IUnknown parts follows
**********************************************************/
static HRESULT WINAPI IWineD3DDeviceImpl_QueryInterface(IWineD3DDevice *iface,REFIID riid,LPVOID *ppobj)
static HRESULT WINAPI IWineD3DDeviceImpl_QueryInterface(IWineD3DDevice *iface, REFIID riid, void **object)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IWineD3DBase)
|| IsEqualGUID(riid, &IID_IWineD3DDevice)) {
if (IsEqualGUID(riid, &IID_IWineD3DDevice)
|| IsEqualGUID(riid, &IID_IUnknown))
{
IUnknown_AddRef(iface);
*ppobj = This;
*object = iface;
return S_OK;
}
*ppobj = NULL;
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
*object = NULL;
return E_NOINTERFACE;
}
@ -883,16 +885,6 @@ static ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) {
return refCount;
}
/**********************************************************
* IWineD3DDevice implementation follows
**********************************************************/
static HRESULT WINAPI IWineD3DDeviceImpl_GetParent(IWineD3DDevice *iface, IUnknown **pParent) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
*pParent = This->parent;
IUnknown_AddRef(This->parent);
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DDeviceImpl_CreateBuffer(IWineD3DDevice *iface, struct wined3d_buffer_desc *desc,
const void *data, IUnknown *parent, const struct wined3d_parent_ops *parent_ops, IWineD3DBuffer **buffer)
{
@ -6646,7 +6638,6 @@ static const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_AddRef,
IWineD3DDeviceImpl_Release,
/*** IWineD3DDevice methods ***/
IWineD3DDeviceImpl_GetParent,
/*** Creation methods**/
IWineD3DDeviceImpl_CreateBuffer,
IWineD3DDeviceImpl_CreateVertexBuffer,
@ -6791,7 +6782,7 @@ static const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d,
UINT adapter_idx, WINED3DDEVTYPE device_type, HWND focus_window, DWORD flags,
IUnknown *parent, IWineD3DDeviceParent *device_parent)
IWineD3DDeviceParent *device_parent)
{
struct wined3d_adapter *adapter = &wined3d->adapters[adapter_idx];
const struct fragment_pipeline *fragment_pipeline;
@ -6806,7 +6797,6 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d,
device->wined3d = (IWineD3D *)wined3d;
IWineD3D_AddRef(device->wined3d);
device->adapter = wined3d->adapter_count ? adapter : NULL;
device->parent = parent;
device->device_parent = device_parent;
list_init(&device->resources);
list_init(&device->shaders);

View File

@ -4831,18 +4831,15 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT adapter_idx,
WINED3DDEVTYPE device_type, HWND focus_window, DWORD flags, IUnknown *parent,
IWineD3DDeviceParent *device_parent, IWineD3DDevice **device)
static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT adapter_idx, WINED3DDEVTYPE device_type,
HWND focus_window, DWORD flags, IWineD3DDeviceParent *device_parent, IWineD3DDevice **device)
{
IWineD3DImpl *This = (IWineD3DImpl *)iface;
IWineD3DDeviceImpl *object;
HRESULT hr;
TRACE("iface %p, adapter_idx %u, device_type %#x, focus_window %p, flags %#x.\n"
"parent %p, device_parent %p, device %p.\n",
iface, adapter_idx, device_type, focus_window, flags,
parent, device_parent, device);
TRACE("iface %p, adapter_idx %u, device_type %#x, focus_window %p, flags %#x, device_parent %p, device %p.\n",
iface, adapter_idx, device_type, focus_window, flags, device_parent, device);
/* Validate the adapter number. If no adapters are available(no GL), ignore the adapter
* number and create a device without a 3D adapter for 2D only operation. */
@ -4858,7 +4855,7 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT adapter_id
return E_OUTOFMEMORY;
}
hr = device_init(object, This, adapter_idx, device_type, focus_window, flags, parent, device_parent);
hr = device_init(object, This, adapter_idx, device_type, focus_window, flags, device_parent);
if (FAILED(hr))
{
WARN("Failed to initialize device, hr %#x.\n", hr);

View File

@ -1567,7 +1567,6 @@ struct IWineD3DDeviceImpl
LONG ref; /* Note: Ref counting not required */
/* WineD3D Information */
IUnknown *parent;
IWineD3DDeviceParent *device_parent;
IWineD3D *wined3d;
struct wined3d_adapter *adapter;
@ -1702,7 +1701,7 @@ void device_context_remove(IWineD3DDeviceImpl *device, struct wined3d_context *c
void device_get_draw_rect(IWineD3DDeviceImpl *device, RECT *rect) DECLSPEC_HIDDEN;
HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d,
UINT adapter_idx, WINED3DDEVTYPE device_type, HWND focus_window, DWORD flags,
IUnknown *parent, IWineD3DDeviceParent *device_parent) DECLSPEC_HIDDEN;
IWineD3DDeviceParent *device_parent) DECLSPEC_HIDDEN;
void device_preload_textures(IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN;
LRESULT device_process_message(IWineD3DDeviceImpl *device, HWND window,
UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN;

View File

@ -2264,7 +2264,6 @@ interface IWineD3D : IWineD3DBase
[in] WINED3DDEVTYPE device_type,
[in] HWND focus_window,
[in] DWORD behaviour_flags,
[in] IUnknown *parent,
[in] IWineD3DDeviceParent *device_parent,
[out] IWineD3DDevice **device
);
@ -2793,7 +2792,7 @@ interface IWineD3DPixelShader : IWineD3DBaseShader
local,
uuid(6d10a2ce-09d0-4a53-a427-11388f9f8ca5)
]
interface IWineD3DDevice : IWineD3DBase
interface IWineD3DDevice : IUnknown
{
HRESULT CreateBuffer(
[in] struct wined3d_buffer_desc *desc,