- Add support (as far as was previously) for the VertexBuffer and

Resource classes in wined3d and use when called from d3d9.
- Reduce the header includes in all the d3d9 interface to one common
  set in the private header.
oldstable
Jason Edmeades 2004-10-14 00:32:04 +00:00 committed by Alexandre Julliard
parent 4bf9d98c68
commit db7a50582c
25 changed files with 447 additions and 274 deletions

View File

@ -20,17 +20,6 @@
*/
#include "config.h"
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);

View File

@ -20,17 +20,6 @@
*/
#include "config.h"
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);

View File

@ -31,11 +31,13 @@
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#define XMD_H
#include <GL/gl.h>
@ -537,8 +539,8 @@ struct IDirect3DResource9Impl
DWORD ref;
/* IDirect3DResource9 fields */
IDirect3DDevice9Impl *Device;
D3DRESOURCETYPE ResourceType;
IWineD3DResource *wineD3DResource;
IDirect3DDevice9 *device;
};
/* IUnknown: */
@ -636,12 +638,8 @@ struct IDirect3DVertexBuffer9Impl
DWORD ref;
/* IDirect3DResource9 fields */
IDirect3DDevice9Impl *Device;
D3DRESOURCETYPE ResourceType;
/* IDirect3DVertexBuffer9 fields */
BYTE *allocatedMemory;
D3DVERTEXBUFFER_DESC myDesc;
IWineD3DVertexBuffer *wineD3DVertexBuffer;
IDirect3DDevice9Impl *device;
};
/* IUnknown: */

View File

@ -20,18 +20,6 @@
*/
#include "config.h"
#include <math.h>
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
/** currently desactiving 1_4 support as mesa doesn't implement all 1_4 support while defining it */

View File

@ -19,18 +19,6 @@
*/
#include "config.h"
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);

View File

@ -20,17 +20,6 @@
*/
#include "config.h"
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);

View File

@ -20,17 +20,6 @@
*/
#include "config.h"
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);

View File

@ -20,18 +20,6 @@
*/
#include "config.h"
#include <math.h>
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);

View File

@ -1,7 +1,7 @@
/*
* IDirect3DResource9 implementation
*
* Copyright 2002-2003 Jason Edmeades
* Copyright 2002-2004 Jason Edmeades
* Raphael Junqueira
*
* This library is free software; you can redistribute it and/or
@ -20,17 +20,6 @@
*/
#include "config.h"
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
@ -53,14 +42,15 @@ HRESULT WINAPI IDirect3DResource9Impl_QueryInterface(LPDIRECT3DRESOURCE9 iface,
ULONG WINAPI IDirect3DResource9Impl_AddRef(LPDIRECT3DRESOURCE9 iface) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
TRACE("(%p) : AddRef from %ld\n", This, This->ref);
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
ULONG WINAPI IDirect3DResource9Impl_Release(LPDIRECT3DRESOURCE9 iface) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
ULONG ref = --This->ref;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
IWineD3DResource_Release(This->wineD3DResource);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
@ -69,51 +59,46 @@ ULONG WINAPI IDirect3DResource9Impl_Release(LPDIRECT3DRESOURCE9 iface) {
/* IDirect3DResource9 Interface follow: */
HRESULT WINAPI IDirect3DResource9Impl_GetDevice(LPDIRECT3DRESOURCE9 iface, IDirect3DDevice9** ppDevice) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
TRACE("(%p) : returning %p\n", This, This->Device);
*ppDevice = (LPDIRECT3DDEVICE9) This->Device;
TRACE("(%p) : returning %p\n", This, This->device);
*ppDevice = (LPDIRECT3DDEVICE9) This->device;
IDirect3DDevice9Impl_AddRef(*ppDevice);
return D3D_OK;
}
HRESULT WINAPI IDirect3DResource9Impl_SetPrivateData(LPDIRECT3DRESOURCE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
return IWineD3DResource_SetPrivateData(This->wineD3DResource, refguid, pData, SizeOfData, Flags);
}
HRESULT WINAPI IDirect3DResource9Impl_GetPrivateData(LPDIRECT3DRESOURCE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
return IWineD3DResource_GetPrivateData(This->wineD3DResource, refguid, pData, pSizeOfData);
}
HRESULT WINAPI IDirect3DResource9Impl_FreePrivateData(LPDIRECT3DRESOURCE9 iface, REFGUID refguid) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
return IWineD3DResource_FreePrivateData(This->wineD3DResource, refguid);
}
DWORD WINAPI IDirect3DResource9Impl_SetPriority(LPDIRECT3DRESOURCE9 iface, DWORD PriorityNew) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
FIXME("(%p) : stub\n", This);
return 0;
return IWineD3DResource_SetPriority(This->wineD3DResource, PriorityNew);
}
DWORD WINAPI IDirect3DResource9Impl_GetPriority(LPDIRECT3DRESOURCE9 iface) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
FIXME("(%p) : stub\n", This);
return 0;
return IWineD3DResource_GetPriority(This->wineD3DResource);
}
void WINAPI IDirect3DResource9Impl_PreLoad(LPDIRECT3DRESOURCE9 iface) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
FIXME("(%p) : stub\n", This);
IWineD3DResource_PreLoad(This->wineD3DResource);
return;
}
D3DRESOURCETYPE WINAPI IDirect3DResource9Impl_GetType(LPDIRECT3DRESOURCE9 iface) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
TRACE("(%p) : returning %d\n", This, This->ResourceType);
return This->ResourceType;
return IWineD3DResource_GetType(This->wineD3DResource);
}

