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 IUnknownVtbl *inner_unknown_vtbl;
|
||||
const struct IWineD3DDeviceParentVtbl *device_parent_vtbl;
|
||||
IWineDXGIDeviceParent IWineDXGIDeviceParent_iface;
|
||||
IUnknown *outer_unknown;
|
||||
LONG refcount;
|
||||
|
||||
struct wined3d_device_parent device_parent;
|
||||
struct wined3d_device *wined3d_device;
|
||||
};
|
||||
|
||||
|
|
|
@ -45,10 +45,10 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_inner_QueryInterface(IUnknown *ifa
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent))
|
||||
if (IsEqualGUID(riid, &IID_IWineDXGIDeviceParent))
|
||||
{
|
||||
IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl);
|
||||
*object = &This->device_parent_vtbl;
|
||||
IWineDXGIDeviceParent_AddRef(&This->IWineDXGIDeviceParent_iface);
|
||||
*object = &This->IWineDXGIDeviceParent_iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -1285,56 +1285,77 @@ static const struct wined3d_parent_ops d3d10_subresource_parent_ops =
|
|||
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);
|
||||
return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
|
||||
struct d3d10_device *device = device_from_dxgi_device_parent(iface);
|
||||
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);
|
||||
return d3d10_device_AddRef((ID3D10Device *)This);
|
||||
struct d3d10_device *device = device_from_dxgi_device_parent(iface);
|
||||
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);
|
||||
return d3d10_device_Release((ID3D10Device *)This);
|
||||
struct d3d10_device *device = device_from_dxgi_device_parent(iface);
|
||||
return d3d10_device_Release((ID3D10Device *)device);
|
||||
}
|
||||
|
||||
/* IWineD3DDeviceParent methods */
|
||||
|
||||
static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface,
|
||||
struct wined3d_device *device)
|
||||
static struct wined3d_device_parent * STDMETHODCALLTYPE dxgi_device_parent_get_wined3d_device_parent(
|
||||
IWineDXGIDeviceParent *iface)
|
||||
{
|
||||
struct d3d10_device *This = device_from_device_parent(iface);
|
||||
|
||||
TRACE("iface %p, device %p\n", iface, device);
|
||||
|
||||
wined3d_device_incref(device);
|
||||
This->wined3d_device = device;
|
||||
struct d3d10_device *device = device_from_dxgi_device_parent(iface);
|
||||
return &device->device_parent;
|
||||
}
|
||||
|
||||
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,
|
||||
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;
|
||||
D3D10_TEXTURE2D_DESC desc;
|
||||
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",
|
||||
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");
|
||||
|
||||
|
@ -1350,7 +1371,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
|
|||
desc.CPUAccessFlags = 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))
|
||||
{
|
||||
ERR("CreateTexture2D failed, returning %#x\n", hr);
|
||||
|
@ -1364,19 +1385,20 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
|
|||
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,
|
||||
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
|
||||
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;
|
||||
D3D10_TEXTURE2D_DESC desc;
|
||||
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",
|
||||
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");
|
||||
|
||||
|
@ -1392,7 +1414,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
|
|||
desc.CPUAccessFlags = 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))
|
||||
{
|
||||
ERR("CreateTexture2D failed, returning %#x\n", hr);
|
||||
|
@ -1406,18 +1428,18 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
|
|||
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,
|
||||
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;
|
||||
D3D10_TEXTURE2D_DESC desc;
|
||||
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",
|
||||
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");
|
||||
|
||||
|
@ -1433,7 +1455,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
|
|||
desc.CPUAccessFlags = 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))
|
||||
{
|
||||
ERR("CreateTexture2D failed, returning %#x\n", hr);
|
||||
|
@ -1447,16 +1469,18 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
|
|||
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,
|
||||
WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, container_parent %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p.\n",
|
||||
iface, container_parent, width, height, depth, format, pool, usage, volume);
|
||||
TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, "
|
||||
"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);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -1467,15 +1491,16 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
|
|||
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)
|
||||
{
|
||||
struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
|
||||
IWineDXGIDevice *wine_device;
|
||||
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))
|
||||
{
|
||||
ERR("Device should implement IWineDXGIDevice\n");
|
||||
|
@ -1493,26 +1518,22 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
|
|||
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_QueryInterface,
|
||||
device_parent_AddRef,
|
||||
device_parent_Release,
|
||||
/* IWineD3DDeviceParent methods */
|
||||
device_parent_WineD3DDeviceCreated,
|
||||
device_parent_CreateSurface,
|
||||
device_parent_CreateRenderTarget,
|
||||
device_parent_CreateDepthStencilSurface,
|
||||
device_parent_CreateVolume,
|
||||
device_parent_CreateSwapChain,
|
||||
device_parent_wined3d_device_created,
|
||||
device_parent_create_surface,
|
||||
device_parent_create_rendertarget,
|
||||
device_parent_create_depth_stencil,
|
||||
device_parent_create_volume,
|
||||
device_parent_create_swapchain,
|
||||
};
|
||||
|
||||
void d3d10_device_init(struct d3d10_device *device, void *outer_unknown)
|
||||
{
|
||||
device->vtbl = &d3d10_device_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->outer_unknown = outer_unknown;
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ struct IDirect3DDevice8Impl
|
|||
{
|
||||
/* IUnknown fields */
|
||||
IDirect3DDevice8 IDirect3DDevice8_iface;
|
||||
IWineD3DDeviceParent IWineD3DDeviceParent_iface;
|
||||
struct wined3d_device_parent device_parent;
|
||||
LONG ref;
|
||||
struct wined3d_device *wined3d_device;
|
||||
struct d3d8_handle_table handle_table;
|
||||
|
|
|
@ -274,13 +274,6 @@ static HRESULT WINAPI IDirect3DDevice8Impl_QueryInterface(IDirect3DDevice8 *ifac
|
|||
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);
|
||||
*ppobj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
|
@ -2871,60 +2864,39 @@ static const IDirect3DDevice8Vtbl Direct3DDevice8_Vtbl =
|
|||
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,
|
||||
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,
|
||||
static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent,
|
||||
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,
|
||||
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;
|
||||
BOOL lockable = TRUE;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n"
|
||||
"\tpool %#x, level %u, face %u, surface %p\n",
|
||||
iface, container_parent, width, height, format, usage, pool, level, face, surface);
|
||||
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",
|
||||
device_parent, container_parent, width, height, format, usage, pool, level, face, surface);
|
||||
|
||||
|
||||
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,
|
||||
(IDirect3DSurface8 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("(%p) CreateSurface failed, returning %#x\n", iface, hr);
|
||||
WARN("Failed to create surface, hr %#x.\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -2941,77 +2913,80 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
|
|||
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,
|
||||
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
|
||||
struct wined3d_surface **surface)
|
||||
{
|
||||
IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
|
||||
IDirect3DDevice8Impl *device = device_from_device_parent(device_parent);
|
||||
IDirect3DSurface8Impl *d3d_surface;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||
"\tmultisample_quality %u, lockable %u, surface %p\n",
|
||||
iface, container_parent, width, height, format, multisample_type, multisample_quality, lockable, surface);
|
||||
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",
|
||||
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);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("(%p) CreateRenderTarget failed, returning %#x\n", iface, hr);
|
||||
WARN("Failed to create rendertarget, hr %#x.\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
*surface = d3d_surface->wined3d_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 */
|
||||
IUnknown_Release((IUnknown *)d3d_surface);
|
||||
|
||||
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,
|
||||
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;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||
"\tmultisample_quality %u, discard %u, surface %p\n",
|
||||
iface, width, height, format, multisample_type, multisample_quality, discard, surface);
|
||||
TRACE("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||
"\tmultisample_quality %u, discard %u, surface %p.\n",
|
||||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
*surface = d3d_surface->wined3d_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 */
|
||||
IUnknown_Release((IUnknown *)d3d_surface);
|
||||
|
||||
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,
|
||||
WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume)
|
||||
{
|
||||
IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
|
||||
IDirect3DDevice8Impl *device = device_from_device_parent(device_parent);
|
||||
IDirect3DVolume8Impl *object;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, container_parent %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p\n",
|
||||
iface, container_parent, width, height, depth, format, pool, usage, volume);
|
||||
TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, "
|
||||
"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 */
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||
|
@ -3022,7 +2997,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
|
|||
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))
|
||||
{
|
||||
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->forwardReference = container_parent;
|
||||
|
||||
TRACE("(%p) Created volume %p\n", iface, object);
|
||||
TRACE("Created volume %p.\n", object);
|
||||
|
||||
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)
|
||||
{
|
||||
IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
|
||||
IDirect3DDevice8Impl *device = device_from_device_parent(device_parent);
|
||||
D3DPRESENT_PARAMETERS local_parameters;
|
||||
IDirect3DSwapChain8 *d3d_swapchain;
|
||||
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 */
|
||||
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_PresentationInterval = present_parameters->PresentationInterval;
|
||||
|
||||
hr = IDirect3DDevice8_CreateAdditionalSwapChain(&This->IDirect3DDevice8_iface,
|
||||
hr = IDirect3DDevice8_CreateAdditionalSwapChain(&device->IDirect3DDevice8_iface,
|
||||
&local_parameters, &d3d_swapchain);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("(%p) CreateAdditionalSwapChain failed, returning %#x\n", iface, hr);
|
||||
WARN("Failed to create swapchain, hr %#x.\n", hr);
|
||||
*swapchain = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
@ -3098,19 +3073,14 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
|
|||
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_QueryInterface,
|
||||
device_parent_AddRef,
|
||||
device_parent_Release,
|
||||
/* IWineD3DDeviceParent methods */
|
||||
device_parent_WineD3DDeviceCreated,
|
||||
device_parent_CreateSurface,
|
||||
device_parent_CreateRenderTarget,
|
||||
device_parent_CreateDepthStencilSurface,
|
||||
device_parent_CreateVolume,
|
||||
device_parent_CreateSwapChain,
|
||||
device_parent_wined3d_device_created,
|
||||
device_parent_create_surface,
|
||||
device_parent_create_rendertarget,
|
||||
device_parent_create_depth_stencil,
|
||||
device_parent_create_volume,
|
||||
device_parent_create_swapchain,
|
||||
};
|
||||
|
||||
static void setup_fpu(void)
|
||||
|
@ -3132,7 +3102,7 @@ HRESULT device_init(IDirect3DDevice8Impl *device, struct wined3d *wined3d, UINT
|
|||
HRESULT hr;
|
||||
|
||||
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->handle_table.entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
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();
|
||||
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))
|
||||
{
|
||||
WARN("Failed to create wined3d device, hr %#x.\n", hr);
|
||||
|
|
|
@ -163,7 +163,7 @@ void filter_caps(D3DCAPS9* pCaps) DECLSPEC_HIDDEN;
|
|||
typedef struct IDirect3DDevice9Impl
|
||||
{
|
||||
IDirect3DDevice9Ex IDirect3DDevice9Ex_iface;
|
||||
const IWineD3DDeviceParentVtbl *device_parent_vtbl;
|
||||
struct wined3d_device_parent device_parent;
|
||||
LONG ref;
|
||||
struct wined3d_device *wined3d_device;
|
||||
/* 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);
|
||||
*ppobj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
|
@ -3120,63 +3113,39 @@ static const IDirect3DDevice9ExVtbl Direct3DDevice9_Vtbl =
|
|||
IDirect3DDevice9ExImpl_GetDisplayModeEx
|
||||
};
|
||||
|
||||
/* IWineD3DDeviceParent IUnknown methods */
|
||||
|
||||
static inline struct IDirect3DDevice9Impl *device_from_device_parent(IWineD3DDeviceParent *iface)
|
||||
static inline struct IDirect3DDevice9Impl *device_from_device_parent(struct wined3d_device_parent *device_parent)
|
||||
{
|
||||
return (struct IDirect3DDevice9Impl *)((char*)iface
|
||||
- FIELD_OFFSET(struct IDirect3DDevice9Impl, device_parent_vtbl));
|
||||
return CONTAINING_RECORD(device_parent, struct IDirect3DDevice9Impl, device_parent);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface,
|
||||
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,
|
||||
static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent,
|
||||
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,
|
||||
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;
|
||||
BOOL lockable = TRUE;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n"
|
||||
"\tpool %#x, level %u, face %u, surface %p\n",
|
||||
iface, container_parent, width, height, format, usage, pool, level, face, surface);
|
||||
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",
|
||||
device_parent, container_parent, width, height, format, usage, pool, level, face, surface);
|
||||
|
||||
if (pool == WINED3DPOOL_DEFAULT && !(usage & D3DUSAGE_DYNAMIC))
|
||||
lockable = FALSE;
|
||||
|
||||
hr = IDirect3DDevice9Impl_CreateSurface(This, width, height,
|
||||
hr = IDirect3DDevice9Impl_CreateSurface(device, width, height,
|
||||
d3dformat_from_wined3dformat(format), lockable, FALSE /* Discard */, level,
|
||||
(IDirect3DSurface9 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("(%p) CreateSurface failed, returning %#x\n", iface, hr);
|
||||
WARN("Failed to create surface, hr %#x.\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -3193,25 +3162,26 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
|
|||
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,
|
||||
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
|
||||
struct wined3d_surface **surface)
|
||||
{
|
||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
||||
struct IDirect3DDevice9Impl *device = device_from_device_parent(device_parent);
|
||||
IDirect3DSurface9Impl *d3d_surface;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||
"\tmultisample_quality %u, lockable %u, surface %p\n",
|
||||
iface, container_parent, width, height, format, multisample_type, multisample_quality, lockable, surface);
|
||||
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",
|
||||
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,
|
||||
(IDirect3DSurface9 **)&d3d_surface, NULL);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("(%p) CreateRenderTarget failed, returning %#x\n", iface, hr);
|
||||
WARN("Failed to create rendertarget, hr %#x.\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -3225,46 +3195,48 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
|
|||
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,
|
||||
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;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||
"\tmultisample_quality %u, discard %u, surface %p\n",
|
||||
iface, width, height, format, multisample_type, multisample_quality, discard, surface);
|
||||
TRACE("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||
"\tmultisample_quality %u, discard %u, surface %p.\n",
|
||||
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,
|
||||
discard, (IDirect3DSurface9 **)&d3d_surface, NULL);
|
||||
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;
|
||||
}
|
||||
|
||||
*surface = d3d_surface->wined3d_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 */
|
||||
IDirect3DSurface9_Release((IDirect3DSurface9 *)d3d_surface);
|
||||
|
||||
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,
|
||||
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;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, container_parent %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p\n",
|
||||
iface, container_parent, width, height, depth, format, pool, usage, volume);
|
||||
TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, "
|
||||
"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 */
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||
|
@ -3275,7 +3247,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
|
|||
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))
|
||||
{
|
||||
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->forwardReference = container_parent;
|
||||
|
||||
TRACE("(%p) Created volume %p\n", iface, object);
|
||||
TRACE("Created volume %p.\n", object);
|
||||
|
||||
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)
|
||||
{
|
||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
||||
struct IDirect3DDevice9Impl *device = device_from_device_parent(device_parent);
|
||||
D3DPRESENT_PARAMETERS local_parameters;
|
||||
IDirect3DSwapChain9 *d3d_swapchain;
|
||||
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 */
|
||||
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.PresentationInterval = present_parameters->PresentationInterval;
|
||||
|
||||
hr = IDirect3DDevice9Impl_CreateAdditionalSwapChain(&This->IDirect3DDevice9Ex_iface,
|
||||
hr = IDirect3DDevice9Impl_CreateAdditionalSwapChain(&device->IDirect3DDevice9Ex_iface,
|
||||
&local_parameters, &d3d_swapchain);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("(%p) CreateAdditionalSwapChain failed, returning %#x\n", iface, hr);
|
||||
WARN("Failed to create swapchain, hr %#x.\n", hr);
|
||||
*swapchain = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
@ -3353,19 +3325,14 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
|
|||
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_QueryInterface,
|
||||
device_parent_AddRef,
|
||||
device_parent_Release,
|
||||
/* IWineD3DDeviceParent methods */
|
||||
device_parent_WineD3DDeviceCreated,
|
||||
device_parent_CreateSurface,
|
||||
device_parent_CreateRenderTarget,
|
||||
device_parent_CreateDepthStencilSurface,
|
||||
device_parent_CreateVolume,
|
||||
device_parent_CreateSwapChain,
|
||||
device_parent_wined3d_device_created,
|
||||
device_parent_create_surface,
|
||||
device_parent_create_rendertarget,
|
||||
device_parent_create_depth_stencil,
|
||||
device_parent_create_volume,
|
||||
device_parent_create_swapchain,
|
||||
};
|
||||
|
||||
static void setup_fpu(void)
|
||||
|
@ -3391,14 +3358,14 @@ HRESULT device_init(IDirect3DDevice9Impl *device, struct wined3d *wined3d, UINT
|
|||
FIXME("Ignoring display mode.\n");
|
||||
|
||||
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;
|
||||
|
||||
if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu();
|
||||
|
||||
wined3d_mutex_lock();
|
||||
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))
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
else if (IsEqualGUID(refiid, &IID_IWineD3DDeviceParent))
|
||||
{
|
||||
*obj = &This->device_parent_vtbl;
|
||||
}
|
||||
|
||||
/* Unknown interface */
|
||||
else
|
||||
{
|
||||
|
@ -5624,51 +5619,29 @@ struct wined3d_vertex_declaration *ddraw_find_decl(IDirectDrawImpl *This, DWORD
|
|||
return pDecl;
|
||||
}
|
||||
|
||||
/* IWineD3DDeviceParent IUnknown methods */
|
||||
|
||||
static inline struct IDirectDrawImpl *ddraw_from_device_parent(IWineD3DDeviceParent *iface)
|
||||
static inline struct IDirectDrawImpl *ddraw_from_device_parent(struct wined3d_device_parent *device_parent)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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,
|
||||
static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent,
|
||||
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,
|
||||
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;
|
||||
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"
|
||||
"\tpool %#x, level %u, face %u, surface %p\n",
|
||||
iface, container_parent, width, height, format, usage, pool, level, face, surface);
|
||||
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",
|
||||
device_parent, container_parent, width, height, format, usage, pool, level, face, surface);
|
||||
|
||||
searchcaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_ALLFACES;
|
||||
switch(face)
|
||||
|
@ -5679,7 +5652,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
|
|||
{
|
||||
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEX;
|
||||
}
|
||||
surf = This->tex_root; break;
|
||||
surf = ddraw->tex_root; break;
|
||||
case WINED3DCUBEMAP_FACE_NEGATIVE_X:
|
||||
TRACE("Asked for negative x\n");
|
||||
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEX; break;
|
||||
|
@ -5701,7 +5674,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
|
|||
if (!surf)
|
||||
{
|
||||
IDirectDrawSurface7 *attached;
|
||||
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)This->tex_root, &searchcaps, &attached);
|
||||
IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)ddraw->tex_root, &searchcaps, &attached);
|
||||
surf = (IDirectDrawSurfaceImpl *)attached;
|
||||
IDirectDrawSurface7_Release(attached);
|
||||
}
|
||||
|
@ -5748,18 +5721,19 @@ static HRESULT WINAPI findRenderTarget(IDirectDrawSurface7 *surface, DDSURFACEDE
|
|||
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,
|
||||
WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable,
|
||||
struct wined3d_surface **surface)
|
||||
{
|
||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
||||
IDirectDrawSurfaceImpl *d3d_surface = This->d3d_target;
|
||||
struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent);
|
||||
IDirectDrawSurfaceImpl *d3d_surface = ddraw->d3d_target;
|
||||
IDirectDrawSurfaceImpl *target = NULL;
|
||||
|
||||
TRACE("iface %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||
"\tmultisample_quality %u, lockable %u, surface %p\n",
|
||||
iface, container_parent, width, height, format, multisample_type, multisample_quality, lockable, surface);
|
||||
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",
|
||||
device_parent, container_parent, width, height, format, multisample_type,
|
||||
multisample_quality, lockable, surface);
|
||||
|
||||
if (d3d_surface->isRenderTarget)
|
||||
{
|
||||
|
@ -5772,8 +5746,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
|
|||
|
||||
if (!target)
|
||||
{
|
||||
target = This->d3d_target;
|
||||
ERR(" (%p) : No DirectDrawSurface found to create the back buffer. Using the front buffer as back buffer. Uncertain consequences\n", This);
|
||||
target = ddraw->d3d_target;
|
||||
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 */
|
||||
|
@ -5787,18 +5761,18 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
|
|||
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,
|
||||
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;
|
||||
DDSURFACEDESC2 ddsd;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||
"\tmultisample_quality %u, discard %u, surface %p\n",
|
||||
iface, width, height, format, multisample_type, multisample_quality, discard, surface);
|
||||
TRACE("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||
"\tmultisample_quality %u, discard %u, surface %p.\n",
|
||||
device_parent, width, height, format, multisample_type, multisample_quality, discard, surface);
|
||||
|
||||
*surface = NULL;
|
||||
|
||||
|
@ -5819,13 +5793,13 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
|
|||
ddsd.dwFlags ^= DDSD_PIXELFORMAT;
|
||||
}
|
||||
|
||||
This->depthstencil = TRUE;
|
||||
hr = IDirectDraw7_CreateSurface(&This->IDirectDraw7_iface, &ddsd,
|
||||
ddraw->depthstencil = TRUE;
|
||||
hr = IDirectDraw7_CreateSurface(&ddraw->IDirectDraw7_iface, &ddsd,
|
||||
(IDirectDrawSurface7 **)&ddraw_surface, NULL);
|
||||
This->depthstencil = FALSE;
|
||||
if(FAILED(hr))
|
||||
ddraw->depthstencil = FALSE;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -5836,38 +5810,40 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
|
|||
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,
|
||||
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",
|
||||
iface, container_parent, width, height, depth, format, pool, usage, volume);
|
||||
TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, "
|
||||
"format %#x, pool %#x, usage %#x, volume %p.\n",
|
||||
device_parent, container_parent, width, height, depth,
|
||||
format, pool, usage, volume);
|
||||
|
||||
ERR("Not implemented!\n");
|
||||
|
||||
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)
|
||||
{
|
||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
||||
struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent);
|
||||
IDirectDrawSurfaceImpl *iterator;
|
||||
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,
|
||||
This->ImplType, NULL, &ddraw_null_wined3d_parent_ops, swapchain);
|
||||
hr = wined3d_swapchain_create(ddraw->wined3d_device, present_parameters,
|
||||
ddraw->ImplType, NULL, &ddraw_null_wined3d_parent_ops, swapchain);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
FIXME("(%p) CreateSwapChain failed, returning %#x\n", iface, hr);
|
||||
WARN("Failed to create swapchain, hr %#x.\n", hr);
|
||||
*swapchain = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
||||
This->d3d_target->wined3d_swapchain = *swapchain;
|
||||
iterator = This->d3d_target->complex_array[0];
|
||||
ddraw->d3d_target->wined3d_swapchain = *swapchain;
|
||||
iterator = ddraw->d3d_target->complex_array[0];
|
||||
while (iterator)
|
||||
{
|
||||
iterator->wined3d_swapchain = *swapchain;
|
||||
|
@ -5877,19 +5853,14 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
|
|||
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_QueryInterface,
|
||||
device_parent_AddRef,
|
||||
device_parent_Release,
|
||||
/* IWineD3DDeviceParent methods */
|
||||
device_parent_WineD3DDeviceCreated,
|
||||
device_parent_CreateSurface,
|
||||
device_parent_CreateRenderTarget,
|
||||
device_parent_CreateDepthStencilSurface,
|
||||
device_parent_CreateVolume,
|
||||
device_parent_CreateSwapChain,
|
||||
device_parent_wined3d_device_created,
|
||||
device_parent_create_surface,
|
||||
device_parent_create_rendertarget,
|
||||
device_parent_create_depth_stencil,
|
||||
device_parent_create_volume,
|
||||
device_parent_create_swapchain,
|
||||
};
|
||||
|
||||
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->IDirect3D3_iface.lpVtbl = &d3d3_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->ref7 = 1;
|
||||
|
||||
|
@ -5928,8 +5899,8 @@ HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type)
|
|||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
hr = wined3d_device_create(ddraw->wineD3D, WINED3DADAPTER_DEFAULT, device_type, NULL, 0,
|
||||
(IWineD3DDeviceParent *)&ddraw->device_parent_vtbl, &ddraw->wined3d_device);
|
||||
hr = wined3d_device_create(ddraw->wineD3D, WINED3DADAPTER_DEFAULT, device_type,
|
||||
NULL, 0, &ddraw->device_parent, &ddraw->wined3d_device);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to create a wined3d device, hr %#x.\n", hr);
|
||||
|
|
|
@ -78,7 +78,7 @@ struct IDirectDrawImpl
|
|||
IDirect3D3 IDirect3D3_iface;
|
||||
IDirect3D2 IDirect3D2_iface;
|
||||
IDirect3D IDirect3D_iface;
|
||||
const IWineD3DDeviceParentVtbl *device_parent_vtbl;
|
||||
struct wined3d_device_parent device_parent;
|
||||
|
||||
/* See comment in IDirectDraw::AddRef */
|
||||
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_SHARED_RESOURCE *shared_resource, IDXGISurface **surface)
|
||||
{
|
||||
IWineD3DDeviceParent *device_parent;
|
||||
struct wined3d_device_parent *device_parent;
|
||||
IWineDXGIDeviceParent *dxgi_device_parent;
|
||||
HRESULT hr;
|
||||
UINT i;
|
||||
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",
|
||||
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))
|
||||
{
|
||||
ERR("Device should implement IWineD3DDeviceParent\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
device_parent = IWineDXGIDeviceParent_get_wined3d_device_parent(dxgi_device_parent);
|
||||
|
||||
FIXME("Implement DXGI<->wined3d usage conversion\n");
|
||||
|
||||
memset(surface, 0, surface_count * sizeof(*surface));
|
||||
|
@ -181,7 +184,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
|
|||
struct wined3d_surface *wined3d_surface;
|
||||
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,
|
||||
WINED3DCUBEMAP_FACE_POSITIVE_X, &wined3d_surface);
|
||||
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);
|
||||
}
|
||||
IWineD3DDeviceParent_Release(device_parent);
|
||||
IWineDXGIDeviceParent_Release(dxgi_device_parent);
|
||||
|
||||
return S_OK;
|
||||
|
||||
|
@ -210,7 +213,7 @@ fail:
|
|||
{
|
||||
IDXGISurface_Release(surface[i]);
|
||||
}
|
||||
IWineD3DDeviceParent_Release(device_parent);
|
||||
IWineDXGIDeviceParent_Release(dxgi_device_parent);
|
||||
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,
|
||||
IDXGIFactory *factory, IDXGIAdapter *adapter)
|
||||
{
|
||||
IWineD3DDeviceParent *wined3d_device_parent;
|
||||
struct wined3d_device_parent *wined3d_device_parent;
|
||||
IWineDXGIDeviceParent *dxgi_device_parent;
|
||||
IWineDXGIAdapter *wine_adapter;
|
||||
UINT adapter_ordinal;
|
||||
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);
|
||||
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))
|
||||
{
|
||||
ERR("DXGI device should implement IWineD3DDeviceParent.\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
wined3d_device_parent = IWineDXGIDeviceParent_get_wined3d_device_parent(dxgi_device_parent);
|
||||
|
||||
FIXME("Ignoring adapter type.\n");
|
||||
EnterCriticalSection(&dxgi_cs);
|
||||
hr = wined3d_device_create(wined3d, adapter_ordinal, WINED3DDEVTYPE_HAL, NULL, 0,
|
||||
wined3d_device_parent, &device->wined3d_device);
|
||||
IWineD3DDeviceParent_Release(wined3d_device_parent);
|
||||
IWineDXGIDeviceParent_Release(dxgi_device_parent);
|
||||
wined3d_decref(wined3d);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
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. */
|
||||
TRACE("Creating implicit swapchain\n");
|
||||
hr = IWineD3DDeviceParent_CreateSwapChain(device->device_parent,
|
||||
hr = device->device_parent->ops->create_swapchain(device->device_parent,
|
||||
present_parameters, &swapchain);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -1356,7 +1356,7 @@ HRESULT CDECL wined3d_device_init_gdi(struct wined3d_device *device,
|
|||
|
||||
/* Setup the implicit swapchain */
|
||||
TRACE("Creating implicit swapchain\n");
|
||||
hr = IWineD3DDeviceParent_CreateSwapChain(device->device_parent,
|
||||
hr = device->device_parent->ops->create_swapchain(device->device_parent,
|
||||
present_parameters, &swapchain);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -5694,7 +5694,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
|
|||
|
||||
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->BackBufferHeight,
|
||||
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,
|
||||
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];
|
||||
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,
|
||||
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;
|
||||
HRESULT hr;
|
||||
|
@ -4881,7 +4881,7 @@ HRESULT CDECL wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, W
|
|||
TRACE("Created device %p.\n", object);
|
||||
*device = object;
|
||||
|
||||
IWineD3DDeviceParent_WineD3DDeviceCreated(device_parent, *device);
|
||||
device_parent->ops->wined3d_device_created(device_parent, *device);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
|
|
@ -898,7 +898,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
|
|||
}
|
||||
|
||||
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.BackBufferFormat, swapchain->presentParms.MultiSampleType,
|
||||
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)
|
||||
{
|
||||
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.BackBufferFormat, swapchain->presentParms.MultiSampleType,
|
||||
swapchain->presentParms.MultiSampleQuality, TRUE /* Lockable */,
|
||||
|
@ -1030,7 +1030,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
|
|||
TRACE("Creating depth/stencil buffer.\n");
|
||||
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.AutoDepthStencilFormat, swapchain->presentParms.MultiSampleType,
|
||||
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;
|
||||
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);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -1051,7 +1051,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT he
|
|||
struct wined3d_surface *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);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -1259,7 +1259,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, UINT width, U
|
|||
struct wined3d_volume *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);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
|
|
@ -1645,7 +1645,7 @@ struct wined3d_device
|
|||
LONG ref;
|
||||
|
||||
/* WineD3D Information */
|
||||
IWineD3DDeviceParent *device_parent;
|
||||
struct wined3d_device_parent *device_parent;
|
||||
struct wined3d *wined3d;
|
||||
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;
|
||||
HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
|
||||
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;
|
||||
LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL unicode,
|
||||
UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -2101,66 +2101,30 @@ struct wined3d_texture;
|
|||
struct wined3d_vertex_declaration;
|
||||
struct wined3d_volume;
|
||||
|
||||
[
|
||||
object,
|
||||
local,
|
||||
uuid(aeb62dfc-bdcb-4f02-9519-1eeea00c15cd)
|
||||
]
|
||||
interface IWineD3DDeviceParent : IUnknown
|
||||
struct wined3d_device_parent
|
||||
{
|
||||
void WineD3DDeviceCreated(
|
||||
[in] struct wined3d_device *device
|
||||
);
|
||||
const struct wined3d_device_parent_ops *ops;
|
||||
};
|
||||
|
||||
HRESULT CreateSurface(
|
||||
[in] void *container_parent,
|
||||
[in] UINT width,
|
||||
[in] UINT height,
|
||||
[in] enum wined3d_format_id format_id,
|
||||
[in] DWORD usage,
|
||||
[in] WINED3DPOOL pool,
|
||||
[in] UINT level,
|
||||
[in] WINED3DCUBEMAP_FACES face,
|
||||
[out] struct wined3d_surface **surface
|
||||
);
|
||||
struct wined3d_device_parent_ops
|
||||
{
|
||||
void (__cdecl *wined3d_device_created)(struct wined3d_device_parent *device_parent, struct wined3d_device *device);
|
||||
HRESULT (__cdecl *create_surface)(struct wined3d_device_parent *device_parent, void *container_parent,
|
||||
UINT width, UINT height, enum wined3d_format_id format_id, DWORD usage, WINED3DPOOL pool,
|
||||
UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface);
|
||||
HRESULT (__cdecl *create_rendertarget)(struct wined3d_device_parent *device_parent, void *container_parent,
|
||||
UINT width, UINT height, enum wined3d_format_id format_id, WINED3DMULTISAMPLE_TYPE multisample_type,
|
||||
DWORD multisample_quality, BOOL lockable, 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);
|
||||
|
||||
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);
|
||||
HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx,
|
||||
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);
|
||||
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);
|
||||
|
|
|
@ -58,3 +58,13 @@ interface IWineDXGIDevice : IDXGIDevice
|
|||
[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