Commit 34f4c407 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d10core: Implement d3d10_device_GetPrivateData().

parent 7f7844a7
......@@ -1275,10 +1275,18 @@ static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device1 *iface
static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device1 *iface,
REFGUID guid, UINT *data_size, void *data)
{
FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
IDXGIDevice *dxgi_device;
HRESULT hr;
TRACE("iface %p, guid %s, data_size %p, data %p.\n",
iface, debugstr_guid(guid), data_size, data);
return E_NOTIMPL;
if (FAILED(hr = ID3D10Device1_QueryInterface(iface, &IID_IDXGIDevice, (void **)&dxgi_device)))
return hr;
hr = IDXGIDevice_GetPrivateData(dxgi_device, guid, data_size, data);
IDXGIDevice_Release(dxgi_device);
return hr;
}
static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device1 *iface,
......
......@@ -2562,9 +2562,9 @@ static void test_private_data(void)
size = sizeof(ptr) * 2;
ptr = (IUnknown *)0xdeadbeef;
hr = ID3D10Device_GetPrivateData(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);
hr = ID3D10Device_QueryInterface(device, &IID_IDXGIDevice, (void **)&dxgi_device);
ok(SUCCEEDED(hr), "Failed to get DXGI device, hr %#x.\n", hr);
......@@ -2615,41 +2615,40 @@ static void test_private_data(void)
size = 2 * sizeof(ptr);
ptr = NULL;
hr = ID3D10Device_GetPrivateData(device, &test_guid, &size, &ptr);
todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
todo_wine ok(size == sizeof(test_object), "Got unexpected size %u.\n", size);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
ok(size == sizeof(test_object), "Got unexpected size %u.\n", size);
++expected_refcount;
refcount = get_refcount((IUnknown *)test_object);
todo_wine ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
if (ptr)
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
IUnknown_Release(ptr);
--expected_refcount;
ptr = (IUnknown *)0xdeadbeef;
size = 1;
hr = ID3D10Device_GetPrivateData(device, &test_guid, &size, NULL);
todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
todo_wine ok(size == sizeof(device), "Got unexpected size %u.\n", size);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
ok(size == sizeof(device), "Got unexpected size %u.\n", size);
size = 2 * sizeof(ptr);
hr = ID3D10Device_GetPrivateData(device, &test_guid, &size, NULL);
todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
todo_wine ok(size == sizeof(device), "Got unexpected size %u.\n", size);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
ok(size == sizeof(device), "Got unexpected size %u.\n", size);
refcount = get_refcount((IUnknown *)test_object);
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
size = 1;
hr = ID3D10Device_GetPrivateData(device, &test_guid, &size, &ptr);
todo_wine ok(hr == DXGI_ERROR_MORE_DATA, "Got unexpected hr %#x.\n", hr);
todo_wine ok(size == sizeof(device), "Got unexpected size %u.\n", size);
ok(hr == DXGI_ERROR_MORE_DATA, "Got unexpected hr %#x.\n", hr);
ok(size == sizeof(device), "Got unexpected size %u.\n", size);
ok(ptr == (IUnknown *)0xdeadbeef, "Got unexpected pointer %p.\n", ptr);
hr = ID3D10Device_GetPrivateData(device, &test_guid2, NULL, NULL);
todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
size = 0xdeadbabe;
hr = ID3D10Device_GetPrivateData(device, &test_guid2, &size, &ptr);
todo_wine ok(hr == DXGI_ERROR_NOT_FOUND, "Got unexpected hr %#x.\n", hr);
todo_wine ok(size == 0, "Got unexpected size %u.\n", size);
ok(hr == DXGI_ERROR_NOT_FOUND, "Got unexpected hr %#x.\n", hr);
ok(size == 0, "Got unexpected size %u.\n", size);
ok(ptr == (IUnknown *)0xdeadbeef, "Got unexpected pointer %p.\n", ptr);
hr = ID3D10Device_GetPrivateData(device, &test_guid, NULL, &ptr);
todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
ok(ptr == (IUnknown *)0xdeadbeef, "Got unexpected pointer %p.\n", ptr);
refcount = ID3D10Device_Release(device);
......
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