From 21da7be665da1e8261649d596fd1f40ce382b979 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 23 Feb 2015 17:59:43 +0100 Subject: [PATCH] d3d10core: Implement d3d10_texture2d_SetPrivateDataInterface(). --- dlls/d3d10core/d3d10core_private.h | 2 ++ dlls/d3d10core/tests/device.c | 9 ++++----- dlls/d3d10core/texture.c | 16 ++++++++++++++-- dlls/d3d10core/utils.c | 9 +++++++++ 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/dlls/d3d10core/d3d10core_private.h b/dlls/d3d10core/d3d10core_private.h index a3ab637b658..6a975c198c7 100644 --- a/dlls/d3d10core/d3d10core_private.h +++ b/dlls/d3d10core/d3d10core_private.h @@ -68,6 +68,8 @@ DWORD wined3d_map_flags_from_d3d10_map_type(D3D10_MAP map_type) DECLSPEC_HIDDEN; HRESULT d3d10_set_private_data(struct wined3d_private_store *store, REFGUID guid, UINT data_size, const void *data) DECLSPEC_HIDDEN; +HRESULT d3d10_set_private_data_interface(struct wined3d_private_store *store, + REFGUID guid, const IUnknown *object) DECLSPEC_HIDDEN; static inline void read_dword(const char **ptr, DWORD *d) { diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 5e3668de924..68012ac6871 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -2672,14 +2672,13 @@ static void test_private_data(void) ok(ptr == (IUnknown *)0xdeadbeef, "Got unexpected pointer %p.\n", ptr); hr = ID3D10Texture2D_SetPrivateDataInterface(texture, &test_guid, (IUnknown *)test_object); - todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ptr = NULL; size = sizeof(ptr); hr = IDXGISurface_GetPrivateData(surface, &test_guid, &size, &ptr); - todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); - todo_wine ok(ptr == (IUnknown *)test_object, "Got unexpected ptr %p, expected %p.\n", ptr, test_object); - if (ptr) - IUnknown_Release(ptr); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(ptr == (IUnknown *)test_object, "Got unexpected ptr %p, expected %p.\n", ptr, test_object); + IUnknown_Release(ptr); IDXGISurface_Release(surface); ID3D10Texture2D_Release(texture); diff --git a/dlls/d3d10core/texture.c b/dlls/d3d10core/texture.c index 8897c1de795..1c82bad7226 100644 --- a/dlls/d3d10core/texture.c +++ b/dlls/d3d10core/texture.c @@ -149,9 +149,21 @@ static HRESULT STDMETHODCALLTYPE d3d10_texture2d_SetPrivateData(ID3D10Texture2D static HRESULT STDMETHODCALLTYPE d3d10_texture2d_SetPrivateDataInterface(ID3D10Texture2D *iface, REFGUID guid, const IUnknown *data) { - FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data); + struct d3d10_texture2d *texture = impl_from_ID3D10Texture2D(iface); + IDXGISurface *dxgi_surface; + HRESULT hr; - return E_NOTIMPL; + TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data); + + if (texture->dxgi_surface + && SUCCEEDED(IUnknown_QueryInterface(texture->dxgi_surface, &IID_IDXGISurface, (void **)&dxgi_surface))) + { + hr = IDXGISurface_SetPrivateDataInterface(dxgi_surface, guid, data); + IDXGISurface_Release(dxgi_surface); + return hr; + } + + return d3d10_set_private_data_interface(&texture->private_store, guid, data); } /* ID3D10Resource methods */ diff --git a/dlls/d3d10core/utils.c b/dlls/d3d10core/utils.c index 6dee2d1d87e..a5f539b276f 100644 --- a/dlls/d3d10core/utils.c +++ b/dlls/d3d10core/utils.c @@ -428,6 +428,15 @@ HRESULT d3d10_set_private_data(struct wined3d_private_store *store, return wined3d_private_store_set_private_data(store, guid, data, data_size, 0); } +HRESULT d3d10_set_private_data_interface(struct wined3d_private_store *store, + REFGUID guid, const IUnknown *object) +{ + if (!object) + return d3d10_set_private_data(store, guid, sizeof(object), &object); + + return wined3d_private_store_set_private_data(store, + guid, object, sizeof(object), WINED3DSPD_IUNKNOWN); +} void skip_dword_unknown(const char **ptr, unsigned int count) { unsigned int i; -- 2.11.4.GIT