dxgi: Update to IDXGISurface1.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-03-29 09:36:59 +03:00 committed by Alexandre Julliard
parent 9cc6a6e5d6
commit b537beb60f
4 changed files with 54 additions and 29 deletions

View File

@ -304,7 +304,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_create_surface(IWineDXGIDevice *ifa
} }
TRACE("Created IDXGISurface %p\n", object); TRACE("Created IDXGISurface %p\n", object);
*surface = outer ? &object->IUnknown_iface : (IUnknown *)&object->IDXGISurface_iface; *surface = outer ? &object->IUnknown_iface : (IUnknown *)&object->IDXGISurface1_iface;
return S_OK; return S_OK;
} }

View File

@ -165,7 +165,7 @@ HRESULT dxgi_swapchain_init(struct dxgi_swapchain *swapchain, struct dxgi_device
/* IDXGISurface */ /* IDXGISurface */
struct dxgi_surface struct dxgi_surface
{ {
IDXGISurface IDXGISurface_iface; IDXGISurface1 IDXGISurface1_iface;
IUnknown IUnknown_iface; IUnknown IUnknown_iface;
IUnknown *outer_unknown; IUnknown *outer_unknown;
LONG refcount; LONG refcount;

View File

@ -37,13 +37,14 @@ static HRESULT STDMETHODCALLTYPE dxgi_surface_inner_QueryInterface(IUnknown *ifa
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
if (IsEqualGUID(riid, &IID_IDXGISurface) if (IsEqualGUID(riid, &IID_IDXGISurface1)
|| IsEqualGUID(riid, &IID_IDXGISurface)
|| IsEqualGUID(riid, &IID_IDXGIDeviceSubObject) || IsEqualGUID(riid, &IID_IDXGIDeviceSubObject)
|| IsEqualGUID(riid, &IID_IDXGIObject) || IsEqualGUID(riid, &IID_IDXGIObject)
|| IsEqualGUID(riid, &IID_IUnknown)) || IsEqualGUID(riid, &IID_IUnknown))
{ {
IDXGISurface_AddRef(&surface->IDXGISurface_iface); IDXGISurface1_AddRef(&surface->IDXGISurface1_iface);
*out = &surface->IDXGISurface_iface; *out = &surface->IDXGISurface1_iface;
return S_OK; return S_OK;
} }
@ -79,70 +80,70 @@ static ULONG STDMETHODCALLTYPE dxgi_surface_inner_Release(IUnknown *iface)
return refcount; return refcount;
} }
static inline struct dxgi_surface *impl_from_IDXGISurface(IDXGISurface *iface) static inline struct dxgi_surface *impl_from_IDXGISurface1(IDXGISurface1 *iface)
{ {
return CONTAINING_RECORD(iface, struct dxgi_surface, IDXGISurface_iface); return CONTAINING_RECORD(iface, struct dxgi_surface, IDXGISurface1_iface);
} }
/* IUnknown methods */ /* IUnknown methods */
static HRESULT STDMETHODCALLTYPE dxgi_surface_QueryInterface(IDXGISurface *iface, REFIID riid, static HRESULT STDMETHODCALLTYPE dxgi_surface_QueryInterface(IDXGISurface1 *iface, REFIID riid,
void **object) void **object)
{ {
struct dxgi_surface *This = impl_from_IDXGISurface(iface); struct dxgi_surface *This = impl_from_IDXGISurface1(iface);
TRACE("Forwarding to outer IUnknown\n"); TRACE("Forwarding to outer IUnknown\n");
return IUnknown_QueryInterface(This->outer_unknown, riid, object); return IUnknown_QueryInterface(This->outer_unknown, riid, object);
} }
static ULONG STDMETHODCALLTYPE dxgi_surface_AddRef(IDXGISurface *iface) static ULONG STDMETHODCALLTYPE dxgi_surface_AddRef(IDXGISurface1 *iface)
{ {
struct dxgi_surface *This = impl_from_IDXGISurface(iface); struct dxgi_surface *This = impl_from_IDXGISurface1(iface);
TRACE("Forwarding to outer IUnknown\n"); TRACE("Forwarding to outer IUnknown\n");
return IUnknown_AddRef(This->outer_unknown); return IUnknown_AddRef(This->outer_unknown);
} }
static ULONG STDMETHODCALLTYPE dxgi_surface_Release(IDXGISurface *iface) static ULONG STDMETHODCALLTYPE dxgi_surface_Release(IDXGISurface1 *iface)
{ {
struct dxgi_surface *This = impl_from_IDXGISurface(iface); struct dxgi_surface *This = impl_from_IDXGISurface1(iface);
TRACE("Forwarding to outer IUnknown\n"); TRACE("Forwarding to outer IUnknown\n");
return IUnknown_Release(This->outer_unknown); return IUnknown_Release(This->outer_unknown);
} }
/* IDXGIObject methods */ /* IDXGIObject methods */
static HRESULT STDMETHODCALLTYPE dxgi_surface_SetPrivateData(IDXGISurface *iface, static HRESULT STDMETHODCALLTYPE dxgi_surface_SetPrivateData(IDXGISurface1 *iface,
REFGUID guid, UINT data_size, const void *data) REFGUID guid, UINT data_size, const void *data)
{ {
struct dxgi_surface *surface = impl_from_IDXGISurface(iface); struct dxgi_surface *surface = impl_from_IDXGISurface1(iface);
TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data); TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
return dxgi_set_private_data(&surface->private_store, guid, data_size, data); return dxgi_set_private_data(&surface->private_store, guid, data_size, data);
} }
static HRESULT STDMETHODCALLTYPE dxgi_surface_SetPrivateDataInterface(IDXGISurface *iface, static HRESULT STDMETHODCALLTYPE dxgi_surface_SetPrivateDataInterface(IDXGISurface1 *iface,
REFGUID guid, const IUnknown *object) REFGUID guid, const IUnknown *object)
{ {
struct dxgi_surface *surface = impl_from_IDXGISurface(iface); struct dxgi_surface *surface = impl_from_IDXGISurface1(iface);
TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object); TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object);
return dxgi_set_private_data_interface(&surface->private_store, guid, object); return dxgi_set_private_data_interface(&surface->private_store, guid, object);
} }
static HRESULT STDMETHODCALLTYPE dxgi_surface_GetPrivateData(IDXGISurface *iface, static HRESULT STDMETHODCALLTYPE dxgi_surface_GetPrivateData(IDXGISurface1 *iface,
REFGUID guid, UINT *data_size, void *data) REFGUID guid, UINT *data_size, void *data)
{ {
struct dxgi_surface *surface = impl_from_IDXGISurface(iface); struct dxgi_surface *surface = impl_from_IDXGISurface1(iface);
TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data); TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
return dxgi_get_private_data(&surface->private_store, guid, data_size, data); return dxgi_get_private_data(&surface->private_store, guid, data_size, data);
} }
static HRESULT STDMETHODCALLTYPE dxgi_surface_GetParent(IDXGISurface *iface, REFIID riid, void **parent) static HRESULT STDMETHODCALLTYPE dxgi_surface_GetParent(IDXGISurface1 *iface, REFIID riid, void **parent)
{ {
struct dxgi_surface *This = impl_from_IDXGISurface(iface); struct dxgi_surface *This = impl_from_IDXGISurface1(iface);
TRACE("iface %p, riid %s, parent %p.\n", iface, debugstr_guid(riid), parent); TRACE("iface %p, riid %s, parent %p.\n", iface, debugstr_guid(riid), parent);
@ -151,9 +152,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_surface_GetParent(IDXGISurface *iface, REF
/* IDXGIDeviceSubObject methods */ /* IDXGIDeviceSubObject methods */
static HRESULT STDMETHODCALLTYPE dxgi_surface_GetDevice(IDXGISurface *iface, REFIID riid, void **device) static HRESULT STDMETHODCALLTYPE dxgi_surface_GetDevice(IDXGISurface1 *iface, REFIID riid, void **device)
{ {
struct dxgi_surface *This = impl_from_IDXGISurface(iface); struct dxgi_surface *This = impl_from_IDXGISurface1(iface);
TRACE("iface %p, riid %s, device %p.\n", iface, debugstr_guid(riid), device); TRACE("iface %p, riid %s, device %p.\n", iface, debugstr_guid(riid), device);
@ -161,9 +162,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_surface_GetDevice(IDXGISurface *iface, REF
} }
/* IDXGISurface methods */ /* IDXGISurface methods */
static HRESULT STDMETHODCALLTYPE dxgi_surface_GetDesc(IDXGISurface *iface, DXGI_SURFACE_DESC *desc) static HRESULT STDMETHODCALLTYPE dxgi_surface_GetDesc(IDXGISurface1 *iface, DXGI_SURFACE_DESC *desc)
{ {
struct dxgi_surface *surface = impl_from_IDXGISurface(iface); struct dxgi_surface *surface = impl_from_IDXGISurface1(iface);
struct wined3d_resource_desc wined3d_desc; struct wined3d_resource_desc wined3d_desc;
TRACE("iface %p, desc %p.\n", iface, desc); TRACE("iface %p, desc %p.\n", iface, desc);
@ -179,21 +180,36 @@ static HRESULT STDMETHODCALLTYPE dxgi_surface_GetDesc(IDXGISurface *iface, DXGI_
return S_OK; return S_OK;
} }
static HRESULT STDMETHODCALLTYPE dxgi_surface_Map(IDXGISurface *iface, DXGI_MAPPED_RECT *mapped_rect, UINT flags) static HRESULT STDMETHODCALLTYPE dxgi_surface_Map(IDXGISurface1 *iface, DXGI_MAPPED_RECT *mapped_rect, UINT flags)
{ {
FIXME("iface %p, mapped_rect %p, flags %#x stub!\n", iface, mapped_rect, flags); FIXME("iface %p, mapped_rect %p, flags %#x stub!\n", iface, mapped_rect, flags);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT STDMETHODCALLTYPE dxgi_surface_Unmap(IDXGISurface *iface) static HRESULT STDMETHODCALLTYPE dxgi_surface_Unmap(IDXGISurface1 *iface)
{ {
FIXME("iface %p stub!\n", iface); FIXME("iface %p stub!\n", iface);
return E_NOTIMPL; return E_NOTIMPL;
} }
static const struct IDXGISurfaceVtbl dxgi_surface_vtbl = /* IDXGISurface1 methods */
static HRESULT STDMETHODCALLTYPE dxgi_surface_GetDC(IDXGISurface1 *iface, BOOL discard, HDC *hdc)
{
FIXME("iface %p, discard %d, hdc %p stub!\n", iface, discard, hdc);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE dxgi_surface_ReleaseDC(IDXGISurface1 *iface, RECT *dirty_rect)
{
FIXME("iface %p, rect %p stub!\n", iface, dirty_rect);
return E_NOTIMPL;
}
static const struct IDXGISurface1Vtbl dxgi_surface_vtbl =
{ {
/* IUnknown methods */ /* IUnknown methods */
dxgi_surface_QueryInterface, dxgi_surface_QueryInterface,
@ -210,6 +226,9 @@ static const struct IDXGISurfaceVtbl dxgi_surface_vtbl =
dxgi_surface_GetDesc, dxgi_surface_GetDesc,
dxgi_surface_Map, dxgi_surface_Map,
dxgi_surface_Unmap, dxgi_surface_Unmap,
/* IDXGISurface1 methods */
dxgi_surface_GetDC,
dxgi_surface_ReleaseDC,
}; };
static const struct IUnknownVtbl dxgi_surface_inner_unknown_vtbl = static const struct IUnknownVtbl dxgi_surface_inner_unknown_vtbl =
@ -223,7 +242,7 @@ static const struct IUnknownVtbl dxgi_surface_inner_unknown_vtbl =
HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device, HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device,
IUnknown *outer, struct wined3d_resource *wined3d_resource) IUnknown *outer, struct wined3d_resource *wined3d_resource)
{ {
surface->IDXGISurface_iface.lpVtbl = &dxgi_surface_vtbl; surface->IDXGISurface1_iface.lpVtbl = &dxgi_surface_vtbl;
surface->IUnknown_iface.lpVtbl = &dxgi_surface_inner_unknown_vtbl; surface->IUnknown_iface.lpVtbl = &dxgi_surface_inner_unknown_vtbl;
surface->refcount = 1; surface->refcount = 1;
wined3d_private_store_init(&surface->private_store); wined3d_private_store_init(&surface->private_store);

View File

@ -188,6 +188,7 @@ static void test_create_surface(void)
DXGI_SURFACE_DESC desc; DXGI_SURFACE_DESC desc;
IDXGISurface *surface; IDXGISurface *surface;
IDXGIDevice *device; IDXGIDevice *device;
IUnknown *surface1;
IUnknown *texture; IUnknown *texture;
ULONG refcount; ULONG refcount;
HRESULT hr; HRESULT hr;
@ -216,6 +217,11 @@ static void test_create_surface(void)
"Surface should implement ID3D11Texture2D.\n"); "Surface should implement ID3D11Texture2D.\n");
if (SUCCEEDED(hr)) IUnknown_Release(texture); if (SUCCEEDED(hr)) IUnknown_Release(texture);
hr = IDXGISurface_QueryInterface(surface, &IID_IDXGISurface1, (void **)&surface1);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
"Surface should implement IDXGISurface1.\n");
if (SUCCEEDED(hr)) IUnknown_Release(surface1);
IDXGISurface_Release(surface); IDXGISurface_Release(surface);
refcount = IDXGIDevice_Release(device); refcount = IDXGIDevice_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount); ok(!refcount, "Device has %u references left.\n", refcount);