d3d10core: Implement d3d10_texture2d_SetPrivateDataInterface().

This commit is contained in:
Henri Verbeet 2015-02-23 17:59:43 +01:00 committed by Alexandre Julliard
parent c2e6a7d0b1
commit 21da7be665
4 changed files with 29 additions and 7 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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 */

View File

@ -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;