Commit db7a5058 authored by Jason Edmeades's avatar Jason Edmeades Committed by Alexandre Julliard

- 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.
parent 4bf9d98c
...@@ -20,17 +20,6 @@ ...@@ -20,17 +20,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
......
...@@ -20,17 +20,6 @@ ...@@ -20,17 +20,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
......
...@@ -31,11 +31,13 @@ ...@@ -31,11 +31,13 @@
#define NONAMELESSUNION #define NONAMELESSUNION
#define NONAMELESSSTRUCT #define NONAMELESSSTRUCT
#define COBJMACROS
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#define XMD_H #define XMD_H
#include <GL/gl.h> #include <GL/gl.h>
...@@ -537,8 +539,8 @@ struct IDirect3DResource9Impl ...@@ -537,8 +539,8 @@ struct IDirect3DResource9Impl
DWORD ref; DWORD ref;
/* IDirect3DResource9 fields */ /* IDirect3DResource9 fields */
IDirect3DDevice9Impl *Device; IWineD3DResource *wineD3DResource;
D3DRESOURCETYPE ResourceType; IDirect3DDevice9 *device;
}; };
/* IUnknown: */ /* IUnknown: */
...@@ -636,12 +638,8 @@ struct IDirect3DVertexBuffer9Impl ...@@ -636,12 +638,8 @@ struct IDirect3DVertexBuffer9Impl
DWORD ref; DWORD ref;
/* IDirect3DResource9 fields */ /* IDirect3DResource9 fields */
IDirect3DDevice9Impl *Device; IWineD3DVertexBuffer *wineD3DVertexBuffer;
D3DRESOURCETYPE ResourceType; IDirect3DDevice9Impl *device;
/* IDirect3DVertexBuffer9 fields */
BYTE *allocatedMemory;
D3DVERTEXBUFFER_DESC myDesc;
}; };
/* IUnknown: */ /* IUnknown: */
......
...@@ -20,18 +20,6 @@ ...@@ -20,18 +20,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
/** currently desactiving 1_4 support as mesa doesn't implement all 1_4 support while defining it */ /** currently desactiving 1_4 support as mesa doesn't implement all 1_4 support while defining it */
......
...@@ -19,18 +19,6 @@ ...@@ -19,18 +19,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
......
...@@ -20,17 +20,6 @@ ...@@ -20,17 +20,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
......
...@@ -20,17 +20,6 @@ ...@@ -20,17 +20,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
......
...@@ -20,18 +20,6 @@ ...@@ -20,18 +20,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
......
/* /*
* IDirect3DResource9 implementation * IDirect3DResource9 implementation
* *
* Copyright 2002-2003 Jason Edmeades * Copyright 2002-2004 Jason Edmeades
* Raphael Junqueira * Raphael Junqueira
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
...@@ -20,17 +20,6 @@ ...@@ -20,17 +20,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
...@@ -53,14 +42,15 @@ HRESULT WINAPI IDirect3DResource9Impl_QueryInterface(LPDIRECT3DRESOURCE9 iface, ...@@ -53,14 +42,15 @@ HRESULT WINAPI IDirect3DResource9Impl_QueryInterface(LPDIRECT3DRESOURCE9 iface,
ULONG WINAPI IDirect3DResource9Impl_AddRef(LPDIRECT3DRESOURCE9 iface) { ULONG WINAPI IDirect3DResource9Impl_AddRef(LPDIRECT3DRESOURCE9 iface) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
TRACE("(%p) : AddRef from %ld\n", This, This->ref); TRACE("(%p) : AddRef from %ld\n", This, This->ref);
return ++(This->ref); return InterlockedIncrement(&This->ref);
} }
ULONG WINAPI IDirect3DResource9Impl_Release(LPDIRECT3DRESOURCE9 iface) { ULONG WINAPI IDirect3DResource9Impl_Release(LPDIRECT3DRESOURCE9 iface) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
ULONG ref = --This->ref; ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) { if (ref == 0) {
IWineD3DResource_Release(This->wineD3DResource);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
return ref; return ref;
...@@ -69,51 +59,46 @@ ULONG WINAPI IDirect3DResource9Impl_Release(LPDIRECT3DRESOURCE9 iface) { ...@@ -69,51 +59,46 @@ ULONG WINAPI IDirect3DResource9Impl_Release(LPDIRECT3DRESOURCE9 iface) {
/* IDirect3DResource9 Interface follow: */ /* IDirect3DResource9 Interface follow: */
HRESULT WINAPI IDirect3DResource9Impl_GetDevice(LPDIRECT3DRESOURCE9 iface, IDirect3DDevice9** ppDevice) { HRESULT WINAPI IDirect3DResource9Impl_GetDevice(LPDIRECT3DRESOURCE9 iface, IDirect3DDevice9** ppDevice) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
TRACE("(%p) : returning %p\n", This, This->Device); TRACE("(%p) : returning %p\n", This, This->device);
*ppDevice = (LPDIRECT3DDEVICE9) This->Device; *ppDevice = (LPDIRECT3DDEVICE9) This->device;
IDirect3DDevice9Impl_AddRef(*ppDevice); IDirect3DDevice9Impl_AddRef(*ppDevice);
return D3D_OK; return D3D_OK;
} }
HRESULT WINAPI IDirect3DResource9Impl_SetPrivateData(LPDIRECT3DRESOURCE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { HRESULT WINAPI IDirect3DResource9Impl_SetPrivateData(LPDIRECT3DRESOURCE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
FIXME("(%p) : stub\n", This); return IWineD3DResource_SetPrivateData(This->wineD3DResource, refguid, pData, SizeOfData, Flags);
return D3D_OK;
} }
HRESULT WINAPI IDirect3DResource9Impl_GetPrivateData(LPDIRECT3DRESOURCE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { HRESULT WINAPI IDirect3DResource9Impl_GetPrivateData(LPDIRECT3DRESOURCE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
FIXME("(%p) : stub\n", This); return IWineD3DResource_GetPrivateData(This->wineD3DResource, refguid, pData, pSizeOfData);
return D3D_OK;
} }
HRESULT WINAPI IDirect3DResource9Impl_FreePrivateData(LPDIRECT3DRESOURCE9 iface, REFGUID refguid) { HRESULT WINAPI IDirect3DResource9Impl_FreePrivateData(LPDIRECT3DRESOURCE9 iface, REFGUID refguid) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
FIXME("(%p) : stub\n", This); return IWineD3DResource_FreePrivateData(This->wineD3DResource, refguid);
return D3D_OK;
} }
DWORD WINAPI IDirect3DResource9Impl_SetPriority(LPDIRECT3DRESOURCE9 iface, DWORD PriorityNew) { DWORD WINAPI IDirect3DResource9Impl_SetPriority(LPDIRECT3DRESOURCE9 iface, DWORD PriorityNew) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
FIXME("(%p) : stub\n", This); return IWineD3DResource_SetPriority(This->wineD3DResource, PriorityNew);
return 0;
} }
DWORD WINAPI IDirect3DResource9Impl_GetPriority(LPDIRECT3DRESOURCE9 iface) { DWORD WINAPI IDirect3DResource9Impl_GetPriority(LPDIRECT3DRESOURCE9 iface) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
FIXME("(%p) : stub\n", This); return IWineD3DResource_GetPriority(This->wineD3DResource);
return 0;
} }
void WINAPI IDirect3DResource9Impl_PreLoad(LPDIRECT3DRESOURCE9 iface) { void WINAPI IDirect3DResource9Impl_PreLoad(LPDIRECT3DRESOURCE9 iface) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
FIXME("(%p) : stub\n", This); IWineD3DResource_PreLoad(This->wineD3DResource);
return;
} }
D3DRESOURCETYPE WINAPI IDirect3DResource9Impl_GetType(LPDIRECT3DRESOURCE9 iface) { D3DRESOURCETYPE WINAPI IDirect3DResource9Impl_GetType(LPDIRECT3DRESOURCE9 iface) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
TRACE("(%p) : returning %d\n", This, This->ResourceType); return IWineD3DResource_GetType(This->wineD3DResource);
return This->ResourceType;
} }
......
...@@ -20,18 +20,6 @@ ...@@ -20,18 +20,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
......
...@@ -20,20 +20,6 @@ ...@@ -20,20 +20,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface); WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
......
...@@ -20,17 +20,6 @@ ...@@ -20,17 +20,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
......
...@@ -20,17 +20,6 @@ ...@@ -20,17 +20,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
......
/* /*
* IDirect3DResource9 implementation * IDirect3DVertexBuffer9 implementation
* *
* Copyright 2002-2003 Jason Edmeades * Copyright 2002-2004 Jason Edmeades
* Raphael Junqueira * Raphael Junqueira
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
...@@ -20,17 +20,6 @@ ...@@ -20,17 +20,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
...@@ -54,15 +43,15 @@ HRESULT WINAPI IDirect3DVertexBuffer9Impl_QueryInterface(LPDIRECT3DVERTEXBUFFER9 ...@@ -54,15 +43,15 @@ HRESULT WINAPI IDirect3DVertexBuffer9Impl_QueryInterface(LPDIRECT3DVERTEXBUFFER9
ULONG WINAPI IDirect3DVertexBuffer9Impl_AddRef(LPDIRECT3DVERTEXBUFFER9 iface) { ULONG WINAPI IDirect3DVertexBuffer9Impl_AddRef(LPDIRECT3DVERTEXBUFFER9 iface) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
TRACE("(%p) : AddRef from %ld\n", This, This->ref); TRACE("(%p) : AddRef from %ld\n", This, This->ref);
return ++(This->ref); return InterlockedIncrement(&This->ref);
} }
ULONG WINAPI IDirect3DVertexBuffer9Impl_Release(LPDIRECT3DVERTEXBUFFER9 iface) { ULONG WINAPI IDirect3DVertexBuffer9Impl_Release(LPDIRECT3DVERTEXBUFFER9 iface) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
ULONG ref = --This->ref; ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) { if (ref == 0) {
if (NULL != This->allocatedMemory) HeapFree(GetProcessHeap(), 0, This->allocatedMemory); IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
return ref; return ref;
...@@ -76,64 +65,56 @@ HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetDevice(LPDIRECT3DVERTEXBUFFER9 ifac ...@@ -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) { HRESULT WINAPI IDirect3DVertexBuffer9Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This); return IWineD3DVertexBuffer_SetPrivateData(This->wineD3DVertexBuffer, refguid, pData, SizeOfData, Flags);
return D3D_OK;
} }
HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This); return IWineD3DVertexBuffer_GetPrivateData(This->wineD3DVertexBuffer, refguid, pData, pSizeOfData);
return D3D_OK;
} }
HRESULT WINAPI IDirect3DVertexBuffer9Impl_FreePrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid) { HRESULT WINAPI IDirect3DVertexBuffer9Impl_FreePrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This); return IWineD3DVertexBuffer_FreePrivateData(This->wineD3DVertexBuffer, refguid);
return D3D_OK;
} }
DWORD WINAPI IDirect3DVertexBuffer9Impl_SetPriority(LPDIRECT3DVERTEXBUFFER9 iface, DWORD PriorityNew) { DWORD WINAPI IDirect3DVertexBuffer9Impl_SetPriority(LPDIRECT3DVERTEXBUFFER9 iface, DWORD PriorityNew) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9) This, PriorityNew); return IWineD3DVertexBuffer_SetPriority(This->wineD3DVertexBuffer, PriorityNew);
} }
DWORD WINAPI IDirect3DVertexBuffer9Impl_GetPriority(LPDIRECT3DVERTEXBUFFER9 iface) { DWORD WINAPI IDirect3DVertexBuffer9Impl_GetPriority(LPDIRECT3DVERTEXBUFFER9 iface) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9) This); return IWineD3DVertexBuffer_GetPriority(This->wineD3DVertexBuffer);
} }
void WINAPI IDirect3DVertexBuffer9Impl_PreLoad(LPDIRECT3DVERTEXBUFFER9 iface) { void WINAPI IDirect3DVertexBuffer9Impl_PreLoad(LPDIRECT3DVERTEXBUFFER9 iface) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This); IWineD3DVertexBuffer_PreLoad(This->wineD3DVertexBuffer);
return ; return ;
} }
D3DRESOURCETYPE WINAPI IDirect3DVertexBuffer9Impl_GetType(LPDIRECT3DVERTEXBUFFER9 iface) { D3DRESOURCETYPE WINAPI IDirect3DVertexBuffer9Impl_GetType(LPDIRECT3DVERTEXBUFFER9 iface) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9) This); return IWineD3DVertexBuffer_GetType(This->wineD3DVertexBuffer);
} }
/* IDirect3DVertexBuffer9 Interface follow: */ /* IDirect3DVertexBuffer9 Interface follow: */
HRESULT WINAPI IDirect3DVertexBuffer9Impl_Lock(LPDIRECT3DVERTEXBUFFER9 iface, UINT OffsetToLock, UINT SizeToLock, void** ppbData, DWORD Flags) { HRESULT WINAPI IDirect3DVertexBuffer9Impl_Lock(LPDIRECT3DVERTEXBUFFER9 iface, UINT OffsetToLock, UINT SizeToLock, void** ppbData, DWORD Flags) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This); return IWineD3DVertexBuffer_Lock(This->wineD3DVertexBuffer, OffsetToLock, SizeToLock, (BYTE **)ppbData, Flags);
return D3D_OK;
} }
HRESULT WINAPI IDirect3DVertexBuffer9Impl_Unlock(LPDIRECT3DVERTEXBUFFER9 iface) { HRESULT WINAPI IDirect3DVertexBuffer9Impl_Unlock(LPDIRECT3DVERTEXBUFFER9 iface) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
FIXME("(%p) : stub\n", This); return IWineD3DVertexBuffer_Unlock(This->wineD3DVertexBuffer);
return D3D_OK;
} }
HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetDesc(LPDIRECT3DVERTEXBUFFER9 iface, D3DVERTEXBUFFER_DESC* pDesc) { HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetDesc(LPDIRECT3DVERTEXBUFFER9 iface, D3DVERTEXBUFFER_DESC* pDesc) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
TRACE("(%p) : copying into %p\n", This, pDesc); return IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer, pDesc);
memcpy(pDesc, &This->myDesc, sizeof(D3DVERTEXBUFFER_DESC));
return D3D_OK;
} }
IDirect3DVertexBuffer9Vtbl Direct3DVertexBuffer9_Vtbl = IDirect3DVertexBuffer9Vtbl Direct3DVertexBuffer9_Vtbl =
{ {
IDirect3DVertexBuffer9Impl_QueryInterface, IDirect3DVertexBuffer9Impl_QueryInterface,
...@@ -157,26 +138,16 @@ IDirect3DVertexBuffer9Vtbl Direct3DVertexBuffer9_Vtbl = ...@@ -157,26 +138,16 @@ IDirect3DVertexBuffer9Vtbl Direct3DVertexBuffer9_Vtbl =
HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface, HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface,
UINT Size, DWORD Usage, DWORD FVF, D3DPOOL Pool, UINT Size, DWORD Usage, DWORD FVF, D3DPOOL Pool,
IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle) { IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle) {
IDirect3DVertexBuffer9Impl *object;
IDirect3DVertexBuffer9Impl *object;
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
/* Allocate the storage for the device */ /* Allocate the storage for the device */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVertexBuffer9Impl)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVertexBuffer9Impl));
object->lpVtbl = &Direct3DVertexBuffer9_Vtbl; object->lpVtbl = &Direct3DVertexBuffer9_Vtbl;
object->ref = 1; object->ref = 1;
object->Device = This; object->device = This;
IWineD3DDevice_CreateVertexBuffer(This->WineD3DDevice, Size, Usage, FVF, Pool, &(object->wineD3DVertexBuffer), pSharedHandle);
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);
*ppVertexBuffer = (LPDIRECT3DVERTEXBUFFER9) object; *ppVertexBuffer = (LPDIRECT3DVERTEXBUFFER9) object;
return D3D_OK; return D3D_OK;
......
...@@ -20,18 +20,6 @@ ...@@ -20,18 +20,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
......
...@@ -20,17 +20,6 @@ ...@@ -20,17 +20,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
......
...@@ -20,19 +20,6 @@ ...@@ -20,19 +20,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
......
...@@ -20,17 +20,6 @@ ...@@ -20,17 +20,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
......
...@@ -19,16 +19,6 @@ ...@@ -19,16 +19,6 @@
*/ */
#include "config.h" #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" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
......
...@@ -10,7 +10,9 @@ EXTRALIBS = -ldxguid -luuid @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ @OPENGL_ ...@@ -10,7 +10,9 @@ EXTRALIBS = -ldxguid -luuid @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ @OPENGL_
C_SRCS = \ C_SRCS = \
device.c \ device.c \
directx.c \ directx.c \
resource.c \
utils.c \ utils.c \
vertexbuffer.c \
vertexshader.c \ vertexshader.c \
wined3d_main.c wined3d_main.c
......
...@@ -34,6 +34,29 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_caps); ...@@ -34,6 +34,29 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_caps);
/********************************************************** /**********************************************************
* IWineD3DDevice implementation follows * 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 ...@@ -47,7 +70,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_QueryInterface(IWineD3DDevice *iface,REFIID ri
ULONG WINAPI IWineD3DDeviceImpl_AddRef(IWineD3DDevice *iface) { ULONG WINAPI IWineD3DDeviceImpl_AddRef(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)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); return InterlockedIncrement(&This->ref);
} }
...@@ -71,5 +94,6 @@ IWineD3DDeviceVtbl IWineD3DDevice_Vtbl = ...@@ -71,5 +94,6 @@ IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
{ {
IWineD3DDeviceImpl_QueryInterface, IWineD3DDeviceImpl_QueryInterface,
IWineD3DDeviceImpl_AddRef, IWineD3DDeviceImpl_AddRef,
IWineD3DDeviceImpl_Release IWineD3DDeviceImpl_Release,
IWineD3DDeviceImpl_CreateVertexBuffer
}; };
/*
* 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
};
/*
* 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
};
...@@ -143,6 +143,47 @@ typedef struct IWineD3DDeviceImpl ...@@ -143,6 +143,47 @@ typedef struct IWineD3DDeviceImpl
extern IWineD3DDeviceVtbl IWineD3DDevice_Vtbl; 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 */ /* Utility function prototypes */
const char* debug_d3dformat(D3DFORMAT fmt); const char* debug_d3dformat(D3DFORMAT fmt);
const char* debug_d3ddevicetype(D3DDEVTYPE devtype); const char* debug_d3ddevicetype(D3DDEVTYPE devtype);
......
...@@ -72,6 +72,8 @@ typedef struct _WINED3DPRESENT_PARAMETERS { ...@@ -72,6 +72,8 @@ typedef struct _WINED3DPRESENT_PARAMETERS {
typedef struct IWineD3D IWineD3D; typedef struct IWineD3D IWineD3D;
typedef struct IWineD3DDevice IWineD3DDevice; typedef struct IWineD3DDevice IWineD3DDevice;
typedef struct IWineD3DResource IWineD3DResource;
typedef struct IWineD3DVertexBuffer IWineD3DVertexBuffer;
/***************************************************************************** /*****************************************************************************
* WineD3D interface * WineD3D interface
...@@ -138,6 +140,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown) ...@@ -138,6 +140,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IWineD3D methods ***/ /*** IWineD3D methods ***/
STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IWineD3DVertexBuffer **ppVertexBuffer, HANDLE *sharedHandle) PURE;
}; };
#undef INTERFACE #undef INTERFACE
...@@ -146,7 +149,92 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown) ...@@ -146,7 +149,92 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
#define IWineD3DDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) #define IWineD3DDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IWineD3DDevice_AddRef(p) (p)->lpVtbl->AddRef(p) #define IWineD3DDevice_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IWineD3DDevice_Release(p) (p)->lpVtbl->Release(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 #endif
#if 0 /* FIXME: During porting in from d3d8 - the following will be used */ #if 0 /* FIXME: During porting in from d3d8 - the following will be used */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment