Commit aa8e4dd8 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

d3d8: Use unsafe_impl_from_IDirect3DVertexBuffer8 for app provided ifaces.

parent 23dd500a
...@@ -298,6 +298,15 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Im ...@@ -298,6 +298,15 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Im
return D3D_OK; return D3D_OK;
} }
IDirect3DVertexBuffer8Impl *unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == &Direct3DVertexBuffer8_Vtbl);
return impl_from_IDirect3DVertexBuffer8(iface);
}
static inline IDirect3DIndexBuffer8Impl *impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface) static inline IDirect3DIndexBuffer8Impl *impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface)
{ {
return CONTAINING_RECORD(iface, IDirect3DIndexBuffer8Impl, IDirect3DIndexBuffer8_iface); return CONTAINING_RECORD(iface, IDirect3DIndexBuffer8Impl, IDirect3DIndexBuffer8_iface);
......
...@@ -277,6 +277,7 @@ struct IDirect3DVertexBuffer8Impl ...@@ -277,6 +277,7 @@ struct IDirect3DVertexBuffer8Impl
HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Impl *device, HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Impl *device,
UINT size, DWORD usage, DWORD fvf, D3DPOOL pool) DECLSPEC_HIDDEN; UINT size, DWORD usage, DWORD fvf, D3DPOOL pool) DECLSPEC_HIDDEN;
IDirect3DVertexBuffer8Impl *unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface) DECLSPEC_HIDDEN;
/* --------------------- */ /* --------------------- */
/* IDirect3DIndexBuffer8 */ /* IDirect3DIndexBuffer8 */
......
...@@ -2005,8 +2005,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_ProcessVertices(IDirect3DDevice8 *ifa ...@@ -2005,8 +2005,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_ProcessVertices(IDirect3DDevice8 *ifa
DWORD Flags) DWORD Flags)
{ {
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
IDirect3DVertexBuffer8Impl *dest = unsafe_impl_from_IDirect3DVertexBuffer8(pDestBuffer);
HRESULT hr; HRESULT hr;
IDirect3DVertexBuffer8Impl *dest = (IDirect3DVertexBuffer8Impl *) pDestBuffer;
TRACE("iface %p, src_start_idx %u, dst_idx %u, vertex_count %u, dst_buffer %p, flags %#x.\n", TRACE("iface %p, src_start_idx %u, dst_idx %u, vertex_count %u, dst_buffer %p, flags %#x.\n",
iface, SrcStartIndex, DestIndex, VertexCount, pDestBuffer, Flags); iface, SrcStartIndex, DestIndex, VertexCount, pDestBuffer, Flags);
...@@ -2683,6 +2683,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetStreamSource(IDirect3DDevice8 *ifa ...@@ -2683,6 +2683,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetStreamSource(IDirect3DDevice8 *ifa
UINT StreamNumber, IDirect3DVertexBuffer8 *pStreamData, UINT Stride) UINT StreamNumber, IDirect3DVertexBuffer8 *pStreamData, UINT Stride)
{ {
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
IDirect3DVertexBuffer8Impl *streamdata = unsafe_impl_from_IDirect3DVertexBuffer8(pStreamData);
HRESULT hr; HRESULT hr;
TRACE("iface %p, stream_idx %u, buffer %p, stride %u.\n", TRACE("iface %p, stream_idx %u, buffer %p, stride %u.\n",
...@@ -2690,8 +2691,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetStreamSource(IDirect3DDevice8 *ifa ...@@ -2690,8 +2691,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetStreamSource(IDirect3DDevice8 *ifa
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_device_set_stream_source(This->wined3d_device, StreamNumber, hr = wined3d_device_set_stream_source(This->wined3d_device, StreamNumber,
pStreamData ? ((IDirect3DVertexBuffer8Impl *)pStreamData)->wineD3DVertexBuffer : NULL, streamdata ? streamdata->wineD3DVertexBuffer : NULL, 0/* Offset in bytes */, Stride);
0/* Offset in bytes */, Stride);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; 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