d3d9: Use unsafe_impl_from_IDirect3DVertexBuffer9 for app provided ifaces.

This commit is contained in:
Michael Stefaniuc 2011-07-06 13:27:01 +02:00 committed by Alexandre Julliard
parent bb4f750592
commit 2b3a364e9a
3 changed files with 13 additions and 2 deletions

View File

@ -300,6 +300,15 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer9Impl *buffer, IDirect3DDevice9Im
return D3D_OK;
}
IDirect3DVertexBuffer9Impl *unsafe_impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == &d3d9_vertexbuffer_vtbl);
return impl_from_IDirect3DVertexBuffer9(iface);
}
static inline IDirect3DIndexBuffer9Impl *impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
{
return CONTAINING_RECORD(iface, IDirect3DIndexBuffer9Impl, IDirect3DIndexBuffer9_iface);

View File

@ -262,6 +262,7 @@ typedef struct IDirect3DVertexBuffer9Impl
HRESULT vertexbuffer_init(IDirect3DVertexBuffer9Impl *buffer, IDirect3DDevice9Impl *device,
UINT size, UINT usage, DWORD fvf, D3DPOOL pool) DECLSPEC_HIDDEN;
IDirect3DVertexBuffer9Impl *unsafe_impl_from_IDirect3DVertexBuffer9(IDirect3DVertexBuffer9 *iface) DECLSPEC_HIDDEN;
/* --------------------- */
/* IDirect3DIndexBuffer9 */

View File

@ -2049,9 +2049,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_ProcessVertices(IDirect3DDevice9Ex *i
IDirect3DVertexDeclaration9 *pVertexDecl, DWORD Flags)
{
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
IDirect3DVertexBuffer9Impl *dest = unsafe_impl_from_IDirect3DVertexBuffer9(pDestBuffer);
IDirect3DVertexDeclaration9Impl *Decl = (IDirect3DVertexDeclaration9Impl *) pVertexDecl;
HRESULT hr;
IDirect3DVertexBuffer9Impl *dest = (IDirect3DVertexBuffer9Impl *) pDestBuffer;
TRACE("iface %p, src_start_idx %u, dst_idx %u, vertex_count %u, dst_buffer %p, declaration %p, flags %#x.\n",
iface, SrcStartIndex, DestIndex, VertexCount, pDestBuffer, pVertexDecl, Flags);
@ -2446,6 +2446,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(IDirect3DDevice9Ex *i
UINT StreamNumber, IDirect3DVertexBuffer9 *pStreamData, UINT OffsetInBytes, UINT Stride)
{
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
IDirect3DVertexBuffer9Impl *streamdata = unsafe_impl_from_IDirect3DVertexBuffer9(pStreamData);
HRESULT hr;
TRACE("iface %p, stream_idx %u, buffer %p, offset %u, stride %u.\n",
@ -2453,7 +2454,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(IDirect3DDevice9Ex *i
wined3d_mutex_lock();
hr = wined3d_device_set_stream_source(This->wined3d_device, StreamNumber,
pStreamData ? ((IDirect3DVertexBuffer9Impl *)pStreamData)->wineD3DVertexBuffer : NULL,
streamdata ? streamdata->wineD3DVertexBuffer : NULL,
OffsetInBytes, Stride);
wined3d_mutex_unlock();