diff --git a/dlls/d3d8/buffer.c b/dlls/d3d8/buffer.c index 8cf55311ba9..74d81f4bb3a 100644 --- a/dlls/d3d8/buffer.c +++ b/dlls/d3d8/buffer.c @@ -21,6 +21,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d8); +static inline IDirect3DVertexBuffer8Impl *impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface) +{ + return CONTAINING_RECORD(iface, IDirect3DVertexBuffer8Impl, lpVtbl); +} + static HRESULT WINAPI d3d8_vertexbuffer_QueryInterface(IDirect3DVertexBuffer8 *iface, REFIID riid, void **object) { TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); @@ -95,14 +100,16 @@ static HRESULT WINAPI d3d8_vertexbuffer_GetDevice(IDirect3DVertexBuffer8 *iface, static HRESULT WINAPI d3d8_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer8 *iface, REFGUID guid, const void *data, DWORD data_size, DWORD flags) { + IDirect3DVertexBuffer8Impl *buffer = impl_from_IDirect3DVertexBuffer8(iface); + struct wined3d_resource *resource; HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); wined3d_mutex_lock(); - hr = wined3d_buffer_set_private_data(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, - guid, data, data_size, flags); + resource = wined3d_buffer_get_resource(buffer->wineD3DVertexBuffer); + hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); wined3d_mutex_unlock(); return hr; @@ -111,14 +118,16 @@ static HRESULT WINAPI d3d8_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer8 *i static HRESULT WINAPI d3d8_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer8 *iface, REFGUID guid, void *data, DWORD *data_size) { + IDirect3DVertexBuffer8Impl *buffer = impl_from_IDirect3DVertexBuffer8(iface); + struct wined3d_resource *resource; HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); wined3d_mutex_lock(); - hr = wined3d_buffer_get_private_data(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, - guid, data, data_size); + resource = wined3d_buffer_get_resource(buffer->wineD3DVertexBuffer); + hr = wined3d_resource_get_private_data(resource, guid, data, data_size); wined3d_mutex_unlock(); return hr; @@ -126,12 +135,15 @@ static HRESULT WINAPI d3d8_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer8 *i static HRESULT WINAPI d3d8_vertexbuffer_FreePrivateData(IDirect3DVertexBuffer8 *iface, REFGUID guid) { + IDirect3DVertexBuffer8Impl *buffer = impl_from_IDirect3DVertexBuffer8(iface); + struct wined3d_resource *resource; HRESULT hr; TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); wined3d_mutex_lock(); - hr = wined3d_buffer_free_private_data(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, guid); + resource = wined3d_buffer_get_resource(buffer->wineD3DVertexBuffer); + hr = wined3d_resource_free_private_data(resource, guid); wined3d_mutex_unlock(); return hr;