Commit 2190f026 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

dxgi: Implement dxgi_device_SetPrivateDataInterface().

parent 4e93a02a
......@@ -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,
......
......@@ -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
......
......@@ -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);
......
......@@ -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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment