[PATCH 4/5] dxgi: Implement dxgi_device_SetPrivateDataInterface().
Henri Verbeet
hverbeet at codeweavers.com
Thu Feb 12 02:34:58 CST 2015
---
dlls/dxgi/device.c | 6 ++++--
dlls/dxgi/dxgi_private.h | 2 ++
dlls/dxgi/tests/device.c | 22 +++++++++++-----------
dlls/dxgi/utils.c | 16 ++++++++++++++++
4 files changed, 33 insertions(+), 13 deletions(-)
diff --git a/dlls/dxgi/device.c b/dlls/dxgi/device.c
index f0c38a0..8b32041 100644
--- a/dlls/dxgi/device.c
+++ b/dlls/dxgi/device.c
@@ -106,9 +106,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_SetPrivateData(IWineDXGIDevice *ifa
static HRESULT STDMETHODCALLTYPE dxgi_device_SetPrivateDataInterface(IWineDXGIDevice *iface,
REFGUID guid, const IUnknown *object)
{
- FIXME("iface %p, guid %s, object %p stub!\n", iface, debugstr_guid(guid), object);
+ struct dxgi_device *device = impl_from_IWineDXGIDevice(iface);
- return E_NOTIMPL;
+ TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object);
+
+ return dxgi_set_private_data_interface(&device->private_store, guid, object);
}
static HRESULT STDMETHODCALLTYPE dxgi_device_GetPrivateData(IWineDXGIDevice *iface,
diff --git a/dlls/dxgi/dxgi_private.h b/dlls/dxgi/dxgi_private.h
index a22916d..655dd40 100644
--- a/dlls/dxgi/dxgi_private.h
+++ b/dlls/dxgi/dxgi_private.h
@@ -78,6 +78,8 @@ DXGI_FORMAT dxgi_format_from_wined3dformat(enum wined3d_format_id format) DECLSP
enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
HRESULT dxgi_set_private_data(struct wined3d_private_store *store,
REFGUID guid, UINT data_size, const void *data) DECLSPEC_HIDDEN;
+HRESULT dxgi_set_private_data_interface(struct wined3d_private_store *store,
+ REFGUID guid, const IUnknown *object) DECLSPEC_HIDDEN;
/* IDXGIFactory */
struct dxgi_factory
diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c
index be571a4..b00c5e4 100644
--- a/dlls/dxgi/tests/device.c
+++ b/dlls/dxgi/tests/device.c
@@ -623,14 +623,14 @@ static void test_private_data(void)
hr = IDXGIDevice_SetPrivateData(device, &dxgi_private_data_test_guid, 0, NULL);
ok(hr == S_FALSE, "Got unexpected hr %#x.\n", hr);
hr = IDXGIDevice_SetPrivateDataInterface(device, &dxgi_private_data_test_guid, NULL);
- todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
hr = IDXGIDevice_SetPrivateData(device, &dxgi_private_data_test_guid, ~0U, NULL);
- todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
hr = IDXGIDevice_SetPrivateData(device, &dxgi_private_data_test_guid, ~0U, NULL);
ok(hr == S_FALSE, "Got unexpected hr %#x.\n", hr);
hr = IDXGIDevice_SetPrivateDataInterface(device, &dxgi_private_data_test_guid, NULL);
- todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
size = sizeof(ptr) * 2;
ptr = (IUnknown *)0xdeadbeef;
hr = IDXGIDevice_GetPrivateData(device, &dxgi_private_data_test_guid, &size, &ptr);
@@ -641,25 +641,25 @@ static void test_private_data(void)
refcount = get_refcount((IUnknown *)test_object);
hr = IDXGIDevice_SetPrivateDataInterface(device, &dxgi_private_data_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);
expected_refcount = refcount + 1;
refcount = get_refcount((IUnknown *)test_object);
- todo_wine ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
+ ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
hr = IDXGIDevice_SetPrivateDataInterface(device, &dxgi_private_data_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);
refcount = get_refcount((IUnknown *)test_object);
- todo_wine ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
+ ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
hr = IDXGIDevice_SetPrivateDataInterface(device, &dxgi_private_data_test_guid, NULL);
- todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
expected_refcount--;
refcount = get_refcount((IUnknown *)test_object);
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
hr = IDXGIDevice_SetPrivateDataInterface(device, &dxgi_private_data_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);
size = sizeof(data);
hr = IDXGIDevice_SetPrivateData(device, &dxgi_private_data_test_guid, size, data);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
@@ -672,7 +672,7 @@ static void test_private_data(void)
hr = IDXGIDevice_SetPrivateDataInterface(device, &dxgi_private_data_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);
expected_refcount++;
size = 2 * sizeof(ptr);
ptr = NULL;
@@ -696,7 +696,7 @@ static void test_private_data(void)
todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
todo_wine ok(size == sizeof(device), "Got unexpected size %u.\n", size);
refcount = get_refcount((IUnknown *)test_object);
- todo_wine ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
+ ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
size = 1;
hr = IDXGIDevice_GetPrivateData(device, &dxgi_private_data_test_guid, &size, &ptr);
diff --git a/dlls/dxgi/utils.c b/dlls/dxgi/utils.c
index 1a8db7e..576a9ba 100644
--- a/dlls/dxgi/utils.c
+++ b/dlls/dxgi/utils.c
@@ -352,3 +352,19 @@ HRESULT dxgi_set_private_data(struct wined3d_private_store *store,
return hr;
}
+
+HRESULT dxgi_set_private_data_interface(struct wined3d_private_store *store,
+ REFGUID guid, const IUnknown *object)
+{
+ HRESULT hr;
+
+ if (!object)
+ return dxgi_set_private_data(store, guid, sizeof(object), &object);
+
+ EnterCriticalSection(&dxgi_cs);
+ hr = wined3d_private_store_set_private_data(store,
+ guid, object, sizeof(object), WINED3DSPD_IUNKNOWN);
+ LeaveCriticalSection(&dxgi_cs);
+
+ return hr;
+}
--
1.7.10.4
More information about the wine-patches
mailing list