From db7a50582c2f37c73dd3913e21f8edef860d469e Mon Sep 17 00:00:00 2001 From: Jason Edmeades Date: Thu, 14 Oct 2004 00:32:04 +0000 Subject: [PATCH] - 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. --- dlls/d3d9/basetexture.c | 11 --- dlls/d3d9/cubetexture.c | 11 --- dlls/d3d9/d3d9_private.h | 14 ++-- dlls/d3d9/device.c | 12 --- dlls/d3d9/directx.c | 12 --- dlls/d3d9/indexbuffer.c | 11 --- dlls/d3d9/pixelshader.c | 11 --- dlls/d3d9/query.c | 12 --- dlls/d3d9/resource.c | 43 ++++------ dlls/d3d9/stateblock.c | 12 --- dlls/d3d9/surface.c | 14 ---- dlls/d3d9/swapchain.c | 11 --- dlls/d3d9/texture.c | 11 --- dlls/d3d9/vertexbuffer.c | 65 ++++----------- dlls/d3d9/vertexdeclaration.c | 12 --- dlls/d3d9/vertexshader.c | 11 --- dlls/d3d9/volume.c | 13 --- dlls/d3d9/volumetexture.c | 11 --- dlls/d3d9/vshaderdeclaration.c | 10 --- dlls/wined3d/Makefile.in | 2 + dlls/wined3d/device.c | 28 ++++++- dlls/wined3d/resource.c | 113 +++++++++++++++++++++++++ dlls/wined3d/vertexbuffer.c | 136 +++++++++++++++++++++++++++++++ dlls/wined3d/wined3d_private.h | 41 ++++++++++ include/wine/wined3d_interface.h | 94 ++++++++++++++++++++- 25 files changed, 447 insertions(+), 274 deletions(-) create mode 100644 dlls/wined3d/resource.c create mode 100644 dlls/wined3d/vertexbuffer.c diff --git a/dlls/d3d9/basetexture.c b/dlls/d3d9/basetexture.c index 76d677f4a2a..75299f3ec16 100644 --- a/dlls/d3d9/basetexture.c +++ b/dlls/d3d9/basetexture.c @@ -20,17 +20,6 @@ */ #include "config.h" - -#include - -#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); diff --git a/dlls/d3d9/cubetexture.c b/dlls/d3d9/cubetexture.c index aef31fd43c2..984c3a123f2 100644 --- a/dlls/d3d9/cubetexture.c +++ b/dlls/d3d9/cubetexture.c @@ -20,17 +20,6 @@ */ #include "config.h" - -#include - -#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); diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index 0856d8f5763..f48a5bb2b94 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -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 @@ -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: */ diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index f0e68f6159f..f9c8c6ecb48 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -20,18 +20,6 @@ */ #include "config.h" - -#include -#include - -#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 */ diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c index c560aac1367..126e96582a7 100644 --- a/dlls/d3d9/directx.c +++ b/dlls/d3d9/directx.c @@ -19,18 +19,6 @@ */ #include "config.h" - -#include - -#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); diff --git a/dlls/d3d9/indexbuffer.c b/dlls/d3d9/indexbuffer.c index 541036d1e98..825efd2b3ef 100644 --- a/dlls/d3d9/indexbuffer.c +++ b/dlls/d3d9/indexbuffer.c @@ -20,17 +20,6 @@ */ #include "config.h" - -#include - -#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); diff --git a/dlls/d3d9/pixelshader.c b/dlls/d3d9/pixelshader.c index b6f12da3656..5a305d4daf5 100644 --- a/dlls/d3d9/pixelshader.c +++ b/dlls/d3d9/pixelshader.c @@ -20,17 +20,6 @@ */ #include "config.h" - -#include - -#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); diff --git a/dlls/d3d9/query.c b/dlls/d3d9/query.c index d0ef924813e..ab775196093 100644 --- a/dlls/d3d9/query.c +++ b/dlls/d3d9/query.c @@ -20,18 +20,6 @@ */ #include "config.h" - -#include -#include - -#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); diff --git a/dlls/d3d9/resource.c b/dlls/d3d9/resource.c index af3c89b3b71..483458f7c0d 100644 --- a/dlls/d3d9/resource.c +++ b/dlls/d3d9/resource.c @@ -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 - -#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); } diff --git a/dlls/d3d9/stateblock.c b/dlls/d3d9/stateblock.c index 5ff237da310..9eac3b5ad6e 100644 --- a/dlls/d3d9/stateblock.c +++ b/dlls/d3d9/stateblock.c @@ -20,18 +20,6 @@ */ #include "config.h" - -#include -#include - -#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); diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c index ff1a07b30e9..07473723b6a 100644 --- a/dlls/d3d9/surface.c +++ b/dlls/d3d9/surface.c @@ -20,20 +20,6 @@ */ #include "config.h" - -#include -#include - -#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); diff --git a/dlls/d3d9/swapchain.c b/dlls/d3d9/swapchain.c index f670bd1931e..2eb4ca3cdb1 100644 --- a/dlls/d3d9/swapchain.c +++ b/dlls/d3d9/swapchain.c @@ -20,17 +20,6 @@ */ #include "config.h" - -#include - -#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); diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c index 21e8c9000e6..ad7b9aa9d3b 100644 --- a/dlls/d3d9/texture.c +++ b/dlls/d3d9/texture.c @@ -20,17 +20,6 @@ */ #include "config.h" - -#define NONAMELESSUNION -#define NONAMELESSSTRUCT -#include - -#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); diff --git a/dlls/d3d9/vertexbuffer.c b/dlls/d3d9/vertexbuffer.c index 97b417c8501..908c53728fa 100644 --- a/dlls/d3d9/vertexbuffer.c +++ b/dlls/d3d9/vertexbuffer.c @@ -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 - -#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; diff --git a/dlls/d3d9/vertexdeclaration.c b/dlls/d3d9/vertexdeclaration.c index 10ea3dee2a4..e1144251e97 100644 --- a/dlls/d3d9/vertexdeclaration.c +++ b/dlls/d3d9/vertexdeclaration.c @@ -20,18 +20,6 @@ */ #include "config.h" - -#include -#include - -#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); diff --git a/dlls/d3d9/vertexshader.c b/dlls/d3d9/vertexshader.c index 622aa580b1c..3d3be509ad4 100644 --- a/dlls/d3d9/vertexshader.c +++ b/dlls/d3d9/vertexshader.c @@ -20,17 +20,6 @@ */ #include "config.h" - -#include - -#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); diff --git a/dlls/d3d9/volume.c b/dlls/d3d9/volume.c index a8f6289b94a..bdacd98c0d8 100644 --- a/dlls/d3d9/volume.c +++ b/dlls/d3d9/volume.c @@ -20,19 +20,6 @@ */ #include "config.h" - -#include - -#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); diff --git a/dlls/d3d9/volumetexture.c b/dlls/d3d9/volumetexture.c index 03d41d6df97..56c150685b8 100644 --- a/dlls/d3d9/volumetexture.c +++ b/dlls/d3d9/volumetexture.c @@ -20,17 +20,6 @@ */ #include "config.h" - -#define NONAMELESSUNION -#define NONAMELESSSTRUCT -#include - -#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); diff --git a/dlls/d3d9/vshaderdeclaration.c b/dlls/d3d9/vshaderdeclaration.c index 75fe14ac8fa..6d223534f40 100644 --- a/dlls/d3d9/vshaderdeclaration.c +++ b/dlls/d3d9/vshaderdeclaration.c @@ -19,16 +19,6 @@ */ #include "config.h" - -#include -#include - -#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); diff --git a/dlls/wined3d/Makefile.in b/dlls/wined3d/Makefile.in index 352b2aa4a45..78a7a8892f3 100644 --- a/dlls/wined3d/Makefile.in +++ b/dlls/wined3d/Makefile.in @@ -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 diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 7055f898a9b..1ee3463fc24 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -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 }; diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c new file mode 100644 index 00000000000..3bca025ef75 --- /dev/null +++ b/dlls/wined3d/resource.c @@ -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 +}; diff --git a/dlls/wined3d/vertexbuffer.c b/dlls/wined3d/vertexbuffer.c new file mode 100644 index 00000000000..c8439b51607 --- /dev/null +++ b/dlls/wined3d/vertexbuffer.c @@ -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 +}; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 4ecb41a01a5..33dadf7ab38 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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); diff --git a/include/wine/wined3d_interface.h b/include/wine/wined3d_interface.h index d4938735c6c..a3e2550c68a 100644 --- a/include/wine/wined3d_interface.h +++ b/include/wine/wined3d_interface.h @@ -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 */