From 7f7844a79dd68d48dd6a50ba12e3164cba68ee43 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 23 Feb 2015 17:59:40 +0100 Subject: [PATCH] d3d10core: Implement d3d10_device_SetPrivateDataInterface(). --- dlls/d3d10core/device.c | 12 ++++++++++-- dlls/d3d10core/tests/device.c | 28 ++++++++++++++-------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c index 21f3c30c992..fe7e0544a37 100644 --- a/dlls/d3d10core/device.c +++ b/dlls/d3d10core/device.c @@ -1301,9 +1301,17 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device1 *ifac static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device1 *iface, REFGUID guid, const IUnknown *data) { - FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data); + IDXGIDevice *dxgi_device; + HRESULT hr; - return E_NOTIMPL; + TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data); + + if (FAILED(hr = ID3D10Device1_QueryInterface(iface, &IID_IDXGIDevice, (void **)&dxgi_device))) + return hr; + hr = IDXGIDevice_SetPrivateDataInterface(dxgi_device, guid, data); + IDXGIDevice_Release(dxgi_device); + + return hr; } static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device1 *iface) diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 24bdddab4a3..6524e3284ff 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -2551,14 +2551,14 @@ static void test_private_data(void) hr = ID3D10Device_SetPrivateData(device, &test_guid, 0, NULL); ok(hr == S_FALSE, "Got unexpected hr %#x.\n", hr); hr = ID3D10Device_SetPrivateDataInterface(device, &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 = ID3D10Device_SetPrivateData(device, &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 = ID3D10Device_SetPrivateData(device, &test_guid, ~0u, NULL); ok(hr == S_FALSE, "Got unexpected hr %#x.\n", hr); hr = ID3D10Device_SetPrivateDataInterface(device, &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 = ID3D10Device_GetPrivateData(device, &test_guid, &size, &ptr); @@ -2571,33 +2571,33 @@ static void test_private_data(void) size = sizeof(ptr) * 2; ptr = (IUnknown *)0xdeadbeef; hr = IDXGIDevice_GetPrivateData(dxgi_device, &test_guid, &size, &ptr); - todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); - todo_wine ok(!ptr, "Got unexpected pointer %p.\n", ptr); - todo_wine ok(size == sizeof(IUnknown *), "Got unexpected size %u.\n", size); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(!ptr, "Got unexpected pointer %p.\n", ptr); + ok(size == sizeof(IUnknown *), "Got unexpected size %u.\n", size); IDXGIDevice_Release(dxgi_device); refcount = get_refcount((IUnknown *)test_object); hr = ID3D10Device_SetPrivateDataInterface(device, &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 = ID3D10Device_SetPrivateDataInterface(device, &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 = ID3D10Device_SetPrivateDataInterface(device, &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 = ID3D10Device_SetPrivateDataInterface(device, &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 = ID3D10Device_SetPrivateData(device, &test_guid, size, data); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); @@ -2610,7 +2610,7 @@ static void test_private_data(void) hr = ID3D10Device_SetPrivateDataInterface(device, &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; @@ -2634,7 +2634,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 = ID3D10Device_GetPrivateData(device, &test_guid, &size, &ptr);