View File

@ -20,18 +20,6 @@
*/
#include "config.h"
#include <math.h>
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);

View File

@ -20,20 +20,6 @@
*/
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);

View File

@ -20,17 +20,6 @@
*/
#include "config.h"
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);

View File

@ -20,17 +20,6 @@
*/
#include "config.h"
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);

View File

@ -1,7 +1,7 @@
/*
* IDirect3DResource9 implementation
* IDirect3DVertexBuffer9 implementation
*
* Copyright 2002-2003 Jason Edmeades
* Copyright 2002-2004 Jason Edmeades
* Raphael Junqueira
*
* This library is free software; you can redistribute it and/or
@ -20,17 +20,6 @@
*/
#include "config.h"
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
@ -54,15 +43,15 @@ HRESULT WINAPI IDirect3DVertexBuffer9Impl_QueryInterface(LPDIRECT3DVERTEXBUFFER9
ULONG WINAPI IDirect3DVertexBuffer9Impl_AddRef(LPDIRECT3DVERTEXBUFFER9 iface) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
TRACE("(%p) : AddRef from %ld\n", This, This->ref);
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
ULONG WINAPI IDirect3DVertexBuffer9Impl_Release(LPDIRECT3DVERTEXBUFFER9 iface) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
ULONG ref = --This->ref;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
if (NULL != This->allocatedMemory) HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
@ -76,64 +65,56 @@ HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetDevice(LPDIRECT3DVERTEXBUFFER9 ifac
HRESULT WINAPI IDirect3DVertexBuffer9Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
return IWineD3DVertexBuffer_SetPrivateData(This->wineD3DVertexBuffer, refguid, pData, SizeOfData, Flags);
}
HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
return IWineD3DVertexBuffer_GetPrivateData(This->wineD3DVertexBuffer, refguid, pData, pSizeOfData);
}
HRESULT WINAPI IDirect3DVertexBuffer9Impl_FreePrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
return IWineD3DVertexBuffer_FreePrivateData(This->wineD3DVertexBuffer, refguid);
}
DWORD WINAPI IDirect3DVertexBuffer9Impl_SetPriority(LPDIRECT3DVERTEXBUFFER9 iface, DWORD PriorityNew) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9) This, PriorityNew);
return IWineD3DVertexBuffer_SetPriority(This->wineD3DVertexBuffer, PriorityNew);
}
DWORD WINAPI IDirect3DVertexBuffer9Impl_GetPriority(LPDIRECT3DVERTEXBUFFER9 iface) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9) This);
return IWineD3DVertexBuffer_GetPriority(This->wineD3DVertexBuffer);
}
void WINAPI IDirect3DVertexBuffer9Impl_PreLoad(LPDIRECT3DVERTEXBUFFER9 iface) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This);
IWineD3DVertexBuffer_PreLoad(This->wineD3DVertexBuffer);
return ;
}
D3DRESOURCETYPE WINAPI IDirect3DVertexBuffer9Impl_GetType(LPDIRECT3DVERTEXBUFFER9 iface) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9) This);
return IWineD3DVertexBuffer_GetType(This->wineD3DVertexBuffer);
}
/* IDirect3DVertexBuffer9 Interface follow: */
HRESULT WINAPI IDirect3DVertexBuffer9Impl_Lock(LPDIRECT3DVERTEXBUFFER9 iface, UINT OffsetToLock, UINT SizeToLock, void** ppbData, DWORD Flags) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
return IWineD3DVertexBuffer_Lock(This->wineD3DVertexBuffer, OffsetToLock, SizeToLock, (BYTE **)ppbData, Flags);
}
HRESULT WINAPI IDirect3DVertexBuffer9Impl_Unlock(LPDIRECT3DVERTEXBUFFER9 iface) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
return IWineD3DVertexBuffer_Unlock(This->wineD3DVertexBuffer);
}
HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetDesc(LPDIRECT3DVERTEXBUFFER9 iface, D3DVERTEXBUFFER_DESC* pDesc) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
TRACE("(%p) : copying into %p\n", This, pDesc);
memcpy(pDesc, &This->myDesc, sizeof(D3DVERTEXBUFFER_DESC));
return D3D_OK;
return IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer, pDesc);
}
IDirect3DVertexBuffer9Vtbl Direct3DVertexBuffer9_Vtbl =
{
IDirect3DVertexBuffer9Impl_QueryInterface,
@ -157,26 +138,16 @@ IDirect3DVertexBuffer9Vtbl Direct3DVertexBuffer9_Vtbl =
HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface,
UINT Size, DWORD Usage, DWORD FVF, D3DPOOL Pool,
IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle) {
IDirect3DVertexBuffer9Impl *object;
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
/* Allocate the storage for the device */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVertexBuffer9Impl));
object->lpVtbl = &Direct3DVertexBuffer9_Vtbl;
object->ref = 1;
object->Device = This;
object->ResourceType = D3DRTYPE_VERTEXBUFFER;
object->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, Size);
object->myDesc.Usage = Usage;
object->myDesc.Pool = Pool;
object->myDesc.FVF = FVF;
object->myDesc.Size = Size;
TRACE("(%p) : Size=%d, Usage=%ld, FVF=%lx, Pool=%d - Memory@%p, Iface@%p\n", This, Size, Usage, FVF, Pool, object->allocatedMemory, object);
object->device = This;
IWineD3DDevice_CreateVertexBuffer(This->WineD3DDevice, Size, Usage, FVF, Pool, &(object->wineD3DVertexBuffer), pSharedHandle);
*ppVertexBuffer = (LPDIRECT3DVERTEXBUFFER9) object;
return D3D_OK;

