wined3d: Get rid of the IWineD3DDeviceParent interface.
This commit is contained in:
parent
74844ca3c6
commit
3032b40c80
|
@ -71,10 +71,11 @@ struct d3d10_device
|
||||||
{
|
{
|
||||||
const struct ID3D10DeviceVtbl *vtbl;
|
const struct ID3D10DeviceVtbl *vtbl;
|
||||||
const struct IUnknownVtbl *inner_unknown_vtbl;
|
const struct IUnknownVtbl *inner_unknown_vtbl;
|
||||||
const struct IWineD3DDeviceParentVtbl *device_parent_vtbl;
|
IWineDXGIDeviceParent IWineDXGIDeviceParent_iface;
|
||||||
IUnknown *outer_unknown;
|
IUnknown *outer_unknown;
|
||||||
LONG refcount;
|
LONG refcount;
|
||||||
|
|
||||||
|
struct wined3d_device_parent device_parent;
|
||||||
struct wined3d_device *wined3d_device;
|
struct wined3d_device *wined3d_device;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -45,10 +45,10 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_inner_QueryInterface(IUnknown *ifa
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent))
|
if (IsEqualGUID(riid, &IID_IWineDXGIDeviceParent))
|
||||||
{
|
{
|
||||||
IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl);
|
IWineDXGIDeviceParent_AddRef(&This->IWineDXGIDeviceParent_iface);
|
||||||
*object = &This->device_parent_vtbl;
|
*object = &This->IWineDXGIDeviceParent_iface;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1285,56 +1285,77 @@ static const struct wined3d_parent_ops d3d10_subresource_parent_ops =
|
||||||
d3d10_subresource_destroyed,
|
d3d10_subresource_destroyed,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* IWineD3DDeviceParent IUnknown methods */
|
/* IWineDXGIDeviceParent IUnknown methods */
|
||||||
|
|
||||||
static inline struct d3d10_device *device_from_device_parent(IWineD3DDeviceParent *iface)
|
static inline struct d3d10_device *device_from_dxgi_device_parent(IWineDXGIDeviceParent *iface)
|
||||||
{
|
{
|
||||||
return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, device_parent_vtbl));
|
return CONTAINING_RECORD(iface, struct d3d10_device, IWineDXGIDeviceParent_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
|
static HRESULT STDMETHODCALLTYPE dxgi_device_parent_QueryInterface(IWineDXGIDeviceParent *iface,
|
||||||
|
REFIID riid, void **object)
|
||||||
{
|
{
|
||||||
struct d3d10_device *This = device_from_device_parent(iface);
|
struct d3d10_device *device = device_from_dxgi_device_parent(iface);
|
||||||
return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
|
return d3d10_device_QueryInterface((ID3D10Device *)device, riid, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
|
static ULONG STDMETHODCALLTYPE dxgi_device_parent_AddRef(IWineDXGIDeviceParent *iface)
|
||||||
{
|
{
|
||||||
struct d3d10_device *This = device_from_device_parent(iface);
|
struct d3d10_device *device = device_from_dxgi_device_parent(iface);
|
||||||
return d3d10_device_AddRef((ID3D10Device *)This);
|
return d3d10_device_AddRef((ID3D10Device *)device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
|
static ULONG STDMETHODCALLTYPE dxgi_device_parent_Release(IWineDXGIDeviceParent *iface)
|
||||||
{
|
{
|
||||||
struct d3d10_device *This = device_from_device_parent(iface);
|
struct d3d10_device *device = device_from_dxgi_device_parent(iface);
|
||||||
return d3d10_device_Release((ID3D10Device *)This);
|
return d3d10_device_Release((ID3D10Device *)device);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IWineD3DDeviceParent methods */
|
static struct wined3d_device_parent * STDMETHODCALLTYPE dxgi_device_parent_get_wined3d_device_parent(
|
||||||
|
IWineDXGIDeviceParent *iface)
|
||||||
static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface,
|
|
||||||
struct wined3d_device *device)
|
|
||||||
{
|
{
|
||||||
struct d3d10_device *This = device_from_device_parent(iface);
|
struct d3d10_device *device = device_from_dxgi_device_parent(iface);
|
||||||
|
return &device->device_parent;
|
||||||
TRACE("iface %p, device %p\n", iface, device);
|
|
||||||
|
|
||||||
wined3d_device_incref(device);
|
|
||||||
This->wined3d_device = device;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
|
static const struct IWineDXGIDeviceParentVtbl d3d10_dxgi_device_parent_vtbl =
|
||||||
|
{
|
||||||
|
/* IUnknown methods */
|
||||||
|
dxgi_device_parent_QueryInterface,
|
||||||
|
dxgi_device_parent_AddRef,
|
||||||
|
dxgi_device_parent_Release,
|
||||||
|
/* IWineDXGIDeviceParent methods */
|
||||||
|
dxgi_device_parent_get_wined3d_device_parent,
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline struct d3d10_device *device_from_wined3d_device_parent(struct wined3d_device_parent *device_parent)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(device_parent, struct d3d10_device, device_parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent,
|
||||||
|
struct wined3d_device *wined3d_device)
|
||||||
|
{
|
||||||
|
struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
|
||||||
|
|
||||||
|
TRACE("device_parent %p, wined3d_device %p.\n", device_parent, wined3d_device);
|
||||||
|
|
||||||
|
wined3d_device_incref(wined3d_device);
|
||||||
|
device->wined3d_device = wined3d_device;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
|
||||||
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
||||||
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
|
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
|
||||||
{
|
{
|
||||||
struct d3d10_device *This = device_from_device_parent(iface);
|
struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
|
||||||
struct d3d10_texture2d *texture;
|
struct d3d10_texture2d *texture;
|
||||||
D3D10_TEXTURE2D_DESC desc;
|
D3D10_TEXTURE2D_DESC desc;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
FIXME("iface %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n"
|
FIXME("device_parent %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n"
|
||||||
"\tpool %#x, level %u, face %u, surface %p partial stub!\n",
|
"\tpool %#x, level %u, face %u, surface %p partial stub!\n",
|
||||||
iface, container_parent, width, height, format, usage, pool, level, face, surface);
|
device_parent, container_parent, width, height, format, usage, pool, level, face, surface);
|
||||||
|
|
||||||
FIXME("Implement DXGI<->wined3d usage conversion\n");
|
FIXME("Implement DXGI<->wined3d usage conversion\n");
|
||||||
|
|
||||||
|
@ -1350,7 +1371,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
|
||||||
desc.CPUAccessFlags = 0;
|
desc.CPUAccessFlags = 0;
|
||||||
desc.MiscFlags = 0;
|
desc.MiscFlags = 0;
|
||||||
|
|
||||||
hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
|
hr = d3d10_device_CreateTexture2D((ID3D10Device *)device, &desc, NULL, (ID3D10Texture2D **)&texture);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("CreateTexture2D failed, returning %#x\n", hr);
|
ERR("CreateTexture2D failed, returning %#x\n", hr);
|
||||||
|
@ -1364,19 +1385,20 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_parent *device_parent,
|
||||||
void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
|
void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
|
||||||
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
|
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
|
||||||
struct wined3d_surface **surface)
|
struct wined3d_surface **surface)
|
||||||
{
|
{
|
||||||
struct d3d10_device *This = device_from_device_parent(iface);
|
struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
|
||||||
struct d3d10_texture2d *texture;
|
struct d3d10_texture2d *texture;
|
||||||
D3D10_TEXTURE2D_DESC desc;
|
D3D10_TEXTURE2D_DESC desc;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
FIXME("iface %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
FIXME("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||||
"\tmultisample_quality %u, lockable %u, surface %p partial stub!\n",
|
"\tmultisample_quality %u, lockable %u, surface %p partial stub!\n",
|
||||||
iface, container_parent, width, height, format, multisample_type, multisample_quality, lockable, surface);
|
device_parent, container_parent, width, height, format, multisample_type,
|
||||||
|
multisample_quality, lockable, surface);
|
||||||
|
|
||||||
FIXME("Implement DXGI<->wined3d usage conversion\n");
|
FIXME("Implement DXGI<->wined3d usage conversion\n");
|
||||||
|
|
||||||
|
@ -1392,7 +1414,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
|
||||||
desc.CPUAccessFlags = 0;
|
desc.CPUAccessFlags = 0;
|
||||||
desc.MiscFlags = 0;
|
desc.MiscFlags = 0;
|
||||||
|
|
||||||
hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
|
hr = d3d10_device_CreateTexture2D((ID3D10Device *)device, &desc, NULL, (ID3D10Texture2D **)&texture);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("CreateTexture2D failed, returning %#x\n", hr);
|
ERR("CreateTexture2D failed, returning %#x\n", hr);
|
||||||
|
@ -1406,18 +1428,18 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_parent *device_parent,
|
||||||
UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type,
|
UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type,
|
||||||
DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
|
DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
|
||||||
{
|
{
|
||||||
struct d3d10_device *This = device_from_device_parent(iface);
|
struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
|
||||||
struct d3d10_texture2d *texture;
|
struct d3d10_texture2d *texture;
|
||||||
D3D10_TEXTURE2D_DESC desc;
|
D3D10_TEXTURE2D_DESC desc;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
FIXME("iface %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
FIXME("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||||
"\tmultisample_quality %u, discard %u, surface %p partial stub!\n",
|
"\tmultisample_quality %u, discard %u, surface %p partial stub!\n",
|
||||||
iface, width, height, format, multisample_type, multisample_quality, discard, surface);
|
device_parent, width, height, format, multisample_type, multisample_quality, discard, surface);
|
||||||
|
|
||||||
FIXME("Implement DXGI<->wined3d usage conversion\n");
|
FIXME("Implement DXGI<->wined3d usage conversion\n");
|
||||||
|
|
||||||
|
@ -1433,7 +1455,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
|
||||||
desc.CPUAccessFlags = 0;
|
desc.CPUAccessFlags = 0;
|
||||||
desc.MiscFlags = 0;
|
desc.MiscFlags = 0;
|
||||||
|
|
||||||
hr = d3d10_device_CreateTexture2D((ID3D10Device *)This, &desc, NULL, (ID3D10Texture2D **)&texture);
|
hr = d3d10_device_CreateTexture2D((ID3D10Device *)device, &desc, NULL, (ID3D10Texture2D **)&texture);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("CreateTexture2D failed, returning %#x\n", hr);
|
ERR("CreateTexture2D failed, returning %#x\n", hr);
|
||||||
|
@ -1447,16 +1469,18 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *device_parent,
|
||||||
void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
|
void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
|
||||||
WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume)
|
WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, container_parent %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p.\n",
|
TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, "
|
||||||
iface, container_parent, width, height, depth, format, pool, usage, volume);
|
"format %#x, pool %#x, usage %#x, volume %p.\n",
|
||||||
|
device_parent, container_parent, width, height, depth,
|
||||||
|
format, pool, usage, volume);
|
||||||
|
|
||||||
hr = wined3d_volume_create(device_from_device_parent(iface)->wined3d_device,
|
hr = wined3d_volume_create(device_from_wined3d_device_parent(device_parent)->wined3d_device,
|
||||||
width, height, depth, usage, format, pool, NULL, &d3d10_subresource_parent_ops, volume);
|
width, height, depth, usage, format, pool, NULL, &d3d10_subresource_parent_ops, volume);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
@ -1467,15 +1491,16 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent,
|
||||||
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain)
|
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain)
|
||||||
{
|
{
|
||||||
|
struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
|
||||||
IWineDXGIDevice *wine_device;
|
IWineDXGIDevice *wine_device;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
|
TRACE("device_parent %p, present_parameters %p, swapchain %p\n", device_parent, present_parameters, swapchain);
|
||||||
|
|
||||||
hr = IWineD3DDeviceParent_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
|
hr = d3d10_device_QueryInterface((ID3D10Device *)device, &IID_IWineDXGIDevice, (void **)&wine_device);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("Device should implement IWineDXGIDevice\n");
|
ERR("Device should implement IWineDXGIDevice\n");
|
||||||
|
@ -1493,26 +1518,22 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
|
static const struct wined3d_device_parent_ops d3d10_wined3d_device_parent_ops =
|
||||||
{
|
{
|
||||||
/* IUnknown methods */
|
device_parent_wined3d_device_created,
|
||||||
device_parent_QueryInterface,
|
device_parent_create_surface,
|
||||||
device_parent_AddRef,
|
device_parent_create_rendertarget,
|
||||||
device_parent_Release,
|
device_parent_create_depth_stencil,
|
||||||
/* IWineD3DDeviceParent methods */
|
device_parent_create_volume,
|
||||||
device_parent_WineD3DDeviceCreated,
|
device_parent_create_swapchain,
|
||||||
device_parent_CreateSurface,
|
|
||||||
device_parent_CreateRenderTarget,
|
|
||||||
device_parent_CreateDepthStencilSurface,
|
|
||||||
device_parent_CreateVolume,
|
|
||||||
device_parent_CreateSwapChain,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void d3d10_device_init(struct d3d10_device *device, void *outer_unknown)
|
void d3d10_device_init(struct d3d10_device *device, void *outer_unknown)
|
||||||
{
|
{
|
||||||
device->vtbl = &d3d10_device_vtbl;
|
device->vtbl = &d3d10_device_vtbl;
|
||||||
device->inner_unknown_vtbl = &d3d10_device_inner_unknown_vtbl;
|
device->inner_unknown_vtbl = &d3d10_device_inner_unknown_vtbl;
|
||||||
device->device_parent_vtbl = &d3d10_wined3d_device_parent_vtbl;
|
device->IWineDXGIDeviceParent_iface.lpVtbl = &d3d10_dxgi_device_parent_vtbl;
|
||||||
|
device->device_parent.ops = &d3d10_wined3d_device_parent_ops;
|
||||||
device->refcount = 1;
|
device->refcount = 1;
|
||||||
device->outer_unknown = outer_unknown;
|
device->outer_unknown = outer_unknown;
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ struct IDirect3DDevice8Impl
|
||||||
{
|
{
|
||||||
/* IUnknown fields */
|
/* IUnknown fields */
|
||||||
IDirect3DDevice8 IDirect3DDevice8_iface;
|
IDirect3DDevice8 IDirect3DDevice8_iface;
|
||||||
IWineD3DDeviceParent IWineD3DDeviceParent_iface;
|
struct wined3d_device_parent device_parent;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
struct wined3d_device *wined3d_device;
|
struct wined3d_device *wined3d_device;
|
||||||
struct d3d8_handle_table handle_table;
|
struct d3d8_handle_table handle_table;
|
||||||
|
|
|
@ -274,13 +274,6 @@ static HRESULT WINAPI IDirect3DDevice8Impl_QueryInterface(IDirect3DDevice8 *ifac
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent))
|
|
||||||
{
|
|
||||||
IWineD3DDeviceParent_AddRef(&This->IWineD3DDeviceParent_iface);
|
|
||||||
*ppobj = &This->IWineD3DDeviceParent_iface;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
||||||
*ppobj = NULL;
|
*ppobj = NULL;
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
|
@ -2871,60 +2864,39 @@ static const IDirect3DDevice8Vtbl Direct3DDevice8_Vtbl =
|
||||||
IDirect3DDevice8Impl_DeletePatch
|
IDirect3DDevice8Impl_DeletePatch
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline IDirect3DDevice8Impl *impl_from_IWineD3DDeviceParent(IWineD3DDeviceParent *iface)
|
static inline IDirect3DDevice8Impl *device_from_device_parent(struct wined3d_device_parent *device_parent)
|
||||||
{
|
{
|
||||||
return CONTAINING_RECORD(iface, IDirect3DDevice8Impl, IWineD3DDeviceParent_iface);
|
return CONTAINING_RECORD(device_parent, IDirect3DDevice8Impl, device_parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface,
|
static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent,
|
||||||
REFIID riid, void **object)
|
|
||||||
{
|
|
||||||
IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
|
|
||||||
return IDirect3DDevice8Impl_QueryInterface(&This->IDirect3DDevice8_iface, riid, object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
|
|
||||||
{
|
|
||||||
IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
|
|
||||||
return IDirect3DDevice8Impl_AddRef(&This->IDirect3DDevice8_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
|
|
||||||
{
|
|
||||||
IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
|
|
||||||
return IDirect3DDevice8Impl_Release(&This->IDirect3DDevice8_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* IWineD3DDeviceParent methods */
|
|
||||||
|
|
||||||
static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface,
|
|
||||||
struct wined3d_device *device)
|
struct wined3d_device *device)
|
||||||
{
|
{
|
||||||
TRACE("iface %p, device %p\n", iface, device);
|
TRACE("device_parent %p, device %p\n", device_parent, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
|
||||||
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
||||||
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
|
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
|
||||||
{
|
{
|
||||||
IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
|
IDirect3DDevice8Impl *device = device_from_device_parent(device_parent);
|
||||||
IDirect3DSurface8Impl *d3d_surface;
|
IDirect3DSurface8Impl *d3d_surface;
|
||||||
BOOL lockable = TRUE;
|
BOOL lockable = TRUE;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n"
|
TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n"
|
||||||
"\tpool %#x, level %u, face %u, surface %p\n",
|
"\tpool %#x, level %u, face %u, surface %p.\n",
|
||||||
iface, container_parent, width, height, format, usage, pool, level, face, surface);
|
device_parent, container_parent, width, height, format, usage, pool, level, face, surface);
|
||||||
|
|
||||||
|
|
||||||
if (pool == WINED3DPOOL_DEFAULT && !(usage & WINED3DUSAGE_DYNAMIC)) lockable = FALSE;
|
if (pool == WINED3DPOOL_DEFAULT && !(usage & WINED3DUSAGE_DYNAMIC)) lockable = FALSE;
|
||||||
|
|
||||||
hr = IDirect3DDevice8Impl_CreateSurface(This, width, height,
|
hr = IDirect3DDevice8Impl_CreateSurface(device, width, height,
|
||||||
d3dformat_from_wined3dformat(format), lockable, FALSE /* Discard */, level,
|
d3dformat_from_wined3dformat(format), lockable, FALSE /* Discard */, level,
|
||||||
(IDirect3DSurface8 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
|
(IDirect3DSurface8 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("(%p) CreateSurface failed, returning %#x\n", iface, hr);
|
WARN("Failed to create surface, hr %#x.\n", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2941,77 +2913,80 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_parent *device_parent,
|
||||||
void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
|
void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
|
||||||
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
|
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
|
||||||
struct wined3d_surface **surface)
|
struct wined3d_surface **surface)
|
||||||
{
|
{
|
||||||
IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
|
IDirect3DDevice8Impl *device = device_from_device_parent(device_parent);
|
||||||
IDirect3DSurface8Impl *d3d_surface;
|
IDirect3DSurface8Impl *d3d_surface;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||||
"\tmultisample_quality %u, lockable %u, surface %p\n",
|
"\tmultisample_quality %u, lockable %u, surface %p.\n",
|
||||||
iface, container_parent, width, height, format, multisample_type, multisample_quality, lockable, surface);
|
device_parent, container_parent, width, height, format,
|
||||||
|
multisample_type, multisample_quality, lockable, surface);
|
||||||
|
|
||||||
hr = IDirect3DDevice8_CreateRenderTarget(&This->IDirect3DDevice8_iface, width, height,
|
hr = IDirect3DDevice8_CreateRenderTarget(&device->IDirect3DDevice8_iface, width, height,
|
||||||
d3dformat_from_wined3dformat(format), multisample_type, lockable, (IDirect3DSurface8 **)&d3d_surface);
|
d3dformat_from_wined3dformat(format), multisample_type, lockable, (IDirect3DSurface8 **)&d3d_surface);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("(%p) CreateRenderTarget failed, returning %#x\n", iface, hr);
|
WARN("Failed to create rendertarget, hr %#x.\n", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
*surface = d3d_surface->wined3d_surface;
|
*surface = d3d_surface->wined3d_surface;
|
||||||
wined3d_surface_incref(*surface);
|
wined3d_surface_incref(*surface);
|
||||||
|
|
||||||
d3d_surface->container = (IUnknown *)&This->IDirect3DDevice8_iface;
|
d3d_surface->container = (IUnknown *)&device->IDirect3DDevice8_iface;
|
||||||
/* Implicit surfaces are created with an refcount of 0 */
|
/* Implicit surfaces are created with an refcount of 0 */
|
||||||
IUnknown_Release((IUnknown *)d3d_surface);
|
IUnknown_Release((IUnknown *)d3d_surface);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_parent *device_parent,
|
||||||
UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type,
|
UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type,
|
||||||
DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
|
DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
|
||||||
{
|
{
|
||||||
IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
|
IDirect3DDevice8Impl *device = device_from_device_parent(device_parent);
|
||||||
IDirect3DSurface8Impl *d3d_surface;
|
IDirect3DSurface8Impl *d3d_surface;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
TRACE("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||||
"\tmultisample_quality %u, discard %u, surface %p\n",
|
"\tmultisample_quality %u, discard %u, surface %p.\n",
|
||||||
iface, width, height, format, multisample_type, multisample_quality, discard, surface);
|
device_parent, width, height, format, multisample_type, multisample_quality, discard, surface);
|
||||||
|
|
||||||
hr = IDirect3DDevice8_CreateDepthStencilSurface(&This->IDirect3DDevice8_iface, width, height,
|
hr = IDirect3DDevice8_CreateDepthStencilSurface(&device->IDirect3DDevice8_iface, width, height,
|
||||||
d3dformat_from_wined3dformat(format), multisample_type, (IDirect3DSurface8 **)&d3d_surface);
|
d3dformat_from_wined3dformat(format), multisample_type, (IDirect3DSurface8 **)&d3d_surface);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("(%p) CreateDepthStencilSurface failed, returning %#x\n", iface, hr);
|
WARN("Failed to create depth/stencil surface, hr %#x.\n", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
*surface = d3d_surface->wined3d_surface;
|
*surface = d3d_surface->wined3d_surface;
|
||||||
wined3d_surface_incref(*surface);
|
wined3d_surface_incref(*surface);
|
||||||
|
|
||||||
d3d_surface->container = (IUnknown *)&This->IDirect3DDevice8_iface;
|
d3d_surface->container = (IUnknown *)&device->IDirect3DDevice8_iface;
|
||||||
/* Implicit surfaces are created with an refcount of 0 */
|
/* Implicit surfaces are created with an refcount of 0 */
|
||||||
IUnknown_Release((IUnknown *)d3d_surface);
|
IUnknown_Release((IUnknown *)d3d_surface);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *device_parent,
|
||||||
void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
|
void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
|
||||||
WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume)
|
WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume)
|
||||||
{
|
{
|
||||||
IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
|
IDirect3DDevice8Impl *device = device_from_device_parent(device_parent);
|
||||||
IDirect3DVolume8Impl *object;
|
IDirect3DVolume8Impl *object;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, container_parent %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p\n",
|
TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, "
|
||||||
iface, container_parent, width, height, depth, format, pool, usage, volume);
|
"format %#x, pool %#x, usage %#x, volume %p.\n",
|
||||||
|
device_parent, container_parent, width, height, depth,
|
||||||
|
format, pool, usage, volume);
|
||||||
|
|
||||||
/* Allocate the storage for the device */
|
/* Allocate the storage for the device */
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||||
|
@ -3022,7 +2997,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
|
||||||
return D3DERR_OUTOFVIDEOMEMORY;
|
return D3DERR_OUTOFVIDEOMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = volume_init(object, This, width, height, depth, usage, format, pool);
|
hr = volume_init(object, device, width, height, depth, usage, format, pool);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
WARN("Failed to initialize volume, hr %#x.\n", hr);
|
WARN("Failed to initialize volume, hr %#x.\n", hr);
|
||||||
|
@ -3037,20 +3012,20 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
|
||||||
object->container = container_parent;
|
object->container = container_parent;
|
||||||
object->forwardReference = container_parent;
|
object->forwardReference = container_parent;
|
||||||
|
|
||||||
TRACE("(%p) Created volume %p\n", iface, object);
|
TRACE("Created volume %p.\n", object);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent,
|
||||||
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain)
|
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain)
|
||||||
{
|
{
|
||||||
IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
|
IDirect3DDevice8Impl *device = device_from_device_parent(device_parent);
|
||||||
D3DPRESENT_PARAMETERS local_parameters;
|
D3DPRESENT_PARAMETERS local_parameters;
|
||||||
IDirect3DSwapChain8 *d3d_swapchain;
|
IDirect3DSwapChain8 *d3d_swapchain;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
|
TRACE("device_parent %p, present_parameters %p, swapchain %p.\n", device_parent, present_parameters, swapchain);
|
||||||
|
|
||||||
/* Copy the presentation parameters */
|
/* Copy the presentation parameters */
|
||||||
local_parameters.BackBufferWidth = present_parameters->BackBufferWidth;
|
local_parameters.BackBufferWidth = present_parameters->BackBufferWidth;
|
||||||
|
@ -3067,11 +3042,11 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
|
||||||
local_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz;
|
local_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz;
|
||||||
local_parameters.FullScreen_PresentationInterval = present_parameters->PresentationInterval;
|
local_parameters.FullScreen_PresentationInterval = present_parameters->PresentationInterval;
|
||||||
|
|
||||||
hr = IDirect3DDevice8_CreateAdditionalSwapChain(&This->IDirect3DDevice8_iface,
|
hr = IDirect3DDevice8_CreateAdditionalSwapChain(&device->IDirect3DDevice8_iface,
|
||||||
&local_parameters, &d3d_swapchain);
|
&local_parameters, &d3d_swapchain);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("(%p) CreateAdditionalSwapChain failed, returning %#x\n", iface, hr);
|
WARN("Failed to create swapchain, hr %#x.\n", hr);
|
||||||
*swapchain = NULL;
|
*swapchain = NULL;
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -3098,19 +3073,14 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const IWineD3DDeviceParentVtbl d3d8_wined3d_device_parent_vtbl =
|
static const struct wined3d_device_parent_ops d3d8_wined3d_device_parent_ops =
|
||||||
{
|
{
|
||||||
/* IUnknown methods */
|
device_parent_wined3d_device_created,
|
||||||
device_parent_QueryInterface,
|
device_parent_create_surface,
|
||||||
device_parent_AddRef,
|
device_parent_create_rendertarget,
|
||||||
device_parent_Release,
|
device_parent_create_depth_stencil,
|
||||||
/* IWineD3DDeviceParent methods */
|
device_parent_create_volume,
|
||||||
device_parent_WineD3DDeviceCreated,
|
device_parent_create_swapchain,
|
||||||
device_parent_CreateSurface,
|
|
||||||
device_parent_CreateRenderTarget,
|
|
||||||
device_parent_CreateDepthStencilSurface,
|
|
||||||
device_parent_CreateVolume,
|
|
||||||
device_parent_CreateSwapChain,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void setup_fpu(void)
|
static void setup_fpu(void)
|
||||||
|
@ -3132,7 +3102,7 @@ HRESULT device_init(IDirect3DDevice8Impl *device, struct wined3d *wined3d, UINT
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
device->IDirect3DDevice8_iface.lpVtbl = &Direct3DDevice8_Vtbl;
|
device->IDirect3DDevice8_iface.lpVtbl = &Direct3DDevice8_Vtbl;
|
||||||
device->IWineD3DDeviceParent_iface.lpVtbl = &d3d8_wined3d_device_parent_vtbl;
|
device->device_parent.ops = &d3d8_wined3d_device_parent_ops;
|
||||||
device->ref = 1;
|
device->ref = 1;
|
||||||
device->handle_table.entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
device->handle_table.entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||||
D3D8_INITIAL_HANDLE_TABLE_SIZE * sizeof(*device->handle_table.entries));
|
D3D8_INITIAL_HANDLE_TABLE_SIZE * sizeof(*device->handle_table.entries));
|
||||||
|
@ -3147,7 +3117,7 @@ HRESULT device_init(IDirect3DDevice8Impl *device, struct wined3d *wined3d, UINT
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = wined3d_device_create(wined3d, adapter, device_type, focus_window, flags,
|
hr = wined3d_device_create(wined3d, adapter, device_type, focus_window, flags,
|
||||||
&device->IWineD3DDeviceParent_iface, &device->wined3d_device);
|
&device->device_parent, &device->wined3d_device);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
WARN("Failed to create wined3d device, hr %#x.\n", hr);
|
WARN("Failed to create wined3d device, hr %#x.\n", hr);
|
||||||
|
|
|
@ -163,7 +163,7 @@ void filter_caps(D3DCAPS9* pCaps) DECLSPEC_HIDDEN;
|
||||||
typedef struct IDirect3DDevice9Impl
|
typedef struct IDirect3DDevice9Impl
|
||||||
{
|
{
|
||||||
IDirect3DDevice9Ex IDirect3DDevice9Ex_iface;
|
IDirect3DDevice9Ex IDirect3DDevice9Ex_iface;
|
||||||
const IWineD3DDeviceParentVtbl *device_parent_vtbl;
|
struct wined3d_device_parent device_parent;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
struct wined3d_device *wined3d_device;
|
struct wined3d_device *wined3d_device;
|
||||||
/* Avoids recursion with nested ReleaseRef to 0 */
|
/* Avoids recursion with nested ReleaseRef to 0 */
|
||||||
|
|
|
@ -222,13 +222,6 @@ static HRESULT WINAPI IDirect3DDevice9Impl_QueryInterface(IDirect3DDevice9Ex *if
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent))
|
|
||||||
{
|
|
||||||
IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl);
|
|
||||||
*ppobj = &This->device_parent_vtbl;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
||||||
*ppobj = NULL;
|
*ppobj = NULL;
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
|
@ -3120,63 +3113,39 @@ static const IDirect3DDevice9ExVtbl Direct3DDevice9_Vtbl =
|
||||||
IDirect3DDevice9ExImpl_GetDisplayModeEx
|
IDirect3DDevice9ExImpl_GetDisplayModeEx
|
||||||
};
|
};
|
||||||
|
|
||||||
/* IWineD3DDeviceParent IUnknown methods */
|
static inline struct IDirect3DDevice9Impl *device_from_device_parent(struct wined3d_device_parent *device_parent)
|
||||||
|
|
||||||
static inline struct IDirect3DDevice9Impl *device_from_device_parent(IWineD3DDeviceParent *iface)
|
|
||||||
{
|
{
|
||||||
return (struct IDirect3DDevice9Impl *)((char*)iface
|
return CONTAINING_RECORD(device_parent, struct IDirect3DDevice9Impl, device_parent);
|
||||||
- FIELD_OFFSET(struct IDirect3DDevice9Impl, device_parent_vtbl));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface,
|
static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent,
|
||||||
REFIID riid, void **object)
|
|
||||||
{
|
|
||||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
|
||||||
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(&This->IDirect3DDevice9Ex_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
|
|
||||||
{
|
|
||||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
|
||||||
return IDirect3DDevice9Impl_Release(&This->IDirect3DDevice9Ex_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* IWineD3DDeviceParent methods */
|
|
||||||
|
|
||||||
static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface,
|
|
||||||
struct wined3d_device *device)
|
struct wined3d_device *device)
|
||||||
{
|
{
|
||||||
TRACE("iface %p, device %p\n", iface, device);
|
TRACE("device_parent %p, device %p.\n", device_parent, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
|
||||||
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
||||||
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
|
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
|
||||||
{
|
{
|
||||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
struct IDirect3DDevice9Impl *device = device_from_device_parent(device_parent);
|
||||||
IDirect3DSurface9Impl *d3d_surface;
|
IDirect3DSurface9Impl *d3d_surface;
|
||||||
BOOL lockable = TRUE;
|
BOOL lockable = TRUE;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n"
|
TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n"
|
||||||
"\tpool %#x, level %u, face %u, surface %p\n",
|
"\tpool %#x, level %u, face %u, surface %p.\n",
|
||||||
iface, container_parent, width, height, format, usage, pool, level, face, surface);
|
device_parent, container_parent, width, height, format, usage, pool, level, face, surface);
|
||||||
|
|
||||||
if (pool == WINED3DPOOL_DEFAULT && !(usage & D3DUSAGE_DYNAMIC))
|
if (pool == WINED3DPOOL_DEFAULT && !(usage & D3DUSAGE_DYNAMIC))
|
||||||
lockable = FALSE;
|
lockable = FALSE;
|
||||||
|
|
||||||
hr = IDirect3DDevice9Impl_CreateSurface(This, width, height,
|
hr = IDirect3DDevice9Impl_CreateSurface(device, width, height,
|
||||||
d3dformat_from_wined3dformat(format), lockable, FALSE /* Discard */, level,
|
d3dformat_from_wined3dformat(format), lockable, FALSE /* Discard */, level,
|
||||||
(IDirect3DSurface9 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
|
(IDirect3DSurface9 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("(%p) CreateSurface failed, returning %#x\n", iface, hr);
|
WARN("Failed to create surface, hr %#x.\n", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3193,25 +3162,26 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_parent *device_parent,
|
||||||
void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
|
void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
|
||||||
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
|
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
|
||||||
struct wined3d_surface **surface)
|
struct wined3d_surface **surface)
|
||||||
{
|
{
|
||||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
struct IDirect3DDevice9Impl *device = device_from_device_parent(device_parent);
|
||||||
IDirect3DSurface9Impl *d3d_surface;
|
IDirect3DSurface9Impl *d3d_surface;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||||
"\tmultisample_quality %u, lockable %u, surface %p\n",
|
"\tmultisample_quality %u, lockable %u, surface %p.\n",
|
||||||
iface, container_parent, width, height, format, multisample_type, multisample_quality, lockable, surface);
|
device_parent, container_parent, width, height, format, multisample_type,
|
||||||
|
multisample_quality, lockable, surface);
|
||||||
|
|
||||||
hr = IDirect3DDevice9Impl_CreateRenderTarget(&This->IDirect3DDevice9Ex_iface, width, height,
|
hr = IDirect3DDevice9Impl_CreateRenderTarget(&device->IDirect3DDevice9Ex_iface, width, height,
|
||||||
d3dformat_from_wined3dformat(format), multisample_type, multisample_quality, lockable,
|
d3dformat_from_wined3dformat(format), multisample_type, multisample_quality, lockable,
|
||||||
(IDirect3DSurface9 **)&d3d_surface, NULL);
|
(IDirect3DSurface9 **)&d3d_surface, NULL);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("(%p) CreateRenderTarget failed, returning %#x\n", iface, hr);
|
WARN("Failed to create rendertarget, hr %#x.\n", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3225,46 +3195,48 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_parent *device_parent,
|
||||||
UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type,
|
UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type,
|
||||||
DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
|
DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
|
||||||
{
|
{
|
||||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
struct IDirect3DDevice9Impl *device = device_from_device_parent(device_parent);
|
||||||
IDirect3DSurface9Impl *d3d_surface;
|
IDirect3DSurface9Impl *d3d_surface;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
TRACE("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||||
"\tmultisample_quality %u, discard %u, surface %p\n",
|
"\tmultisample_quality %u, discard %u, surface %p.\n",
|
||||||
iface, width, height, format, multisample_type, multisample_quality, discard, surface);
|
device_parent, width, height, format, multisample_type, multisample_quality, discard, surface);
|
||||||
|
|
||||||
hr = IDirect3DDevice9Impl_CreateDepthStencilSurface(&This->IDirect3DDevice9Ex_iface, width,
|
hr = IDirect3DDevice9Impl_CreateDepthStencilSurface(&device->IDirect3DDevice9Ex_iface, width,
|
||||||
height, d3dformat_from_wined3dformat(format), multisample_type, multisample_quality,
|
height, d3dformat_from_wined3dformat(format), multisample_type, multisample_quality,
|
||||||
discard, (IDirect3DSurface9 **)&d3d_surface, NULL);
|
discard, (IDirect3DSurface9 **)&d3d_surface, NULL);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("(%p) CreateDepthStencilSurface failed, returning %#x\n", iface, hr);
|
WARN("Failed to create depth/stencil surface, hr %#x.\n", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
*surface = d3d_surface->wined3d_surface;
|
*surface = d3d_surface->wined3d_surface;
|
||||||
wined3d_surface_incref(*surface);
|
wined3d_surface_incref(*surface);
|
||||||
d3d_surface->container = (IUnknown *)&This->IDirect3DDevice9Ex_iface;
|
d3d_surface->container = (IUnknown *)&device->IDirect3DDevice9Ex_iface;
|
||||||
/* Implicit surfaces are created with an refcount of 0 */
|
/* Implicit surfaces are created with an refcount of 0 */
|
||||||
IDirect3DSurface9_Release((IDirect3DSurface9 *)d3d_surface);
|
IDirect3DSurface9_Release((IDirect3DSurface9 *)d3d_surface);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *device_parent,
|
||||||
void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
|
void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
|
||||||
WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume)
|
WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume)
|
||||||
{
|
{
|
||||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
struct IDirect3DDevice9Impl *device = device_from_device_parent(device_parent);
|
||||||
IDirect3DVolume9Impl *object;
|
IDirect3DVolume9Impl *object;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, container_parent %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p\n",
|
TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, "
|
||||||
iface, container_parent, width, height, depth, format, pool, usage, volume);
|
"format %#x, pool %#x, usage %#x, volume %p\n",
|
||||||
|
device_parent, container_parent, width, height, depth,
|
||||||
|
format, pool, usage, volume);
|
||||||
|
|
||||||
/* Allocate the storage for the device */
|
/* Allocate the storage for the device */
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||||
|
@ -3275,7 +3247,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
|
||||||
return D3DERR_OUTOFVIDEOMEMORY;
|
return D3DERR_OUTOFVIDEOMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = volume_init(object, This, width, height, depth, usage, format, pool);
|
hr = volume_init(object, device, width, height, depth, usage, format, pool);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
WARN("Failed to initialize volume, hr %#x.\n", hr);
|
WARN("Failed to initialize volume, hr %#x.\n", hr);
|
||||||
|
@ -3290,20 +3262,20 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
|
||||||
object->container = container_parent;
|
object->container = container_parent;
|
||||||
object->forwardReference = container_parent;
|
object->forwardReference = container_parent;
|
||||||
|
|
||||||
TRACE("(%p) Created volume %p\n", iface, object);
|
TRACE("Created volume %p.\n", object);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent,
|
||||||
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain)
|
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain)
|
||||||
{
|
{
|
||||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
struct IDirect3DDevice9Impl *device = device_from_device_parent(device_parent);
|
||||||
D3DPRESENT_PARAMETERS local_parameters;
|
D3DPRESENT_PARAMETERS local_parameters;
|
||||||
IDirect3DSwapChain9 *d3d_swapchain;
|
IDirect3DSwapChain9 *d3d_swapchain;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
|
TRACE("device_parent %p, present_parameters %p, swapchain %p\n", device_parent, present_parameters, swapchain);
|
||||||
|
|
||||||
/* Copy the presentation parameters */
|
/* Copy the presentation parameters */
|
||||||
local_parameters.BackBufferWidth = present_parameters->BackBufferWidth;
|
local_parameters.BackBufferWidth = present_parameters->BackBufferWidth;
|
||||||
|
@ -3321,11 +3293,11 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
|
||||||
local_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz;
|
local_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz;
|
||||||
local_parameters.PresentationInterval = present_parameters->PresentationInterval;
|
local_parameters.PresentationInterval = present_parameters->PresentationInterval;
|
||||||
|
|
||||||
hr = IDirect3DDevice9Impl_CreateAdditionalSwapChain(&This->IDirect3DDevice9Ex_iface,
|
hr = IDirect3DDevice9Impl_CreateAdditionalSwapChain(&device->IDirect3DDevice9Ex_iface,
|
||||||
&local_parameters, &d3d_swapchain);
|
&local_parameters, &d3d_swapchain);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("(%p) CreateAdditionalSwapChain failed, returning %#x\n", iface, hr);
|
WARN("Failed to create swapchain, hr %#x.\n", hr);
|
||||||
*swapchain = NULL;
|
*swapchain = NULL;
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -3353,19 +3325,14 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const IWineD3DDeviceParentVtbl d3d9_wined3d_device_parent_vtbl =
|
static const struct wined3d_device_parent_ops d3d9_wined3d_device_parent_ops =
|
||||||
{
|
{
|
||||||
/* IUnknown methods */
|
device_parent_wined3d_device_created,
|
||||||
device_parent_QueryInterface,
|
device_parent_create_surface,
|
||||||
device_parent_AddRef,
|
device_parent_create_rendertarget,
|
||||||
device_parent_Release,
|
device_parent_create_depth_stencil,
|
||||||
/* IWineD3DDeviceParent methods */
|
device_parent_create_volume,
|
||||||
device_parent_WineD3DDeviceCreated,
|
device_parent_create_swapchain,
|
||||||
device_parent_CreateSurface,
|
|
||||||
device_parent_CreateRenderTarget,
|
|
||||||
device_parent_CreateDepthStencilSurface,
|
|
||||||
device_parent_CreateVolume,
|
|
||||||
device_parent_CreateSwapChain,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void setup_fpu(void)
|
static void setup_fpu(void)
|
||||||
|
@ -3391,14 +3358,14 @@ HRESULT device_init(IDirect3DDevice9Impl *device, struct wined3d *wined3d, UINT
|
||||||
FIXME("Ignoring display mode.\n");
|
FIXME("Ignoring display mode.\n");
|
||||||
|
|
||||||
device->IDirect3DDevice9Ex_iface.lpVtbl = &Direct3DDevice9_Vtbl;
|
device->IDirect3DDevice9Ex_iface.lpVtbl = &Direct3DDevice9_Vtbl;
|
||||||
device->device_parent_vtbl = &d3d9_wined3d_device_parent_vtbl;
|
device->device_parent.ops = &d3d9_wined3d_device_parent_ops;
|
||||||
device->ref = 1;
|
device->ref = 1;
|
||||||
|
|
||||||
if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu();
|
if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu();
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = wined3d_device_create(wined3d, adapter, device_type, focus_window, flags,
|
hr = wined3d_device_create(wined3d, adapter, device_type, focus_window, flags,
|
||||||
(IWineD3DDeviceParent *)&device->device_parent_vtbl, &device->wined3d_device);
|
&device->device_parent, &device->wined3d_device);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
WARN("Failed to create wined3d device, hr %#x.\n", hr);
|
WARN("Failed to create wined3d device, hr %#x.\n", hr);
|
||||||
|
|
|
@ -221,11 +221,6 @@ static HRESULT WINAPI ddraw7_QueryInterface(IDirectDraw7 *iface, REFIID refiid,
|
||||||
TRACE(" returning Direct3D7 interface at %p.\n", *obj);
|
TRACE(" returning Direct3D7 interface at %p.\n", *obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (IsEqualGUID(refiid, &IID_IWineD3DDeviceParent))
|
|
||||||
{
|
|
||||||
*obj = &This->device_parent_vtbl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Unknown interface */
|
/* Unknown interface */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5624,51 +5619,29 @@ struct wined3d_vertex_declaration *ddraw_find_decl(IDirectDrawImpl *This, DWORD
|
||||||
return pDecl;
|
return pDecl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IWineD3DDeviceParent IUnknown methods */
|
static inline struct IDirectDrawImpl *ddraw_from_device_parent(struct wined3d_device_parent *device_parent)
|
||||||
|
|
||||||
static inline struct IDirectDrawImpl *ddraw_from_device_parent(IWineD3DDeviceParent *iface)
|
|
||||||
{
|
{
|
||||||
return (struct IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(struct IDirectDrawImpl, device_parent_vtbl));
|
return CONTAINING_RECORD(device_parent, struct IDirectDrawImpl, device_parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
|
static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent,
|
||||||
{
|
|
||||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
|
||||||
return ddraw7_QueryInterface(&This->IDirectDraw7_iface, riid, object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
|
|
||||||
{
|
|
||||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
|
||||||
return ddraw7_AddRef(&This->IDirectDraw7_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
|
|
||||||
{
|
|
||||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
|
||||||
return ddraw7_Release(&This->IDirectDraw7_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* IWineD3DDeviceParent methods */
|
|
||||||
|
|
||||||
static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface,
|
|
||||||
struct wined3d_device *device)
|
struct wined3d_device *device)
|
||||||
{
|
{
|
||||||
TRACE("iface %p, device %p\n", iface, device);
|
TRACE("device_parent %p, device %p.\n", device_parent, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
|
||||||
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
||||||
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
|
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface)
|
||||||
{
|
{
|
||||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent);
|
||||||
IDirectDrawSurfaceImpl *surf = NULL;
|
IDirectDrawSurfaceImpl *surf = NULL;
|
||||||
UINT i = 0;
|
UINT i = 0;
|
||||||
DDSCAPS2 searchcaps = This->tex_root->surface_desc.ddsCaps;
|
DDSCAPS2 searchcaps = ddraw->tex_root->surface_desc.ddsCaps;
|
||||||
|
|
||||||
TRACE("iface %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n"
|
TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n"
|
||||||
"\tpool %#x, level %u, face %u, surface %p\n",
|
"\tpool %#x, level %u, face %u, surface %p.\n",
|
||||||
iface, container_parent, width, height, format, usage, pool, level, face, surface);
|
device_parent, container_parent, width, height, format, usage, pool, level, face, surface);
|
||||||
|
|
||||||
searchcaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_ALLFACES;
|
searchcaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_ALLFACES;
|
||||||
switch(face)
|
switch(face)
|
||||||
|
@ -5679,7 +5652,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
|
||||||
{
|
{
|
||||||
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEX;
|
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEX;
|
||||||
}
|
}
|
||||||
surf = This->tex_root; break;
|
surf = ddraw->tex_root; break;
|
||||||
case WINED3DCUBEMAP_FACE_NEGATIVE_X:
|
case WINED3DCUBEMAP_FACE_NEGATIVE_X:
|
||||||
TRACE("Asked for negative x\n");
|
TRACE("Asked for negative x\n");
|
||||||
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEX; break;
|
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEX; break;
|
||||||
|
@ -5701,7 +5674,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
|
||||||
if (!surf)
|
if (!surf)
|
||||||
{
|
{
|
||||||
IDirectDrawSurface7 *attached;
|
IDirectDrawSurface7 *attached;
|
||||||
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)This->tex_root, &searchcaps, &attached);
|
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)ddraw->tex_root, &searchcaps, &attached);
|
||||||
surf = (IDirectDrawSurfaceImpl *)attached;
|
surf = (IDirectDrawSurfaceImpl *)attached;
|
||||||
IDirectDrawSurface7_Release(attached);
|
IDirectDrawSurface7_Release(attached);
|
||||||
}
|
}
|
||||||
|
@ -5748,18 +5721,19 @@ static HRESULT WINAPI findRenderTarget(IDirectDrawSurface7 *surface, DDSURFACEDE
|
||||||
return DDENUMRET_OK;
|
return DDENUMRET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_parent *device_parent,
|
||||||
void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
|
void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
|
||||||
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
|
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
|
||||||
struct wined3d_surface **surface)
|
struct wined3d_surface **surface)
|
||||||
{
|
{
|
||||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent);
|
||||||
IDirectDrawSurfaceImpl *d3d_surface = This->d3d_target;
|
IDirectDrawSurfaceImpl *d3d_surface = ddraw->d3d_target;
|
||||||
IDirectDrawSurfaceImpl *target = NULL;
|
IDirectDrawSurfaceImpl *target = NULL;
|
||||||
|
|
||||||
TRACE("iface %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||||
"\tmultisample_quality %u, lockable %u, surface %p\n",
|
"\tmultisample_quality %u, lockable %u, surface %p.\n",
|
||||||
iface, container_parent, width, height, format, multisample_type, multisample_quality, lockable, surface);
|
device_parent, container_parent, width, height, format, multisample_type,
|
||||||
|
multisample_quality, lockable, surface);
|
||||||
|
|
||||||
if (d3d_surface->isRenderTarget)
|
if (d3d_surface->isRenderTarget)
|
||||||
{
|
{
|
||||||
|
@ -5772,8 +5746,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
|
||||||
|
|
||||||
if (!target)
|
if (!target)
|
||||||
{
|
{
|
||||||
target = This->d3d_target;
|
target = ddraw->d3d_target;
|
||||||
ERR(" (%p) : No DirectDrawSurface found to create the back buffer. Using the front buffer as back buffer. Uncertain consequences\n", This);
|
ERR(" (%p) : No DirectDrawSurface found to create the back buffer. Using the front buffer as back buffer. Uncertain consequences\n", ddraw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Return failure if the dimensions do not match, but this shouldn't happen */
|
/* TODO: Return failure if the dimensions do not match, but this shouldn't happen */
|
||||||
|
@ -5787,18 +5761,18 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_parent *device_parent,
|
||||||
UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type,
|
UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type,
|
||||||
DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
|
DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface)
|
||||||
{
|
{
|
||||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent);
|
||||||
IDirectDrawSurfaceImpl *ddraw_surface;
|
IDirectDrawSurfaceImpl *ddraw_surface;
|
||||||
DDSURFACEDESC2 ddsd;
|
DDSURFACEDESC2 ddsd;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
TRACE("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||||
"\tmultisample_quality %u, discard %u, surface %p\n",
|
"\tmultisample_quality %u, discard %u, surface %p.\n",
|
||||||
iface, width, height, format, multisample_type, multisample_quality, discard, surface);
|
device_parent, width, height, format, multisample_type, multisample_quality, discard, surface);
|
||||||
|
|
||||||
*surface = NULL;
|
*surface = NULL;
|
||||||
|
|
||||||
|
@ -5819,13 +5793,13 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
|
||||||
ddsd.dwFlags ^= DDSD_PIXELFORMAT;
|
ddsd.dwFlags ^= DDSD_PIXELFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
This->depthstencil = TRUE;
|
ddraw->depthstencil = TRUE;
|
||||||
hr = IDirectDraw7_CreateSurface(&This->IDirectDraw7_iface, &ddsd,
|
hr = IDirectDraw7_CreateSurface(&ddraw->IDirectDraw7_iface, &ddsd,
|
||||||
(IDirectDrawSurface7 **)&ddraw_surface, NULL);
|
(IDirectDrawSurface7 **)&ddraw_surface, NULL);
|
||||||
This->depthstencil = FALSE;
|
ddraw->depthstencil = FALSE;
|
||||||
if(FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR(" (%p) Creating a DepthStencil Surface failed, result = %x\n", This, hr);
|
WARN("Failed to create depth/stencil surface, hr %#x.\n", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5836,38 +5810,40 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *device_parent,
|
||||||
void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
|
void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
|
||||||
WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume)
|
WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume)
|
||||||
{
|
{
|
||||||
TRACE("iface %p, container_parent %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p\n",
|
TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, "
|
||||||
iface, container_parent, width, height, depth, format, pool, usage, volume);
|
"format %#x, pool %#x, usage %#x, volume %p.\n",
|
||||||
|
device_parent, container_parent, width, height, depth,
|
||||||
|
format, pool, usage, volume);
|
||||||
|
|
||||||
ERR("Not implemented!\n");
|
ERR("Not implemented!\n");
|
||||||
|
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
|
static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent,
|
||||||
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain)
|
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain)
|
||||||
{
|
{
|
||||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent);
|
||||||
IDirectDrawSurfaceImpl *iterator;
|
IDirectDrawSurfaceImpl *iterator;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
|
TRACE("device_parent %p, present_parameters %p, swapchain %p.\n", device_parent, present_parameters, swapchain);
|
||||||
|
|
||||||
hr = wined3d_swapchain_create(This->wined3d_device, present_parameters,
|
hr = wined3d_swapchain_create(ddraw->wined3d_device, present_parameters,
|
||||||
This->ImplType, NULL, &ddraw_null_wined3d_parent_ops, swapchain);
|
ddraw->ImplType, NULL, &ddraw_null_wined3d_parent_ops, swapchain);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
FIXME("(%p) CreateSwapChain failed, returning %#x\n", iface, hr);
|
WARN("Failed to create swapchain, hr %#x.\n", hr);
|
||||||
*swapchain = NULL;
|
*swapchain = NULL;
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
This->d3d_target->wined3d_swapchain = *swapchain;
|
ddraw->d3d_target->wined3d_swapchain = *swapchain;
|
||||||
iterator = This->d3d_target->complex_array[0];
|
iterator = ddraw->d3d_target->complex_array[0];
|
||||||
while (iterator)
|
while (iterator)
|
||||||
{
|
{
|
||||||
iterator->wined3d_swapchain = *swapchain;
|
iterator->wined3d_swapchain = *swapchain;
|
||||||
|
@ -5877,19 +5853,14 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const IWineD3DDeviceParentVtbl ddraw_wined3d_device_parent_vtbl =
|
static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops =
|
||||||
{
|
{
|
||||||
/* IUnknown methods */
|
device_parent_wined3d_device_created,
|
||||||
device_parent_QueryInterface,
|
device_parent_create_surface,
|
||||||
device_parent_AddRef,
|
device_parent_create_rendertarget,
|
||||||
device_parent_Release,
|
device_parent_create_depth_stencil,
|
||||||
/* IWineD3DDeviceParent methods */
|
device_parent_create_volume,
|
||||||
device_parent_WineD3DDeviceCreated,
|
device_parent_create_swapchain,
|
||||||
device_parent_CreateSurface,
|
|
||||||
device_parent_CreateRenderTarget,
|
|
||||||
device_parent_CreateDepthStencilSurface,
|
|
||||||
device_parent_CreateVolume,
|
|
||||||
device_parent_CreateSwapChain,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type)
|
HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type)
|
||||||
|
@ -5906,7 +5877,7 @@ HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type)
|
||||||
ddraw->IDirect3D2_iface.lpVtbl = &d3d2_vtbl;
|
ddraw->IDirect3D2_iface.lpVtbl = &d3d2_vtbl;
|
||||||
ddraw->IDirect3D3_iface.lpVtbl = &d3d3_vtbl;
|
ddraw->IDirect3D3_iface.lpVtbl = &d3d3_vtbl;
|
||||||
ddraw->IDirect3D7_iface.lpVtbl = &d3d7_vtbl;
|
ddraw->IDirect3D7_iface.lpVtbl = &d3d7_vtbl;
|
||||||
ddraw->device_parent_vtbl = &ddraw_wined3d_device_parent_vtbl;
|
ddraw->device_parent.ops = &ddraw_wined3d_device_parent_ops;
|
||||||
ddraw->numIfaces = 1;
|
ddraw->numIfaces = 1;
|
||||||
ddraw->ref7 = 1;
|
ddraw->ref7 = 1;
|
||||||
|
|
||||||
|
@ -5928,8 +5899,8 @@ HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = wined3d_device_create(ddraw->wineD3D, WINED3DADAPTER_DEFAULT, device_type, NULL, 0,
|
hr = wined3d_device_create(ddraw->wineD3D, WINED3DADAPTER_DEFAULT, device_type,
|
||||||
(IWineD3DDeviceParent *)&ddraw->device_parent_vtbl, &ddraw->wined3d_device);
|
NULL, 0, &ddraw->device_parent, &ddraw->wined3d_device);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
WARN("Failed to create a wined3d device, hr %#x.\n", hr);
|
WARN("Failed to create a wined3d device, hr %#x.\n", hr);
|
||||||
|
|
|
@ -78,7 +78,7 @@ struct IDirectDrawImpl
|
||||||
IDirect3D3 IDirect3D3_iface;
|
IDirect3D3 IDirect3D3_iface;
|
||||||
IDirect3D2 IDirect3D2_iface;
|
IDirect3D2 IDirect3D2_iface;
|
||||||
IDirect3D IDirect3D_iface;
|
IDirect3D IDirect3D_iface;
|
||||||
const IWineD3DDeviceParentVtbl *device_parent_vtbl;
|
struct wined3d_device_parent device_parent;
|
||||||
|
|
||||||
/* See comment in IDirectDraw::AddRef */
|
/* See comment in IDirectDraw::AddRef */
|
||||||
LONG ref7, ref4, ref2, ref3, ref1, numIfaces;
|
LONG ref7, ref4, ref2, ref3, ref1, numIfaces;
|
||||||
|
|
|
@ -158,7 +158,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
|
||||||
const DXGI_SURFACE_DESC *desc, UINT surface_count, DXGI_USAGE usage,
|
const DXGI_SURFACE_DESC *desc, UINT surface_count, DXGI_USAGE usage,
|
||||||
const DXGI_SHARED_RESOURCE *shared_resource, IDXGISurface **surface)
|
const DXGI_SHARED_RESOURCE *shared_resource, IDXGISurface **surface)
|
||||||
{
|
{
|
||||||
IWineD3DDeviceParent *device_parent;
|
struct wined3d_device_parent *device_parent;
|
||||||
|
IWineDXGIDeviceParent *dxgi_device_parent;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
UINT i;
|
UINT i;
|
||||||
UINT j;
|
UINT j;
|
||||||
|
@ -166,13 +167,15 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
|
||||||
TRACE("iface %p, desc %p, surface_count %u, usage %#x, shared_resource %p, surface %p\n",
|
TRACE("iface %p, desc %p, surface_count %u, usage %#x, shared_resource %p, surface %p\n",
|
||||||
iface, desc, surface_count, usage, shared_resource, surface);
|
iface, desc, surface_count, usage, shared_resource, surface);
|
||||||
|
|
||||||
hr = IWineDXGIDevice_QueryInterface(iface, &IID_IWineD3DDeviceParent, (void **)&device_parent);
|
hr = IWineDXGIDevice_QueryInterface(iface, &IID_IWineDXGIDeviceParent, (void **)&dxgi_device_parent);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("Device should implement IWineD3DDeviceParent\n");
|
ERR("Device should implement IWineD3DDeviceParent\n");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
device_parent = IWineDXGIDeviceParent_get_wined3d_device_parent(dxgi_device_parent);
|
||||||
|
|
||||||
FIXME("Implement DXGI<->wined3d usage conversion\n");
|
FIXME("Implement DXGI<->wined3d usage conversion\n");
|
||||||
|
|
||||||
memset(surface, 0, surface_count * sizeof(*surface));
|
memset(surface, 0, surface_count * sizeof(*surface));
|
||||||
|
@ -181,7 +184,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
|
||||||
struct wined3d_surface *wined3d_surface;
|
struct wined3d_surface *wined3d_surface;
|
||||||
IUnknown *parent;
|
IUnknown *parent;
|
||||||
|
|
||||||
hr = IWineD3DDeviceParent_CreateSurface(device_parent, NULL, desc->Width, desc->Height,
|
hr = device_parent->ops->create_surface(device_parent, NULL, desc->Width, desc->Height,
|
||||||
wined3dformat_from_dxgi_format(desc->Format), usage, WINED3DPOOL_DEFAULT, 0,
|
wined3dformat_from_dxgi_format(desc->Format), usage, WINED3DPOOL_DEFAULT, 0,
|
||||||
WINED3DCUBEMAP_FACE_POSITIVE_X, &wined3d_surface);
|
WINED3DCUBEMAP_FACE_POSITIVE_X, &wined3d_surface);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
|
@ -201,7 +204,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
|
||||||
|
|
||||||
TRACE("Created IDXGISurface %p (%u/%u)\n", surface[i], i + 1, surface_count);
|
TRACE("Created IDXGISurface %p (%u/%u)\n", surface[i], i + 1, surface_count);
|
||||||
}
|
}
|
||||||
IWineD3DDeviceParent_Release(device_parent);
|
IWineDXGIDeviceParent_Release(dxgi_device_parent);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
|
@ -210,7 +213,7 @@ fail:
|
||||||
{
|
{
|
||||||
IDXGISurface_Release(surface[i]);
|
IDXGISurface_Release(surface[i]);
|
||||||
}
|
}
|
||||||
IWineD3DDeviceParent_Release(device_parent);
|
IWineDXGIDeviceParent_Release(dxgi_device_parent);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +340,8 @@ static const struct IWineDXGIDeviceVtbl dxgi_device_vtbl =
|
||||||
HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *layer,
|
HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *layer,
|
||||||
IDXGIFactory *factory, IDXGIAdapter *adapter)
|
IDXGIFactory *factory, IDXGIAdapter *adapter)
|
||||||
{
|
{
|
||||||
IWineD3DDeviceParent *wined3d_device_parent;
|
struct wined3d_device_parent *wined3d_device_parent;
|
||||||
|
IWineDXGIDeviceParent *dxgi_device_parent;
|
||||||
IWineDXGIAdapter *wine_adapter;
|
IWineDXGIAdapter *wine_adapter;
|
||||||
UINT adapter_ordinal;
|
UINT adapter_ordinal;
|
||||||
struct wined3d *wined3d;
|
struct wined3d *wined3d;
|
||||||
|
@ -377,18 +381,20 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
|
||||||
adapter_ordinal = IWineDXGIAdapter_get_ordinal(wine_adapter);
|
adapter_ordinal = IWineDXGIAdapter_get_ordinal(wine_adapter);
|
||||||
IWineDXGIAdapter_Release(wine_adapter);
|
IWineDXGIAdapter_Release(wine_adapter);
|
||||||
|
|
||||||
hr = IUnknown_QueryInterface((IUnknown *)device, &IID_IWineD3DDeviceParent, (void **)&wined3d_device_parent);
|
hr = IUnknown_QueryInterface((IUnknown *)device, &IID_IWineDXGIDeviceParent, (void **)&dxgi_device_parent);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("DXGI device should implement IWineD3DDeviceParent.\n");
|
ERR("DXGI device should implement IWineD3DDeviceParent.\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wined3d_device_parent = IWineDXGIDeviceParent_get_wined3d_device_parent(dxgi_device_parent);
|
||||||
|
|
||||||
FIXME("Ignoring adapter type.\n");
|
FIXME("Ignoring adapter type.\n");
|
||||||
EnterCriticalSection(&dxgi_cs);
|
EnterCriticalSection(&dxgi_cs);
|
||||||
hr = wined3d_device_create(wined3d, adapter_ordinal, WINED3DDEVTYPE_HAL, NULL, 0,
|
hr = wined3d_device_create(wined3d, adapter_ordinal, WINED3DDEVTYPE_HAL, NULL, 0,
|
||||||
wined3d_device_parent, &device->wined3d_device);
|
wined3d_device_parent, &device->wined3d_device);
|
||||||
IWineD3DDeviceParent_Release(wined3d_device_parent);
|
IWineDXGIDeviceParent_Release(dxgi_device_parent);
|
||||||
wined3d_decref(wined3d);
|
wined3d_decref(wined3d);
|
||||||
LeaveCriticalSection(&dxgi_cs);
|
LeaveCriticalSection(&dxgi_cs);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
|
|
|
@ -1212,7 +1212,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
|
||||||
|
|
||||||
/* Setup the implicit swapchain. This also initializes a context. */
|
/* Setup the implicit swapchain. This also initializes a context. */
|
||||||
TRACE("Creating implicit swapchain\n");
|
TRACE("Creating implicit swapchain\n");
|
||||||
hr = IWineD3DDeviceParent_CreateSwapChain(device->device_parent,
|
hr = device->device_parent->ops->create_swapchain(device->device_parent,
|
||||||
present_parameters, &swapchain);
|
present_parameters, &swapchain);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
@ -1356,7 +1356,7 @@ HRESULT CDECL wined3d_device_init_gdi(struct wined3d_device *device,
|
||||||
|
|
||||||
/* Setup the implicit swapchain */
|
/* Setup the implicit swapchain */
|
||||||
TRACE("Creating implicit swapchain\n");
|
TRACE("Creating implicit swapchain\n");
|
||||||
hr = IWineD3DDeviceParent_CreateSwapChain(device->device_parent,
|
hr = device->device_parent->ops->create_swapchain(device->device_parent,
|
||||||
present_parameters, &swapchain);
|
present_parameters, &swapchain);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
@ -5694,7 +5694,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
|
||||||
|
|
||||||
TRACE("Creating the depth stencil buffer\n");
|
TRACE("Creating the depth stencil buffer\n");
|
||||||
|
|
||||||
hrc = IWineD3DDeviceParent_CreateDepthStencilSurface(device->device_parent,
|
hrc = device->device_parent->ops->create_depth_stencil(device->device_parent,
|
||||||
present_parameters->BackBufferWidth,
|
present_parameters->BackBufferWidth,
|
||||||
present_parameters->BackBufferHeight,
|
present_parameters->BackBufferHeight,
|
||||||
present_parameters->AutoDepthStencilFormat,
|
present_parameters->AutoDepthStencilFormat,
|
||||||
|
@ -6103,7 +6103,7 @@ HRESULT CDECL wined3d_device_get_surface_from_dc(struct wined3d_device *device,
|
||||||
|
|
||||||
HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
|
HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
|
||||||
UINT adapter_idx, WINED3DDEVTYPE device_type, HWND focus_window, DWORD flags,
|
UINT adapter_idx, WINED3DDEVTYPE device_type, HWND focus_window, DWORD flags,
|
||||||
IWineD3DDeviceParent *device_parent)
|
struct wined3d_device_parent *device_parent)
|
||||||
{
|
{
|
||||||
struct wined3d_adapter *adapter = &wined3d->adapters[adapter_idx];
|
struct wined3d_adapter *adapter = &wined3d->adapters[adapter_idx];
|
||||||
const struct fragment_pipeline *fragment_pipeline;
|
const struct fragment_pipeline *fragment_pipeline;
|
||||||
|
|
|
@ -4850,7 +4850,7 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CDECL wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, WINED3DDEVTYPE device_type,
|
HRESULT CDECL wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, WINED3DDEVTYPE device_type,
|
||||||
HWND focus_window, DWORD flags, IWineD3DDeviceParent *device_parent, struct wined3d_device **device)
|
HWND focus_window, DWORD flags, struct wined3d_device_parent *device_parent, struct wined3d_device **device)
|
||||||
{
|
{
|
||||||
struct wined3d_device *object;
|
struct wined3d_device *object;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -4881,7 +4881,7 @@ HRESULT CDECL wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, W
|
||||||
TRACE("Created device %p.\n", object);
|
TRACE("Created device %p.\n", object);
|
||||||
*device = object;
|
*device = object;
|
||||||
|
|
||||||
IWineD3DDeviceParent_WineD3DDeviceCreated(device_parent, *device);
|
device_parent->ops->wined3d_device_created(device_parent, *device);
|
||||||
|
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -898,7 +898,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("Creating front buffer.\n");
|
TRACE("Creating front buffer.\n");
|
||||||
hr = IWineD3DDeviceParent_CreateRenderTarget(device->device_parent, parent,
|
hr = device->device_parent->ops->create_rendertarget(device->device_parent, parent,
|
||||||
swapchain->presentParms.BackBufferWidth, swapchain->presentParms.BackBufferHeight,
|
swapchain->presentParms.BackBufferWidth, swapchain->presentParms.BackBufferHeight,
|
||||||
swapchain->presentParms.BackBufferFormat, swapchain->presentParms.MultiSampleType,
|
swapchain->presentParms.BackBufferFormat, swapchain->presentParms.MultiSampleType,
|
||||||
swapchain->presentParms.MultiSampleQuality, TRUE /* Lockable */,
|
swapchain->presentParms.MultiSampleQuality, TRUE /* Lockable */,
|
||||||
|
@ -1009,7 +1009,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
|
||||||
for (i = 0; i < swapchain->presentParms.BackBufferCount; ++i)
|
for (i = 0; i < swapchain->presentParms.BackBufferCount; ++i)
|
||||||
{
|
{
|
||||||
TRACE("Creating back buffer %u.\n", i);
|
TRACE("Creating back buffer %u.\n", i);
|
||||||
hr = IWineD3DDeviceParent_CreateRenderTarget(device->device_parent, parent,
|
hr = device->device_parent->ops->create_rendertarget(device->device_parent, parent,
|
||||||
swapchain->presentParms.BackBufferWidth, swapchain->presentParms.BackBufferHeight,
|
swapchain->presentParms.BackBufferWidth, swapchain->presentParms.BackBufferHeight,
|
||||||
swapchain->presentParms.BackBufferFormat, swapchain->presentParms.MultiSampleType,
|
swapchain->presentParms.BackBufferFormat, swapchain->presentParms.MultiSampleType,
|
||||||
swapchain->presentParms.MultiSampleQuality, TRUE /* Lockable */,
|
swapchain->presentParms.MultiSampleQuality, TRUE /* Lockable */,
|
||||||
|
@ -1030,7 +1030,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
|
||||||
TRACE("Creating depth/stencil buffer.\n");
|
TRACE("Creating depth/stencil buffer.\n");
|
||||||
if (!device->auto_depth_stencil)
|
if (!device->auto_depth_stencil)
|
||||||
{
|
{
|
||||||
hr = IWineD3DDeviceParent_CreateDepthStencilSurface(device->device_parent,
|
hr = device->device_parent->ops->create_depth_stencil(device->device_parent,
|
||||||
swapchain->presentParms.BackBufferWidth, swapchain->presentParms.BackBufferHeight,
|
swapchain->presentParms.BackBufferWidth, swapchain->presentParms.BackBufferHeight,
|
||||||
swapchain->presentParms.AutoDepthStencilFormat, swapchain->presentParms.MultiSampleType,
|
swapchain->presentParms.AutoDepthStencilFormat, swapchain->presentParms.MultiSampleType,
|
||||||
swapchain->presentParms.MultiSampleQuality, FALSE /* FIXME: Discard */,
|
swapchain->presentParms.MultiSampleQuality, FALSE /* FIXME: Discard */,
|
||||||
|
|
|
@ -895,7 +895,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, UINT edge_lengt
|
||||||
UINT idx = j * texture->level_count + i;
|
UINT idx = j * texture->level_count + i;
|
||||||
struct wined3d_surface *surface;
|
struct wined3d_surface *surface;
|
||||||
|
|
||||||
hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_w,
|
hr = device->device_parent->ops->create_surface(device->device_parent, parent, tmp_w, tmp_w,
|
||||||
format_id, usage, pool, i /* Level */, j, &surface);
|
format_id, usage, pool, i /* Level */, j, &surface);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
@ -1051,7 +1051,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT he
|
||||||
struct wined3d_surface *surface;
|
struct wined3d_surface *surface;
|
||||||
|
|
||||||
/* Use the callback to create the texture surface. */
|
/* Use the callback to create the texture surface. */
|
||||||
hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_h,
|
hr = device->device_parent->ops->create_surface(device->device_parent, parent, tmp_w, tmp_h,
|
||||||
format->id, usage, pool, i, 0, &surface);
|
format->id, usage, pool, i, 0, &surface);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
@ -1259,7 +1259,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, UINT width, U
|
||||||
struct wined3d_volume *volume;
|
struct wined3d_volume *volume;
|
||||||
|
|
||||||
/* Create the volume. */
|
/* Create the volume. */
|
||||||
hr = IWineD3DDeviceParent_CreateVolume(device->device_parent, parent,
|
hr = device->device_parent->ops->create_volume(device->device_parent, parent,
|
||||||
tmp_w, tmp_h, tmp_d, format_id, pool, usage, &volume);
|
tmp_w, tmp_h, tmp_d, format_id, pool, usage, &volume);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1645,7 +1645,7 @@ struct wined3d_device
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
/* WineD3D Information */
|
/* WineD3D Information */
|
||||||
IWineD3DDeviceParent *device_parent;
|
struct wined3d_device_parent *device_parent;
|
||||||
struct wined3d *wined3d;
|
struct wined3d *wined3d;
|
||||||
struct wined3d_adapter *adapter;
|
struct wined3d_adapter *adapter;
|
||||||
|
|
||||||
|
@ -1774,7 +1774,7 @@ void device_context_remove(struct wined3d_device *device, struct wined3d_context
|
||||||
void device_get_draw_rect(struct wined3d_device *device, RECT *rect) DECLSPEC_HIDDEN;
|
void device_get_draw_rect(struct wined3d_device *device, RECT *rect) DECLSPEC_HIDDEN;
|
||||||
HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
|
HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
|
||||||
UINT adapter_idx, WINED3DDEVTYPE device_type, HWND focus_window, DWORD flags,
|
UINT adapter_idx, WINED3DDEVTYPE device_type, HWND focus_window, DWORD flags,
|
||||||
IWineD3DDeviceParent *device_parent) DECLSPEC_HIDDEN;
|
struct wined3d_device_parent *device_parent) DECLSPEC_HIDDEN;
|
||||||
void device_preload_textures(struct wined3d_device *device) DECLSPEC_HIDDEN;
|
void device_preload_textures(struct wined3d_device *device) DECLSPEC_HIDDEN;
|
||||||
LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL unicode,
|
LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL unicode,
|
||||||
UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN;
|
UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -2101,66 +2101,30 @@ struct wined3d_texture;
|
||||||
struct wined3d_vertex_declaration;
|
struct wined3d_vertex_declaration;
|
||||||
struct wined3d_volume;
|
struct wined3d_volume;
|
||||||
|
|
||||||
[
|
struct wined3d_device_parent
|
||||||
object,
|
|
||||||
local,
|
|
||||||
uuid(aeb62dfc-bdcb-4f02-9519-1eeea00c15cd)
|
|
||||||
]
|
|
||||||
interface IWineD3DDeviceParent : IUnknown
|
|
||||||
{
|
{
|
||||||
void WineD3DDeviceCreated(
|
const struct wined3d_device_parent_ops *ops;
|
||||||
[in] struct wined3d_device *device
|
};
|
||||||
);
|
|
||||||
|
|
||||||
HRESULT CreateSurface(
|
struct wined3d_device_parent_ops
|
||||||
[in] void *container_parent,
|
{
|
||||||
[in] UINT width,
|
void (__cdecl *wined3d_device_created)(struct wined3d_device_parent *device_parent, struct wined3d_device *device);
|
||||||
[in] UINT height,
|
HRESULT (__cdecl *create_surface)(struct wined3d_device_parent *device_parent, void *container_parent,
|
||||||
[in] enum wined3d_format_id format_id,
|
UINT width, UINT height, enum wined3d_format_id format_id, DWORD usage, WINED3DPOOL pool,
|
||||||
[in] DWORD usage,
|
UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface);
|
||||||
[in] WINED3DPOOL pool,
|
HRESULT (__cdecl *create_rendertarget)(struct wined3d_device_parent *device_parent, void *container_parent,
|
||||||
[in] UINT level,
|
UINT width, UINT height, enum wined3d_format_id format_id, WINED3DMULTISAMPLE_TYPE multisample_type,
|
||||||
[in] WINED3DCUBEMAP_FACES face,
|
DWORD multisample_quality, BOOL lockable, struct wined3d_surface **surface);
|
||||||
[out] struct wined3d_surface **surface
|
HRESULT (__cdecl *create_depth_stencil)(struct wined3d_device_parent *device_parent,
|
||||||
);
|
UINT width, UINT height, enum wined3d_format_id format_id, WINED3DMULTISAMPLE_TYPE multisample_type,
|
||||||
|
DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface);
|
||||||
|
HRESULT (__cdecl *create_volume)(struct wined3d_device_parent *device_parent, void *container_parent,
|
||||||
|
UINT width, UINT height, UINT depth, enum wined3d_format_id format_id, WINED3DPOOL pool, DWORD usage,
|
||||||
|
struct wined3d_volume **volume);
|
||||||
|
HRESULT (__cdecl *create_swapchain)(struct wined3d_device_parent *device_parent,
|
||||||
|
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain);
|
||||||
|
};
|
||||||
|
|
||||||
HRESULT CreateRenderTarget(
|
|
||||||
[in] void *container_parent,
|
|
||||||
[in] UINT width,
|
|
||||||
[in] UINT height,
|
|
||||||
[in] enum wined3d_format_id format_id,
|
|
||||||
[in] WINED3DMULTISAMPLE_TYPE multisample_type,
|
|
||||||
[in] DWORD multisample_quality,
|
|
||||||
[in] BOOL lockable,
|
|
||||||
[out] struct wined3d_surface **surface
|
|
||||||
);
|
|
||||||
|
|
||||||
HRESULT CreateDepthStencilSurface(
|
|
||||||
[in] UINT width,
|
|
||||||
[in] UINT height,
|
|
||||||
[in] enum wined3d_format_id format_id,
|
|
||||||
[in] WINED3DMULTISAMPLE_TYPE multisample_type,
|
|
||||||
[in] DWORD multisample_quality,
|
|
||||||
[in] BOOL discard,
|
|
||||||
[out] struct wined3d_surface **surface
|
|
||||||
);
|
|
||||||
|
|
||||||
HRESULT CreateVolume(
|
|
||||||
[in] void *container_parent,
|
|
||||||
[in] UINT width,
|
|
||||||
[in] UINT height,
|
|
||||||
[in] UINT depth,
|
|
||||||
[in] enum wined3d_format_id format_id,
|
|
||||||
[in] WINED3DPOOL pool,
|
|
||||||
[in] DWORD usage,
|
|
||||||
[out] struct wined3d_volume **volume
|
|
||||||
);
|
|
||||||
|
|
||||||
HRESULT CreateSwapChain(
|
|
||||||
[in, out] WINED3DPRESENT_PARAMETERS *present_parameters,
|
|
||||||
[out] struct wined3d_swapchain **swapchain
|
|
||||||
);
|
|
||||||
}
|
|
||||||
typedef HRESULT (__stdcall *D3DCB_ENUMRESOURCES)(struct wined3d_resource *resource, void *pData);
|
typedef HRESULT (__stdcall *D3DCB_ENUMRESOURCES)(struct wined3d_resource *resource, void *pData);
|
||||||
|
|
||||||
void __stdcall wined3d_mutex_lock(void);
|
void __stdcall wined3d_mutex_lock(void);
|
||||||
|
@ -2242,7 +2206,7 @@ HRESULT __cdecl wined3d_device_color_fill(struct wined3d_device *device, struct
|
||||||
const RECT *rect, const WINED3DCOLORVALUE *color);
|
const RECT *rect, const WINED3DCOLORVALUE *color);
|
||||||
HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx,
|
HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx,
|
||||||
WINED3DDEVTYPE device_type, HWND focus_window, DWORD behaviour_flags,
|
WINED3DDEVTYPE device_type, HWND focus_window, DWORD behaviour_flags,
|
||||||
IWineD3DDeviceParent *device_parent, struct wined3d_device **device);
|
struct wined3d_device_parent *device_parent, struct wined3d_device **device);
|
||||||
ULONG __cdecl wined3d_device_decref(struct wined3d_device *device);
|
ULONG __cdecl wined3d_device_decref(struct wined3d_device *device);
|
||||||
HRESULT __cdecl wined3d_device_delete_patch(struct wined3d_device *device, UINT handle);
|
HRESULT __cdecl wined3d_device_delete_patch(struct wined3d_device *device, UINT handle);
|
||||||
HRESULT __cdecl wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count);
|
HRESULT __cdecl wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count);
|
||||||
|
|
|
@ -58,3 +58,13 @@ interface IWineDXGIDevice : IDXGIDevice
|
||||||
[out] struct wined3d_swapchain **wined3d_swapchain
|
[out] struct wined3d_swapchain **wined3d_swapchain
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[
|
||||||
|
object,
|
||||||
|
local,
|
||||||
|
uuid(f2b918f3-603f-430a-9ccd-55872b6e85df)
|
||||||
|
]
|
||||||
|
interface IWineDXGIDeviceParent : IUnknown
|
||||||
|
{
|
||||||
|
struct wined3d_device_parent *get_wined3d_device_parent();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue