2006-06-09 19:36:12 +02:00
|
|
|
/* Direct3D Vertex Buffer
|
2002-11-21 22:04:16 +01:00
|
|
|
* Copyright (c) 2002 Lionel ULMER
|
2008-10-18 19:19:45 +02:00
|
|
|
* Copyright (c) 2006 Stefan DÖSINGER
|
2002-11-21 22:04:16 +01:00
|
|
|
*
|
|
|
|
* This file contains the implementation of Direct3DVertexBuffer COM object
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-11-21 22:04:16 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
2006-06-09 19:36:12 +02:00
|
|
|
#include "wine/port.h"
|
2002-11-21 22:04:16 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
#include "ddraw_private.h"
|
|
|
|
|
2010-08-19 18:57:50 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
2011-06-15 12:46:31 +02:00
|
|
|
static inline IDirect3DVertexBufferImpl *impl_from_IDirect3DVertexBuffer(IDirect3DVertexBuffer *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, IDirect3DVertexBufferImpl, IDirect3DVertexBuffer_iface);
|
|
|
|
}
|
|
|
|
|
2011-06-15 12:48:18 +02:00
|
|
|
static inline IDirect3DVertexBufferImpl *impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7_iface);
|
|
|
|
}
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* IUnknown Methods
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirect3DVertexBuffer7::QueryInterface
|
|
|
|
*
|
|
|
|
* The QueryInterface Method for Vertex Buffers
|
|
|
|
* For a link to QueryInterface rules, see IDirectDraw7::QueryInterface
|
|
|
|
*
|
|
|
|
* Params
|
2011-07-30 12:03:08 +02:00
|
|
|
* riid: Queried Interface id
|
2006-06-09 19:36:12 +02:00
|
|
|
* obj: Address to return the interface pointer
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* S_OK on success
|
|
|
|
* E_NOINTERFACE if the interface wasn't found
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
2011-06-15 12:48:18 +02:00
|
|
|
static HRESULT WINAPI IDirect3DVertexBufferImpl_QueryInterface(IDirect3DVertexBuffer7 *iface,
|
|
|
|
REFIID riid, void **obj)
|
2002-11-21 22:04:16 +01:00
|
|
|
{
|
2011-06-15 12:48:18 +02:00
|
|
|
IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer7(iface);
|
2010-08-19 18:57:50 +02:00
|
|
|
|
|
|
|
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obj);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
|
|
|
/* By default, set the object pointer to NULL */
|
2006-06-09 19:36:12 +02:00
|
|
|
*obj = NULL;
|
|
|
|
|
|
|
|
if ( IsEqualGUID( &IID_IUnknown, riid ) )
|
|
|
|
{
|
2009-01-21 09:56:13 +01:00
|
|
|
IUnknown_AddRef(iface);
|
2006-06-09 19:36:12 +02:00
|
|
|
*obj = iface;
|
|
|
|
TRACE(" Creating IUnknown interface at %p.\n", *obj);
|
|
|
|
return S_OK;
|
2002-11-21 22:04:16 +01:00
|
|
|
}
|
2006-06-09 19:36:12 +02:00
|
|
|
if ( IsEqualGUID( &IID_IDirect3DVertexBuffer, riid ) )
|
|
|
|
{
|
2009-01-21 09:56:13 +01:00
|
|
|
IUnknown_AddRef(iface);
|
2011-06-15 12:46:31 +02:00
|
|
|
*obj = &This->IDirect3DVertexBuffer_iface;
|
2006-06-09 19:36:12 +02:00
|
|
|
TRACE(" Creating IDirect3DVertexBuffer interface %p\n", *obj);
|
|
|
|
return S_OK;
|
2002-11-21 22:04:16 +01:00
|
|
|
}
|
2006-06-09 19:36:12 +02:00
|
|
|
if ( IsEqualGUID( &IID_IDirect3DVertexBuffer7, riid ) )
|
|
|
|
{
|
2009-01-21 09:56:13 +01:00
|
|
|
IUnknown_AddRef(iface);
|
|
|
|
*obj = iface;
|
2006-06-09 19:36:12 +02:00
|
|
|
TRACE(" Creating IDirect3DVertexBuffer7 interface %p\n", *obj);
|
|
|
|
return S_OK;
|
2002-11-21 22:04:16 +01:00
|
|
|
}
|
|
|
|
FIXME("(%p): interface for IID %s NOT found!\n", This, debugstr_guid(riid));
|
2006-06-09 19:36:12 +02:00
|
|
|
return E_NOINTERFACE;
|
2002-11-21 22:04:16 +01:00
|
|
|
}
|
|
|
|
|
2011-01-21 10:40:26 +01:00
|
|
|
static HRESULT WINAPI IDirect3DVertexBufferImpl_1_QueryInterface(IDirect3DVertexBuffer *iface,
|
|
|
|
REFIID riid, void **obj)
|
2006-06-09 19:36:12 +02:00
|
|
|
{
|
2011-06-15 12:46:31 +02:00
|
|
|
IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer(iface);
|
|
|
|
|
2010-08-19 18:57:50 +02:00
|
|
|
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obj);
|
2006-06-09 19:36:12 +02:00
|
|
|
|
2011-06-15 12:48:18 +02:00
|
|
|
return IDirect3DVertexBuffer7_QueryInterface(&This->IDirect3DVertexBuffer7_iface, riid, obj);
|
2006-06-09 19:36:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirect3DVertexBuffer7::AddRef
|
|
|
|
*
|
|
|
|
* AddRef for Vertex Buffers
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* The new refcount
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
2011-06-15 12:48:18 +02:00
|
|
|
static ULONG WINAPI IDirect3DVertexBufferImpl_AddRef(IDirect3DVertexBuffer7 *iface)
|
2002-11-21 22:04:16 +01:00
|
|
|
{
|
2011-06-15 12:48:18 +02:00
|
|
|
IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer7(iface);
|
2005-01-09 18:29:21 +01:00
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
2010-08-19 18:57:50 +02:00
|
|
|
TRACE("%p increasing refcount to %u.\n", This, ref);
|
2005-01-09 18:29:21 +01:00
|
|
|
|
|
|
|
return ref;
|
2002-11-21 22:04:16 +01:00
|
|
|
}
|
|
|
|
|
2011-01-21 10:40:26 +01:00
|
|
|
static ULONG WINAPI IDirect3DVertexBufferImpl_1_AddRef(IDirect3DVertexBuffer *iface)
|
2002-11-21 22:04:16 +01:00
|
|
|
{
|
2011-06-15 12:46:31 +02:00
|
|
|
IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer(iface);
|
|
|
|
|
2010-08-19 18:57:50 +02:00
|
|
|
TRACE("iface %p.\n", iface);
|
2005-01-09 18:29:21 +01:00
|
|
|
|
2011-06-15 12:48:18 +02:00
|
|
|
return IDirect3DVertexBuffer7_AddRef(&This->IDirect3DVertexBuffer7_iface);
|
2002-11-21 22:04:16 +01:00
|
|
|
}
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirect3DVertexBuffer7::Release
|
|
|
|
*
|
|
|
|
* Release for Vertex Buffers
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* The new refcount
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
2011-06-15 12:48:18 +02:00
|
|
|
static ULONG WINAPI IDirect3DVertexBufferImpl_Release(IDirect3DVertexBuffer7 *iface)
|
2002-11-21 22:04:16 +01:00
|
|
|
{
|
2011-06-15 12:48:18 +02:00
|
|
|
IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer7(iface);
|
2006-06-09 19:36:12 +02:00
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
2003-01-03 22:07:22 +01:00
|
|
|
|
2010-08-19 18:57:50 +02:00
|
|
|
TRACE("%p decreasing refcount to %u.\n", This, ref);
|
2003-01-03 20:10:48 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
if (ref == 0)
|
|
|
|
{
|
2011-03-03 21:49:09 +01:00
|
|
|
struct wined3d_buffer *curVB = NULL;
|
2007-01-06 18:26:08 +01:00
|
|
|
UINT offset, stride;
|
|
|
|
|
2011-05-16 23:01:21 +02:00
|
|
|
/* D3D7 Vertex buffers don't stay bound in the device, they are passed
|
|
|
|
* as a parameter to drawPrimitiveVB. DrawPrimitiveVB sets them as the
|
|
|
|
* stream source in wined3d, and they should get unset there before
|
|
|
|
* they are destroyed. */
|
2011-11-13 19:52:24 +01:00
|
|
|
wined3d_mutex_lock();
|
2011-05-16 23:01:22 +02:00
|
|
|
wined3d_device_get_stream_source(This->ddraw->wined3d_device,
|
2011-05-16 23:01:21 +02:00
|
|
|
0, &curVB, &offset, &stride);
|
|
|
|
if (curVB == This->wineD3DVertexBuffer)
|
2011-05-16 23:01:22 +02:00
|
|
|
wined3d_device_set_stream_source(This->ddraw->wined3d_device, 0, NULL, 0, 0);
|
2011-03-03 21:49:09 +01:00
|
|
|
if (curVB)
|
|
|
|
wined3d_buffer_decref(curVB); /* For the GetStreamSource */
|
2007-01-06 18:26:08 +01:00
|
|
|
|
2011-02-02 20:22:50 +01:00
|
|
|
wined3d_vertex_declaration_decref(This->wineD3DVertexDeclaration);
|
2011-03-03 21:49:09 +01:00
|
|
|
wined3d_buffer_decref(This->wineD3DVertexBuffer);
|
2011-11-13 19:52:24 +01:00
|
|
|
wined3d_mutex_unlock();
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
2007-05-30 16:19:10 +02:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return ref;
|
2002-11-21 22:04:16 +01:00
|
|
|
}
|
|
|
|
|
2011-01-21 10:40:26 +01:00
|
|
|
static ULONG WINAPI IDirect3DVertexBufferImpl_1_Release(IDirect3DVertexBuffer *iface)
|
2002-11-21 22:04:16 +01:00
|
|
|
{
|
2011-06-15 12:46:31 +02:00
|
|
|
IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer(iface);
|
|
|
|
|
2010-08-19 18:57:50 +02:00
|
|
|
TRACE("iface %p.\n", iface);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
2011-06-15 12:48:18 +02:00
|
|
|
return IDirect3DVertexBuffer7_Release(&This->IDirect3DVertexBuffer7_iface);
|
2002-11-21 22:04:16 +01:00
|
|
|
}
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirect3DVertexBuffer Methods
|
|
|
|
*****************************************************************************/
|
2002-11-21 22:04:16 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirect3DVertexBuffer7::Lock
|
|
|
|
*
|
|
|
|
* Locks the vertex buffer and returns a pointer to the vertex data
|
2006-06-23 18:18:02 +02:00
|
|
|
* Locking vertex buffers is similar to locking surfaces, because Windows
|
|
|
|
* uses surfaces to store vertex data internally (According to the DX sdk)
|
2006-06-09 19:36:12 +02:00
|
|
|
*
|
|
|
|
* Params:
|
|
|
|
* Flags: Locking flags. Relevant here are DDLOCK_READONLY, DDLOCK_WRITEONLY,
|
|
|
|
* DDLOCK_DISCARDCONTENTS and DDLOCK_NOOVERWRITE.
|
|
|
|
* Data: Returns a pointer to the vertex data
|
|
|
|
* Size: Returns the size of the buffer if not NULL
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* D3D_OK on success
|
|
|
|
* DDERR_INVALIDPARAMS if Data is NULL
|
|
|
|
* D3DERR_VERTEXBUFFEROPTIMIZED if called on an optimized buffer(WineD3D)
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
2011-06-15 12:48:18 +02:00
|
|
|
static HRESULT WINAPI IDirect3DVertexBufferImpl_Lock(IDirect3DVertexBuffer7 *iface, DWORD Flags,
|
|
|
|
void **Data, DWORD *Size)
|
2002-11-21 22:04:16 +01:00
|
|
|
{
|
2011-06-15 12:48:18 +02:00
|
|
|
IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer7(iface);
|
2011-03-08 19:41:05 +01:00
|
|
|
struct wined3d_resource_desc wined3d_desc;
|
2011-03-10 19:07:10 +01:00
|
|
|
struct wined3d_resource *wined3d_resource;
|
2006-06-09 19:36:12 +02:00
|
|
|
HRESULT hr;
|
2010-01-27 23:29:34 +01:00
|
|
|
DWORD wined3d_flags = 0;
|
2010-08-19 18:57:50 +02:00
|
|
|
|
|
|
|
TRACE("iface %p, flags %#x, data %p, data_size %p.\n", iface, Flags, Data, Size);
|
2006-06-09 19:36:12 +02:00
|
|
|
|
2010-01-27 23:29:34 +01:00
|
|
|
/* Writeonly: Pointless. Event: Unsupported by native according to the sdk
|
|
|
|
* nosyslock: Not applicable
|
|
|
|
*/
|
|
|
|
if(!(Flags & DDLOCK_WAIT)) wined3d_flags |= WINED3DLOCK_DONOTWAIT;
|
|
|
|
if(Flags & DDLOCK_READONLY) wined3d_flags |= WINED3DLOCK_READONLY;
|
|
|
|
if(Flags & DDLOCK_NOOVERWRITE) wined3d_flags |= WINED3DLOCK_NOOVERWRITE;
|
|
|
|
if(Flags & DDLOCK_DISCARDCONTENTS) wined3d_flags |= WINED3DLOCK_DISCARD;
|
|
|
|
|
2011-11-13 19:52:24 +01:00
|
|
|
wined3d_mutex_lock();
|
2006-06-28 19:45:49 +02:00
|
|
|
if(Size)
|
2006-06-09 19:36:12 +02:00
|
|
|
{
|
2006-06-27 13:11:13 +02:00
|
|
|
/* Get the size, for returning it, and for locking */
|
2011-03-10 19:07:10 +01:00
|
|
|
wined3d_resource = wined3d_buffer_get_resource(This->wineD3DVertexBuffer);
|
|
|
|
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
|
2011-03-08 19:41:05 +01:00
|
|
|
*Size = wined3d_desc.size;
|
2006-06-09 19:36:12 +02:00
|
|
|
}
|
2003-01-03 20:10:48 +01:00
|
|
|
|
2011-03-03 21:49:09 +01:00
|
|
|
hr = wined3d_buffer_map(This->wineD3DVertexBuffer, 0, 0, (BYTE **)Data, wined3d_flags);
|
2011-11-13 19:52:24 +01:00
|
|
|
wined3d_mutex_unlock();
|
|
|
|
|
2007-05-30 16:19:10 +02:00
|
|
|
return hr;
|
2002-11-21 22:04:16 +01:00
|
|
|
}
|
|
|
|
|
2011-01-21 10:40:26 +01:00
|
|
|
static HRESULT WINAPI IDirect3DVertexBufferImpl_1_Lock(IDirect3DVertexBuffer *iface, DWORD Flags,
|
|
|
|
void **Data, DWORD *Size)
|
2002-11-21 22:04:16 +01:00
|
|
|
{
|
2011-06-15 12:46:31 +02:00
|
|
|
IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer(iface);
|
|
|
|
|
2010-08-19 18:57:50 +02:00
|
|
|
TRACE("iface %p, flags %#x, data %p, data_size %p.\n", iface, Flags, Data, Size);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
2011-06-15 12:48:18 +02:00
|
|
|
return IDirect3DVertexBuffer7_Lock(&This->IDirect3DVertexBuffer7_iface, Flags, Data, Size);
|
2002-11-21 22:04:16 +01:00
|
|
|
}
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirect3DVertexBuffer7::Unlock
|
|
|
|
*
|
|
|
|
* Unlocks a vertex Buffer
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* D3D_OK on success
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
2011-06-15 12:48:18 +02:00
|
|
|
static HRESULT WINAPI IDirect3DVertexBufferImpl_Unlock(IDirect3DVertexBuffer7 *iface)
|
2002-11-21 22:04:16 +01:00
|
|
|
{
|
2011-06-15 12:48:18 +02:00
|
|
|
IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer7(iface);
|
2010-08-19 18:57:50 +02:00
|
|
|
|
|
|
|
TRACE("iface %p.\n", iface);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
2011-11-13 19:52:24 +01:00
|
|
|
wined3d_mutex_lock();
|
2011-03-03 21:49:09 +01:00
|
|
|
wined3d_buffer_unmap(This->wineD3DVertexBuffer);
|
2011-11-13 19:52:24 +01:00
|
|
|
wined3d_mutex_unlock();
|
2007-05-30 16:19:10 +02:00
|
|
|
|
2010-10-15 14:35:12 +02:00
|
|
|
return D3D_OK;
|
2002-11-21 22:04:16 +01:00
|
|
|
}
|
|
|
|
|
2011-01-21 10:40:26 +01:00
|
|
|
static HRESULT WINAPI IDirect3DVertexBufferImpl_1_Unlock(IDirect3DVertexBuffer *iface)
|
2002-11-21 22:04:16 +01:00
|
|
|
{
|
2011-06-15 12:46:31 +02:00
|
|
|
IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer(iface);
|
|
|
|
|
2010-08-19 18:57:50 +02:00
|
|
|
TRACE("iface %p.\n", iface);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
2011-06-15 12:48:18 +02:00
|
|
|
return IDirect3DVertexBuffer7_Unlock(&This->IDirect3DVertexBuffer7_iface);
|
2002-11-21 22:04:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirect3DVertexBuffer7::ProcessVertices
|
|
|
|
*
|
|
|
|
* Processes untransformed Vertices into a transformed or optimized vertex
|
|
|
|
* buffer. It can also perform other operations, such as lighting or clipping
|
|
|
|
*
|
|
|
|
* Params
|
|
|
|
* VertexOp: Operation(s) to perform: D3DVOP_CLIP, _EXTENTS, _LIGHT, _TRANSFORM
|
|
|
|
* DestIndex: Index in the destination buffer(This), where the vertices are
|
|
|
|
* placed
|
|
|
|
* Count: Number of Vertices in the Source buffer to process
|
|
|
|
* SrcBuffer: Source vertex buffer
|
|
|
|
* SrcIndex: Index of the first vertex in the src buffer to process
|
|
|
|
* D3DDevice: Device to use for transformation
|
|
|
|
* Flags: 0 for default, D3DPV_DONOTCOPYDATA to prevent copying
|
|
|
|
* unchaned vertices
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* D3D_OK on success
|
|
|
|
* DDERR_INVALIDPARAMS If D3DVOP_TRANSFORM wasn't passed
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
2011-06-15 12:40:44 +02:00
|
|
|
static HRESULT WINAPI IDirect3DVertexBufferImpl_ProcessVertices(IDirect3DVertexBuffer7 *iface,
|
|
|
|
DWORD VertexOp, DWORD DestIndex, DWORD Count, IDirect3DVertexBuffer7 *SrcBuffer,
|
2011-10-17 15:58:25 +02:00
|
|
|
DWORD SrcIndex, IDirect3DDevice7 *device, DWORD Flags)
|
2002-11-21 22:04:16 +01:00
|
|
|
{
|
2011-06-15 12:48:18 +02:00
|
|
|
IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer7(iface);
|
2011-06-15 12:40:44 +02:00
|
|
|
IDirect3DVertexBufferImpl *Src = unsafe_impl_from_IDirect3DVertexBuffer7(SrcBuffer);
|
2011-10-17 15:58:25 +02:00
|
|
|
IDirect3DDeviceImpl *device_impl = unsafe_impl_from_IDirect3DDevice7(device);
|
2006-06-09 19:36:12 +02:00
|
|
|
BOOL oldClip, doClip;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2010-08-19 18:57:50 +02:00
|
|
|
TRACE("iface %p, vertex_op %#x, dst_idx %u, count %u, src_buffer %p, src_idx %u, device %p, flags %#x.\n",
|
2011-10-17 15:58:25 +02:00
|
|
|
iface, VertexOp, DestIndex, Count, SrcBuffer, SrcIndex, device, Flags);
|
2006-06-09 19:36:12 +02:00
|
|
|
|
|
|
|
/* Vertex operations:
|
|
|
|
* D3DVOP_CLIP: Clips vertices outside the viewing frustrum. Needs clipping information
|
|
|
|
* in the vertex buffer (Buffer may not be created with D3DVBCAPS_DONOTCLIP)
|
|
|
|
* D3DVOP_EXTENTS: Causes the screen extents to be updated when rendering the vertices
|
|
|
|
* D3DVOP_LIGHT: Lights the vertices
|
|
|
|
* D3DVOP_TRANSFORM: Transform the vertices. This flag is necessary
|
|
|
|
*
|
|
|
|
* WineD3D only transforms and clips the vertices by now, so EXTENTS and LIGHT
|
|
|
|
* are not implemented. Clipping is disabled ATM, because of unsure conditions.
|
|
|
|
*/
|
|
|
|
if( !(VertexOp & D3DVOP_TRANSFORM) ) return DDERR_INVALIDPARAMS;
|
|
|
|
|
2011-11-13 19:52:24 +01:00
|
|
|
wined3d_mutex_lock();
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* WineD3D doesn't know d3d7 vertex operation, it uses
|
|
|
|
* render states instead. Set the render states according to
|
|
|
|
* the vertex ops
|
|
|
|
*/
|
|
|
|
doClip = VertexOp & D3DVOP_CLIP ? TRUE : FALSE;
|
2011-12-19 21:00:09 +01:00
|
|
|
wined3d_device_get_render_state(device_impl->wined3d_device, WINED3D_RS_CLIPPING, (DWORD *)&oldClip);
|
2011-05-16 23:01:21 +02:00
|
|
|
if (doClip != oldClip)
|
2011-12-19 21:00:09 +01:00
|
|
|
wined3d_device_set_render_state(device_impl->wined3d_device, WINED3D_RS_CLIPPING, doClip);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
2011-10-17 15:58:25 +02:00
|
|
|
wined3d_device_set_stream_source(device_impl->wined3d_device,
|
2011-05-16 23:01:21 +02:00
|
|
|
0, Src->wineD3DVertexBuffer, 0, get_flexible_vertex_size(Src->fvf));
|
2011-10-17 15:58:25 +02:00
|
|
|
wined3d_device_set_vertex_declaration(device_impl->wined3d_device, Src->wineD3DVertexDeclaration);
|
|
|
|
hr = wined3d_device_process_vertices(device_impl->wined3d_device, SrcIndex, DestIndex,
|
2011-05-16 23:01:22 +02:00
|
|
|
Count, This->wineD3DVertexBuffer, NULL, Flags, This->fvf);
|
2006-06-09 19:36:12 +02:00
|
|
|
|
|
|
|
/* Restore the states if needed */
|
2011-05-16 23:01:21 +02:00
|
|
|
if (doClip != oldClip)
|
2011-12-19 21:00:09 +01:00
|
|
|
wined3d_device_set_render_state(device_impl->wined3d_device, WINED3D_RS_CLIPPING, oldClip);
|
2011-11-13 19:52:24 +01:00
|
|
|
|
|
|
|
wined3d_mutex_unlock();
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
return hr;
|
2002-11-21 22:04:16 +01:00
|
|
|
}
|
|
|
|
|
2011-01-21 10:40:26 +01:00
|
|
|
static HRESULT WINAPI IDirect3DVertexBufferImpl_1_ProcessVertices(IDirect3DVertexBuffer *iface,
|
|
|
|
DWORD VertexOp, DWORD DestIndex, DWORD Count, IDirect3DVertexBuffer *SrcBuffer,
|
2011-10-17 15:57:53 +02:00
|
|
|
DWORD SrcIndex, IDirect3DDevice3 *device, DWORD Flags)
|
2003-01-03 22:07:22 +01:00
|
|
|
{
|
2011-06-15 12:46:31 +02:00
|
|
|
IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer(iface);
|
2011-06-15 12:40:44 +02:00
|
|
|
IDirect3DVertexBufferImpl *Src = unsafe_impl_from_IDirect3DVertexBuffer(SrcBuffer);
|
2011-10-17 15:57:53 +02:00
|
|
|
IDirect3DDeviceImpl *device_impl = unsafe_impl_from_IDirect3DDevice3(device);
|
2006-06-09 19:36:12 +02:00
|
|
|
|
2010-08-19 18:57:50 +02:00
|
|
|
TRACE("iface %p, vertex_op %#x, dst_idx %u, count %u, src_buffer %p, src_idx %u, device %p, flags %#x.\n",
|
2011-10-17 15:57:53 +02:00
|
|
|
iface, VertexOp, DestIndex, Count, SrcBuffer, SrcIndex, device, Flags);
|
2006-06-09 19:36:12 +02:00
|
|
|
|
2011-06-15 12:48:18 +02:00
|
|
|
return IDirect3DVertexBuffer7_ProcessVertices(&This->IDirect3DVertexBuffer7_iface, VertexOp,
|
2011-10-17 15:58:51 +02:00
|
|
|
DestIndex, Count, &Src->IDirect3DVertexBuffer7_iface, SrcIndex,
|
|
|
|
device_impl ? &device_impl->IDirect3DDevice7_iface : NULL, Flags);
|
2003-01-03 22:07:22 +01:00
|
|
|
}
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirect3DVertexBuffer7::GetVertexBufferDesc
|
|
|
|
*
|
|
|
|
* Returns the description of a vertex buffer
|
|
|
|
*
|
|
|
|
* Params:
|
|
|
|
* Desc: Address to write the description to
|
|
|
|
*
|
|
|
|
* Returns
|
|
|
|
* DDERR_INVALIDPARAMS if Desc is NULL
|
|
|
|
* D3D_OK on success
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
2011-06-15 12:48:18 +02:00
|
|
|
static HRESULT WINAPI IDirect3DVertexBufferImpl_GetVertexBufferDesc(IDirect3DVertexBuffer7 *iface,
|
|
|
|
D3DVERTEXBUFFERDESC *Desc)
|
2003-01-03 22:07:22 +01:00
|
|
|
{
|
2011-06-15 12:48:18 +02:00
|
|
|
IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer7(iface);
|
2011-03-08 19:41:05 +01:00
|
|
|
struct wined3d_resource_desc wined3d_desc;
|
2011-03-10 19:07:10 +01:00
|
|
|
struct wined3d_resource *wined3d_resource;
|
2010-08-19 18:57:50 +02:00
|
|
|
|
|
|
|
TRACE("iface %p, desc %p.\n", iface, Desc);
|
2003-01-03 22:07:22 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
if(!Desc) return DDERR_INVALIDPARAMS;
|
2003-01-03 22:07:22 +01:00
|
|
|
|
2011-11-13 19:52:24 +01:00
|
|
|
wined3d_mutex_lock();
|
2011-03-10 19:07:10 +01:00
|
|
|
wined3d_resource = wined3d_buffer_get_resource(This->wineD3DVertexBuffer);
|
|
|
|
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
|
2011-11-13 19:52:24 +01:00
|
|
|
wined3d_mutex_unlock();
|
2003-01-03 22:07:22 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* Now fill the Desc structure */
|
|
|
|
Desc->dwCaps = This->Caps;
|
2009-04-06 14:09:54 +02:00
|
|
|
Desc->dwFVF = This->fvf;
|
2011-03-08 19:41:05 +01:00
|
|
|
Desc->dwNumVertices = wined3d_desc.size / get_flexible_vertex_size(This->fvf);
|
2003-01-03 22:07:22 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
return D3D_OK;
|
2003-01-03 22:07:22 +01:00
|
|
|
}
|
|
|
|
|
2011-01-21 10:40:26 +01:00
|
|
|
static HRESULT WINAPI IDirect3DVertexBufferImpl_1_GetVertexBufferDesc(IDirect3DVertexBuffer *iface,
|
|
|
|
D3DVERTEXBUFFERDESC *Desc)
|
2003-01-03 22:07:22 +01:00
|
|
|
{
|
2011-06-15 12:46:31 +02:00
|
|
|
IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer(iface);
|
|
|
|
|
2010-08-19 18:57:50 +02:00
|
|
|
TRACE("iface %p, desc %p.\n", iface, Desc);
|
2003-01-03 22:07:22 +01:00
|
|
|
|
2011-06-15 12:48:18 +02:00
|
|
|
return IDirect3DVertexBuffer7_GetVertexBufferDesc(&This->IDirect3DVertexBuffer7_iface, Desc);
|
2003-01-03 22:07:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirect3DVertexBuffer7::Optimize
|
|
|
|
*
|
|
|
|
* Converts an unoptimized vertex buffer into an optimized buffer
|
|
|
|
*
|
|
|
|
* Params:
|
|
|
|
* D3DDevice: Device for which this buffer is optimized
|
|
|
|
* Flags: Not used, should be set to 0
|
|
|
|
*
|
|
|
|
* Returns
|
|
|
|
* D3D_OK, because it's a stub
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
2011-06-15 12:48:18 +02:00
|
|
|
static HRESULT WINAPI IDirect3DVertexBufferImpl_Optimize(IDirect3DVertexBuffer7 *iface,
|
|
|
|
IDirect3DDevice7 *D3DDevice, DWORD Flags)
|
2006-06-09 19:36:12 +02:00
|
|
|
{
|
2011-06-15 12:48:18 +02:00
|
|
|
IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer7(iface);
|
2008-12-24 11:22:29 +01:00
|
|
|
static BOOL hide = FALSE;
|
|
|
|
|
2010-08-19 18:57:50 +02:00
|
|
|
TRACE("iface %p, device %p, flags %#x.\n", iface, D3DDevice, Flags);
|
|
|
|
|
2008-12-24 11:22:29 +01:00
|
|
|
if (!hide)
|
|
|
|
{
|
2010-08-19 18:57:50 +02:00
|
|
|
FIXME("iface %p, device %p, flags %#x stub!\n", iface, D3DDevice, Flags);
|
2008-12-24 11:22:29 +01:00
|
|
|
hide = TRUE;
|
|
|
|
}
|
2003-01-03 22:07:22 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/* We could forward this call to WineD3D and take advantage
|
|
|
|
* of it once we use OpenGL vertex buffers
|
|
|
|
*/
|
2011-11-13 19:52:24 +01:00
|
|
|
wined3d_mutex_lock();
|
2006-06-09 19:36:12 +02:00
|
|
|
This->Caps |= D3DVBCAPS_OPTIMIZED;
|
2011-11-13 19:52:24 +01:00
|
|
|
wined3d_mutex_unlock();
|
2002-11-21 22:04:16 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
return DD_OK;
|
|
|
|
}
|
|
|
|
|
2011-01-21 10:40:26 +01:00
|
|
|
static HRESULT WINAPI IDirect3DVertexBufferImpl_1_Optimize(IDirect3DVertexBuffer *iface,
|
2011-10-17 15:57:53 +02:00
|
|
|
IDirect3DDevice3 *device, DWORD Flags)
|
2002-11-21 22:04:16 +01:00
|
|
|
{
|
2011-06-15 12:46:31 +02:00
|
|
|
IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer(iface);
|
2011-10-17 15:57:53 +02:00
|
|
|
IDirect3DDeviceImpl *device_impl = unsafe_impl_from_IDirect3DDevice3(device);
|
2002-11-21 22:04:16 +01:00
|
|
|
|
2011-10-17 15:57:53 +02:00
|
|
|
TRACE("iface %p, device %p, flags %#x.\n", iface, device, Flags);
|
2010-08-19 18:57:50 +02:00
|
|
|
|
2011-06-15 12:48:18 +02:00
|
|
|
return IDirect3DVertexBuffer7_Optimize(&This->IDirect3DVertexBuffer7_iface,
|
2011-10-17 15:58:51 +02:00
|
|
|
device_impl ? &device_impl->IDirect3DDevice7_iface : NULL, Flags);
|
2006-06-09 19:36:12 +02:00
|
|
|
}
|
2002-11-21 22:04:16 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirect3DVertexBuffer7::ProcessVerticesStrided
|
|
|
|
*
|
|
|
|
* This method processes untransformed strided vertices into a processed
|
|
|
|
* or optimized vertex buffer.
|
|
|
|
*
|
|
|
|
* For more details on the parameters, see
|
|
|
|
* IDirect3DVertexBuffer7::ProcessVertices
|
|
|
|
*
|
|
|
|
* Params:
|
|
|
|
* VertexOp: Operations to perform
|
|
|
|
* DestIndex: Destination index to write the vertices to
|
|
|
|
* Count: Number of input vertices
|
|
|
|
* StrideData: Array containing the input vertices
|
|
|
|
* VertexTypeDesc: Vertex Description or source index?????????
|
|
|
|
* D3DDevice: IDirect3DDevice7 to use for processing
|
|
|
|
* Flags: Can be D3DPV_DONOTCOPYDATA to avoid copying unmodified vertices
|
|
|
|
*
|
|
|
|
* Returns
|
|
|
|
* D3D_OK on success, or DDERR_*
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
static HRESULT WINAPI
|
|
|
|
IDirect3DVertexBufferImpl_ProcessVerticesStrided(IDirect3DVertexBuffer7 *iface,
|
|
|
|
DWORD VertexOp,
|
|
|
|
DWORD DestIndex,
|
|
|
|
DWORD Count,
|
|
|
|
D3DDRAWPRIMITIVESTRIDEDDATA *StrideData,
|
|
|
|
DWORD VertexTypeDesc,
|
|
|
|
IDirect3DDevice7 *D3DDevice,
|
|
|
|
DWORD Flags)
|
|
|
|
{
|
2010-08-19 18:57:50 +02:00
|
|
|
FIXME("iface %p, vertex_op %#x, dst_idx %u, count %u, data %p, vertex_type %#x, device %p, flags %#x stub!\n",
|
|
|
|
iface, VertexOp, DestIndex, Count, StrideData, VertexTypeDesc, D3DDevice, Flags);
|
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
return DD_OK;
|
|
|
|
}
|
2002-11-21 22:04:16 +01:00
|
|
|
|
2006-06-09 19:36:12 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* The VTables
|
|
|
|
*****************************************************************************/
|
2002-11-21 22:04:16 +01:00
|
|
|
|
2010-08-19 18:57:47 +02:00
|
|
|
static const struct IDirect3DVertexBuffer7Vtbl d3d_vertex_buffer7_vtbl =
|
2002-11-21 22:04:16 +01:00
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
/*** IUnknown Methods ***/
|
|
|
|
IDirect3DVertexBufferImpl_QueryInterface,
|
|
|
|
IDirect3DVertexBufferImpl_AddRef,
|
|
|
|
IDirect3DVertexBufferImpl_Release,
|
|
|
|
/*** IDirect3DVertexBuffer Methods ***/
|
|
|
|
IDirect3DVertexBufferImpl_Lock,
|
|
|
|
IDirect3DVertexBufferImpl_Unlock,
|
|
|
|
IDirect3DVertexBufferImpl_ProcessVertices,
|
|
|
|
IDirect3DVertexBufferImpl_GetVertexBufferDesc,
|
|
|
|
IDirect3DVertexBufferImpl_Optimize,
|
|
|
|
/*** IDirect3DVertexBuffer7 Methods ***/
|
|
|
|
IDirect3DVertexBufferImpl_ProcessVerticesStrided
|
2002-11-21 22:04:16 +01:00
|
|
|
};
|
|
|
|
|
2010-08-19 18:57:47 +02:00
|
|
|
static const struct IDirect3DVertexBufferVtbl d3d_vertex_buffer1_vtbl =
|
2002-11-21 22:04:16 +01:00
|
|
|
{
|
2006-06-09 19:36:12 +02:00
|
|
|
/*** IUnknown Methods ***/
|
2011-01-21 10:40:26 +01:00
|
|
|
IDirect3DVertexBufferImpl_1_QueryInterface,
|
|
|
|
IDirect3DVertexBufferImpl_1_AddRef,
|
|
|
|
IDirect3DVertexBufferImpl_1_Release,
|
2006-06-09 19:36:12 +02:00
|
|
|
/*** IDirect3DVertexBuffer Methods ***/
|
2011-01-21 10:40:26 +01:00
|
|
|
IDirect3DVertexBufferImpl_1_Lock,
|
|
|
|
IDirect3DVertexBufferImpl_1_Unlock,
|
|
|
|
IDirect3DVertexBufferImpl_1_ProcessVertices,
|
|
|
|
IDirect3DVertexBufferImpl_1_GetVertexBufferDesc,
|
|
|
|
IDirect3DVertexBufferImpl_1_Optimize
|
2006-06-09 19:36:12 +02:00
|
|
|
};
|
2010-08-19 18:57:47 +02:00
|
|
|
|
2011-06-15 12:36:49 +02:00
|
|
|
HRESULT d3d_vertex_buffer_create(IDirect3DVertexBufferImpl **vertex_buf, IDirectDrawImpl *ddraw,
|
|
|
|
D3DVERTEXBUFFERDESC *desc)
|
2010-08-19 18:57:47 +02:00
|
|
|
{
|
2011-06-15 12:36:49 +02:00
|
|
|
IDirect3DVertexBufferImpl *buffer;
|
2010-08-19 18:57:47 +02:00
|
|
|
DWORD usage;
|
2011-06-15 12:36:49 +02:00
|
|
|
HRESULT hr = D3D_OK;
|
|
|
|
|
|
|
|
TRACE("Vertex buffer description:\n");
|
|
|
|
TRACE(" dwSize %u\n", desc->dwSize);
|
|
|
|
TRACE(" dwCaps %#x\n", desc->dwCaps);
|
|
|
|
TRACE(" FVF %#x\n", desc->dwFVF);
|
|
|
|
TRACE(" dwNumVertices %u\n", desc->dwNumVertices);
|
|
|
|
|
|
|
|
buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*buffer));
|
|
|
|
if (!buffer)
|
|
|
|
return DDERR_OUTOFMEMORY;
|
2010-08-19 18:57:47 +02:00
|
|
|
|
2011-06-15 12:48:18 +02:00
|
|
|
buffer->IDirect3DVertexBuffer7_iface.lpVtbl = &d3d_vertex_buffer7_vtbl;
|
2011-06-15 12:46:31 +02:00
|
|
|
buffer->IDirect3DVertexBuffer_iface.lpVtbl = &d3d_vertex_buffer1_vtbl;
|
2010-08-19 18:57:47 +02:00
|
|
|
buffer->ref = 1;
|
|
|
|
|
|
|
|
buffer->ddraw = ddraw;
|
|
|
|
buffer->Caps = desc->dwCaps;
|
|
|
|
buffer->fvf = desc->dwFVF;
|
|
|
|
|
|
|
|
usage = desc->dwCaps & D3DVBCAPS_WRITEONLY ? WINED3DUSAGE_WRITEONLY : 0;
|
|
|
|
usage |= WINED3DUSAGE_STATICDECL;
|
|
|
|
|
2011-11-13 19:52:24 +01:00
|
|
|
wined3d_mutex_lock();
|
2010-08-19 18:57:47 +02:00
|
|
|
|
2011-05-16 23:01:22 +02:00
|
|
|
hr = wined3d_buffer_create_vb(ddraw->wined3d_device,
|
2010-08-19 18:57:47 +02:00
|
|
|
get_flexible_vertex_size(desc->dwFVF) * desc->dwNumVertices,
|
|
|
|
usage, desc->dwCaps & D3DVBCAPS_SYSTEMMEMORY ? WINED3DPOOL_SYSTEMMEM : WINED3DPOOL_DEFAULT,
|
2010-08-31 18:41:40 +02:00
|
|
|
buffer, &ddraw_null_wined3d_parent_ops, &buffer->wineD3DVertexBuffer);
|
2010-08-19 18:57:47 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
WARN("Failed to create wined3d vertex buffer, hr %#x.\n", hr);
|
|
|
|
if (hr == WINED3DERR_INVALIDCALL)
|
2011-06-15 12:36:49 +02:00
|
|
|
hr = DDERR_INVALIDPARAMS;
|
|
|
|
goto end;
|
2010-08-19 18:57:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
buffer->wineD3DVertexDeclaration = ddraw_find_decl(ddraw, desc->dwFVF);
|
|
|
|
if (!buffer->wineD3DVertexDeclaration)
|
|
|
|
{
|
|
|
|
ERR("Failed to find vertex declaration for fvf %#x.\n", desc->dwFVF);
|
2011-03-03 21:49:09 +01:00
|
|
|
wined3d_buffer_decref(buffer->wineD3DVertexBuffer);
|
2011-06-15 12:36:49 +02:00
|
|
|
hr = DDERR_INVALIDPARAMS;
|
|
|
|
goto end;
|
2010-08-19 18:57:47 +02:00
|
|
|
}
|
2011-02-02 20:22:50 +01:00
|
|
|
wined3d_vertex_declaration_incref(buffer->wineD3DVertexDeclaration);
|
2010-08-19 18:57:47 +02:00
|
|
|
|
2011-06-15 12:36:49 +02:00
|
|
|
end:
|
2011-11-13 19:52:24 +01:00
|
|
|
wined3d_mutex_unlock();
|
2011-06-15 12:36:49 +02:00
|
|
|
if (hr == D3D_OK)
|
|
|
|
*vertex_buf = buffer;
|
|
|
|
else
|
|
|
|
HeapFree(GetProcessHeap(), 0, buffer);
|
2010-08-19 18:57:47 +02:00
|
|
|
|
2011-06-15 12:36:49 +02:00
|
|
|
return hr;
|
2010-08-19 18:57:47 +02:00
|
|
|
}
|
2011-06-15 12:40:44 +02:00
|
|
|
|
|
|
|
IDirect3DVertexBufferImpl *unsafe_impl_from_IDirect3DVertexBuffer(IDirect3DVertexBuffer *iface)
|
|
|
|
{
|
|
|
|
if (!iface)
|
|
|
|
return NULL;
|
|
|
|
assert(iface->lpVtbl == &d3d_vertex_buffer1_vtbl);
|
|
|
|
|
2011-06-15 12:46:31 +02:00
|
|
|
return impl_from_IDirect3DVertexBuffer(iface);
|
2011-06-15 12:40:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
IDirect3DVertexBufferImpl *unsafe_impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
|
|
|
|
{
|
|
|
|
if (!iface)
|
|
|
|
return NULL;
|
|
|
|
assert(iface->lpVtbl == &d3d_vertex_buffer7_vtbl);
|
|
|
|
|
2011-06-15 12:48:18 +02:00
|
|
|
return impl_from_IDirect3DVertexBuffer7(iface);
|
2011-06-15 12:40:44 +02:00
|
|
|
}
|