View File

@ -20,18 +20,6 @@
*/
#include "config.h"
#include <math.h>
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);

View File

@ -20,17 +20,6 @@
*/
#include "config.h"
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);

View File

@ -20,19 +20,6 @@
*/
#include "config.h"
#include <stdarg.h>
#define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);

View File

@ -20,17 +20,6 @@
*/
#include "config.h"
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);

View File

@ -19,16 +19,6 @@
*/
#include "config.h"
#include <math.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);

View File

@ -10,7 +10,9 @@ EXTRALIBS = -ldxguid -luuid @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ @OPENGL_
C_SRCS = \
device.c \
directx.c \
resource.c \
utils.c \
vertexbuffer.c \
vertexshader.c \
wined3d_main.c

View File

@ -34,6 +34,29 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_caps);
/**********************************************************
* IWineD3DDevice implementation follows
**********************************************************/
HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *iface, UINT Size, DWORD Usage,
DWORD FVF, D3DPOOL Pool, IWineD3DVertexBuffer** ppVertexBuffer, HANDLE *sharedHandle) {
IWineD3DVertexBufferImpl *object;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
/* Allocate the storage for the device */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DVertexBufferImpl));
object->lpVtbl = &IWineD3DVertexBuffer_Vtbl;
object->resource.wineD3DDevice= iface;
object->resource.resourceType = D3DRTYPE_VERTEXBUFFER;
object->resource.ref = 1;
object->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, Size);
object->currentDesc.Usage = Usage;
object->currentDesc.Pool = Pool;
object->currentDesc.FVF = FVF;
object->currentDesc.Size = Size;
TRACE("(%p) : Size=%d, Usage=%ld, FVF=%lx, Pool=%d - Memory@%p, Iface@%p\n", This, Size, Usage, FVF, Pool, object->allocatedMemory, object);
*ppVertexBuffer = (IWineD3DVertexBuffer *)object;
return D3D_OK;
}
/**********************************************************
@ -47,7 +70,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_QueryInterface(IWineD3DDevice *iface,REFIID ri
ULONG WINAPI IWineD3DDeviceImpl_AddRef(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
FIXME("(%p) : AddRef increasing from %ld\n", This, This->ref);
TRACE("(%p) : AddRef increasing from %ld\n", This, This->ref);
return InterlockedIncrement(&This->ref);
}
@ -71,5 +94,6 @@ IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
{
IWineD3DDeviceImpl_QueryInterface,
IWineD3DDeviceImpl_AddRef,
IWineD3DDeviceImpl_Release
IWineD3DDeviceImpl_Release,
IWineD3DDeviceImpl_CreateVertexBuffer
};

View File

@ -0,0 +1,113 @@
/*
* IWineD3DResource Implementation
*
* Copyright 2002-2004 Jason Edmeades
* Copyright 2003-2004 Raphael Junqueira
* Copyright 2004 Christian Costa
*
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
/* IDirect3DResource IUnknown parts follow: */
HRESULT WINAPI IWineD3DResourceImpl_QueryInterface(IWineD3DResource *iface, REFIID riid, LPVOID *ppobj)
{
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
WARN("(%p)->(%s,%p) should not be called\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
ULONG WINAPI IWineD3DResourceImpl_AddRef(IWineD3DResource *iface) {
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
TRACE("(%p) : AddRef increasing from %ld\n", This, This->resource.ref);
return InterlockedIncrement(&This->resource.ref);
}
ULONG WINAPI IWineD3DResourceImpl_Release(IWineD3DResource *iface) {
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
ULONG ref;
TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref);
ref = InterlockedDecrement(&This->resource.ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
/* IDirect3DResource Interface follow: */
HRESULT WINAPI IWineD3DResourceImpl_GetDevice(IWineD3DResource *iface, IWineD3DDevice** ppDevice) {
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
TRACE("(%p) : returning %p\n", This, This->resource.wineD3DDevice);
*ppDevice = (IWineD3DDevice *) This->resource.wineD3DDevice;
IWineD3DDevice_AddRef(*ppDevice);
return D3D_OK;
}
/* Private Date is not implemented yet */
HRESULT WINAPI IWineD3DResourceImpl_SetPrivateData(IWineD3DResource *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
FIXME("(%p) : stub\n", This); return D3D_OK;
}
HRESULT WINAPI IWineD3DResourceImpl_GetPrivateData(IWineD3DResource *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
FIXME("(%p) : stub\n", This); return D3D_OK;
}
HRESULT WINAPI IWineD3DResourceImpl_FreePrivateData(IWineD3DResource *iface, REFGUID refguid) {
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
FIXME("(%p) : stub\n", This); return D3D_OK;
}
/* Priority support is not implemented yet */
DWORD WINAPI IWineD3DResourceImpl_SetPriority(IWineD3DResource *iface, DWORD PriorityNew) {
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
FIXME("(%p) : stub\n", This);
return 0;
}
DWORD WINAPI IWineD3DResourceImpl_GetPriority(IWineD3DResource *iface) {
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
FIXME("(%p) : stub\n", This);
return 0;
}
/* Preloading of resources is not supported yet */
void WINAPI IWineD3DResourceImpl_PreLoad(IWineD3DResource *iface) {
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
FIXME("(%p) : stub\n", This);
}
D3DRESOURCETYPE WINAPI IWineD3DResourceImpl_GetType(IWineD3DResource *iface) {
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
TRACE("(%p) : returning %d\n", This, This->resource.resourceType);
return This->resource.resourceType;
}
IWineD3DResourceVtbl IWineD3DResource_Vtbl =
{
IWineD3DResourceImpl_QueryInterface,
IWineD3DResourceImpl_AddRef,
IWineD3DResourceImpl_Release,
IWineD3DResourceImpl_GetDevice,
IWineD3DResourceImpl_SetPrivateData,
IWineD3DResourceImpl_GetPrivateData,
IWineD3DResourceImpl_FreePrivateData,
IWineD3DResourceImpl_SetPriority,
IWineD3DResourceImpl_GetPriority,
IWineD3DResourceImpl_PreLoad,
IWineD3DResourceImpl_GetType
};

View File

@ -0,0 +1,136 @@
/*
* IWineD3DVertexBuffer Implementation
*
* Copyright 2002-2004 Jason Edmeades
* Copyright 2003-2004 Raphael Junqueira
* Copyright 2004 Christian Costa
*
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
/* *******************************************
IWineD3DVertexBuffer IUnknown parts follow
******************************************* */
HRESULT WINAPI IWineD3DVertexBufferImpl_QueryInterface(IWineD3DVertexBuffer *iface, REFIID riid, LPVOID *ppobj)
{
IWineD3DVertexBufferImpl *This = (IWineD3DVertexBufferImpl *)iface;
WARN("(%p)->(%s,%p) should not be called\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
ULONG WINAPI IWineD3DVertexBufferImpl_AddRef(IWineD3DVertexBuffer *iface) {
IWineD3DVertexBufferImpl *This = (IWineD3DVertexBufferImpl *)iface;
TRACE("(%p) : AddRef increasing from %ld\n", This, This->resource.ref);
return InterlockedIncrement(&This->resource.ref);
}
ULONG WINAPI IWineD3DVertexBufferImpl_Release(IWineD3DVertexBuffer *iface) {
IWineD3DVertexBufferImpl *This = (IWineD3DVertexBufferImpl *)iface;
ULONG ref;
TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref);
ref = InterlockedDecrement(&This->resource.ref);
if (ref == 0) {
if (NULL != This->allocatedMemory) HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
/* ****************************************************
IWineD3DVertexBuffer IWineD3DResource parts follow
**************************************************** */
HRESULT WINAPI IWineD3DVertexBufferImpl_GetDevice(IWineD3DVertexBuffer *iface, IWineD3DDevice** ppDevice) {
return IWineD3DResource_GetDevice((IWineD3DResource *)iface, ppDevice);
}
HRESULT WINAPI IWineD3DVertexBufferImpl_SetPrivateData(IWineD3DVertexBuffer *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
return IWineD3DResource_SetPrivateData((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags);
}
HRESULT WINAPI IWineD3DVertexBufferImpl_GetPrivateData(IWineD3DVertexBuffer *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
return IWineD3DResource_GetPrivateData((IWineD3DResource *)iface, refguid, pData, pSizeOfData);
}
HRESULT WINAPI IWineD3DVertexBufferImpl_FreePrivateData(IWineD3DVertexBuffer *iface, REFGUID refguid) {
return IWineD3DResource_FreePrivateData((IWineD3DResource *)iface, refguid);
}
DWORD WINAPI IWineD3DVertexBufferImpl_SetPriority(IWineD3DVertexBuffer *iface, DWORD PriorityNew) {
return IWineD3DResource_SetPriority((IWineD3DResource *)iface, PriorityNew);
}
DWORD WINAPI IWineD3DVertexBufferImpl_GetPriority(IWineD3DVertexBuffer *iface) {
return IWineD3DResource_GetPriority((IWineD3DResource *)iface);
}
void WINAPI IWineD3DVertexBufferImpl_PreLoad(IWineD3DVertexBuffer *iface) {
return IWineD3DResource_PreLoad((IWineD3DResource *)iface);
}
D3DRESOURCETYPE WINAPI IWineD3DVertexBufferImpl_GetType(IWineD3DVertexBuffer *iface) {
return IWineD3DResource_GetType((IWineD3DResource *)iface);
}
/* ******************************************************
IWineD3DVertexBuffer IWineD3DVertexBuffer parts follow
****************************************************** */
HRESULT WINAPI IWineD3DVertexBufferImpl_Lock(IWineD3DVertexBuffer *iface, UINT OffsetToLock, UINT SizeToLock, BYTE** ppbData, DWORD Flags) {
IWineD3DVertexBufferImpl *This = (IWineD3DVertexBufferImpl *)iface;
TRACE("(%p) : returning memory of %p (base:%p,offset:%u)\n", This, This->allocatedMemory + OffsetToLock, This->allocatedMemory, OffsetToLock);
/* TODO: check Flags compatibility with This->currentDesc.Usage (see MSDN) */
*ppbData = This->allocatedMemory + OffsetToLock;
return D3D_OK;
}
HRESULT WINAPI IWineD3DVertexBufferImpl_Unlock(IWineD3DVertexBuffer *iface) {
IWineD3DVertexBufferImpl *This = (IWineD3DVertexBufferImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DVertexBufferImpl_GetDesc(IWineD3DVertexBuffer *iface, D3DVERTEXBUFFER_DESC *pDesc) {
IWineD3DVertexBufferImpl *This = (IWineD3DVertexBufferImpl *)iface;
TRACE("(%p)\n", This);
pDesc->Format = This->currentDesc.Format;
pDesc->Type = This->currentDesc.Type;
pDesc->Usage = This->currentDesc.Usage;
pDesc->Pool = This->currentDesc.Pool;
pDesc->Size = This->currentDesc.Size;
pDesc->FVF = This->currentDesc.FVF;
return D3D_OK;
}
IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl =
{
IWineD3DVertexBufferImpl_QueryInterface,
IWineD3DVertexBufferImpl_AddRef,
IWineD3DVertexBufferImpl_Release,
IWineD3DVertexBufferImpl_GetDevice,
IWineD3DVertexBufferImpl_SetPrivateData,
IWineD3DVertexBufferImpl_GetPrivateData,
IWineD3DVertexBufferImpl_FreePrivateData,
IWineD3DVertexBufferImpl_SetPriority,
IWineD3DVertexBufferImpl_GetPriority,
IWineD3DVertexBufferImpl_PreLoad,
IWineD3DVertexBufferImpl_GetType,
IWineD3DVertexBufferImpl_Lock,
IWineD3DVertexBufferImpl_Unlock,
IWineD3DVertexBufferImpl_GetDesc
};

View File

@ -143,6 +143,47 @@ typedef struct IWineD3DDeviceImpl
extern IWineD3DDeviceVtbl IWineD3DDevice_Vtbl;
/*****************************************************************************
* IWineD3DResource implementation structure
*/
typedef struct IWineD3DResourceClass
{
/* IUnknown fields */
DWORD ref; /* Note: Ref counting not required */
/* WineD3DResource Information */
IWineD3DDevice *wineD3DDevice;
D3DRESOURCETYPE resourceType;
} IWineD3DResourceClass;
typedef struct IWineD3DResourceImpl
{
/* IUnknown & WineD3DResource Information */
IWineD3DResourceVtbl *lpVtbl;
IWineD3DResourceClass resource;
} IWineD3DResourceImpl;
extern IWineD3DResourceVtbl IWineD3DResource_Vtbl;
/*****************************************************************************
* IWineD3DVertexBuffer implementation structure (extends IWineD3DResourceImpl)
*/
typedef struct IWineD3DVertexBufferImpl
{
/* IUnknown & WineD3DResource Information */
IWineD3DVertexBufferVtbl *lpVtbl;
IWineD3DResourceClass resource;
/* WineD3DVertexBuffer specifics */
BYTE *allocatedMemory;
D3DVERTEXBUFFER_DESC currentDesc;
} IWineD3DVertexBufferImpl;
extern IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl;
/* Utility function prototypes */
const char* debug_d3dformat(D3DFORMAT fmt);
const char* debug_d3ddevicetype(D3DDEVTYPE devtype);

View File

@ -70,8 +70,10 @@ typedef struct _WINED3DPRESENT_PARAMETERS {
UINT *PresentationInterval;
} WINED3DPRESENT_PARAMETERS;
typedef struct IWineD3D IWineD3D;
typedef struct IWineD3DDevice IWineD3DDevice;
typedef struct IWineD3D IWineD3D;
typedef struct IWineD3DDevice IWineD3DDevice;
typedef struct IWineD3DResource IWineD3DResource;
typedef struct IWineD3DVertexBuffer IWineD3DVertexBuffer;
/*****************************************************************************
* WineD3D interface
@ -138,6 +140,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IWineD3D methods ***/
STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IWineD3DVertexBuffer **ppVertexBuffer, HANDLE *sharedHandle) PURE;
};
#undef INTERFACE
@ -146,7 +149,92 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
#define IWineD3DDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IWineD3DDevice_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IWineD3DDevice_Release(p) (p)->lpVtbl->Release(p)
/*** IWineD3D methods ***/
/*** IWineD3DDevice methods ***/
#define IWineD3DDevice_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f)
#endif
/*****************************************************************************
* WineD3DResource interface
*/
#define INTERFACE IWineD3DResource
DECLARE_INTERFACE_(IWineD3DResource,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IWineD3DResource methods ***/
STDMETHOD(GetDevice)(THIS_ IWineD3DDevice ** ppDevice) PURE;
STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags) PURE;
STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void * pData, DWORD * pSizeOfData) PURE;
STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE;
STDMETHOD_(DWORD,SetPriority)(THIS_ DWORD PriorityNew) PURE;
STDMETHOD_(DWORD,GetPriority)(THIS) PURE;
STDMETHOD_(void,PreLoad)(THIS) PURE;
STDMETHOD_(D3DRESOURCETYPE,GetType)(THIS) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IWineD3DResource_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IWineD3DResource_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IWineD3DResource_Release(p) (p)->lpVtbl->Release(p)
/*** IWineD3DResource methods ***/
#define IWineD3DResource_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
#define IWineD3DResource_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d)
#define IWineD3DResource_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c)
#define IWineD3DResource_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a)
#define IWineD3DResource_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a)
#define IWineD3DResource_GetPriority(p) (p)->lpVtbl->GetPriority(p)
#define IWineD3DResource_PreLoad(p) (p)->lpVtbl->PreLoad(p)
#define IWineD3DResource_GetType(p) (p)->lpVtbl->GetType(p)
#endif
/*****************************************************************************
* WineD3DVertexBuffer interface
*/
#define INTERFACE IWineD3DVertexBuffer
DECLARE_INTERFACE_(IWineD3DVertexBuffer,IDirect3DResource8)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IWineD3DResource methods ***/
STDMETHOD(GetDevice)(THIS_ IWineD3DDevice ** ppDevice) PURE;
STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags) PURE;
STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void * pData, DWORD * pSizeOfData) PURE;
STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE;
STDMETHOD_(DWORD,SetPriority)(THIS_ DWORD PriorityNew) PURE;
STDMETHOD_(DWORD,GetPriority)(THIS) PURE;
STDMETHOD_(void,PreLoad)(THIS) PURE;
STDMETHOD_(D3DRESOURCETYPE,GetType)(THIS) PURE;
/*** IWineD3DVertexBuffer methods ***/
STDMETHOD(Lock)(THIS_ UINT OffsetToLock, UINT SizeToLock, BYTE ** ppbData, DWORD Flags) PURE;
STDMETHOD(Unlock)(THIS) PURE;
STDMETHOD(GetDesc)(THIS_ D3DVERTEXBUFFER_DESC * pDesc) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IWineD3DVertexBuffer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IWineD3DVertexBuffer_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IWineD3DVertexBuffer_Release(p) (p)->lpVtbl->Release(p)
/*** IWineD3DResource methods ***/
#define IWineD3DVertexBuffer_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
#define IWineD3DVertexBuffer_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d)
#define IWineD3DVertexBuffer_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c)
#define IWineD3DVertexBuffer_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a)
#define IWineD3DVertexBuffer_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a)
#define IWineD3DVertexBuffer_GetPriority(p) (p)->lpVtbl->GetPriority(p)
#define IWineD3DVertexBuffer_PreLoad(p) (p)->lpVtbl->PreLoad(p)
#define IWineD3DVertexBuffer_GetType(p) (p)->lpVtbl->GetType(p)
/*** IWineD3DVertexBuffer methods ***/
#define IWineD3DVertexBuffer_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d)
#define IWineD3DVertexBuffer_Unlock(p) (p)->lpVtbl->Unlock(p)
#define IWineD3DVertexBuffer_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a)
#endif
#if 0 /* FIXME: During porting in from d3d8 - the following will be used */