ChangeSet ID: 15488 CVSROOT: /opt/cvs-commit Module name: wine Changes by: julliard@wine.codeweavers.com 2005/01/17 07:44:57 Modified files: include/wine : wined3d_interface.h dlls/wined3d : wined3d_private.h vertexbuffer.c utils.c surface.c indexbuffer.c drawprim.c device.c basetexture.c Makefile.in dlls/d3d9 : volumetexture.c volume.c texture.c surface.c resource.c device.c d3d9_private.h cubetexture.c basetexture.c Added files: dlls/wined3d : volumetexture.c volume.c texture.c cubetexture.c Log message: Jason Edmeades - Add texture support for all the texture types for d3d9->wined3d. - Add prototypes for the COM interfaces. - Fix some incorrect types from the last patch. Patch: http://cvs.winehq.org/patch.py?id=15488 Old revision New revision Changes Path 1.21 1.22 +306 -2 wine/include/wine/wined3d_interface.h 1.20 1.21 +398 -2 wine/dlls/wined3d/wined3d_private.h 1.6 1.7 +9 -9 wine/dlls/wined3d/vertexbuffer.c 1.5 1.6 +13 -0 wine/dlls/wined3d/utils.c 1.1 1.2 +14 -9 wine/dlls/wined3d/surface.c 1.4 1.5 +9 -9 wine/dlls/wined3d/indexbuffer.c 1.4 1.5 +21 -65 wine/dlls/wined3d/drawprim.c 1.17 1.18 +339 -0 wine/dlls/wined3d/device.c 1.2 1.3 +16 -10 wine/dlls/wined3d/basetexture.c 1.11 1.12 +4 -0 wine/dlls/wined3d/Makefile.in 1.7 1.8 +54 -69 wine/dlls/d3d9/volumetexture.c 1.7 1.8 +55 -28 wine/dlls/d3d9/volume.c 1.8 1.9 +54 -64 wine/dlls/d3d9/texture.c 1.8 1.9 +23 -1 wine/dlls/d3d9/surface.c 1.7 1.8 +1 -0 wine/dlls/d3d9/resource.c 1.16 1.17 +11 -2 wine/dlls/d3d9/device.c 1.10 1.11 +16 -50 wine/dlls/d3d9/d3d9_private.h 1.8 1.9 +57 -74 wine/dlls/d3d9/cubetexture.c 1.7 1.8 +9 -16 wine/dlls/d3d9/basetexture.c Added 1.1 +0 -0 wine/dlls/wined3d/volumetexture.c Added 1.1 +0 -0 wine/dlls/wined3d/volume.c Added 1.1 +0 -0 wine/dlls/wined3d/texture.c Added 1.1 +0 -0 wine/dlls/wined3d/cubetexture.c Index: wine/include/wine/wined3d_interface.h diff -u -p wine/include/wine/wined3d_interface.h:1.21 wine/include/wine/wined3d_interface.h:1.22 --- wine/include/wine/wined3d_interface.h:1.21 Sun May 19 15:10:15 2013 +++ wine/include/wine/wined3d_interface.h Sun May 19 15:10:15 2013 @@ -75,6 +75,7 @@ typedef struct _WINED3DSURFACE_DESC D3DRESOURCETYPE *Type; DWORD *Usage; D3DPOOL *Pool; + UINT *Size; D3DMULTISAMPLE_TYPE *MultiSampleType; DWORD *MultiSampleQuality; @@ -82,6 +83,19 @@ typedef struct _WINED3DSURFACE_DESC UINT *Height; } WINED3DSURFACE_DESC; +typedef struct _WINED3DVOLUME_DESC +{ + D3DFORMAT *Format; + D3DRESOURCETYPE *Type; + DWORD *Usage; + D3DPOOL *Pool; + UINT *Size; + + UINT *Width; + UINT *Height; + UINT *Depth; +} WINED3DVOLUME_DESC; + /* The following have differing names, but actually are the same layout */ #if defined( __WINE_D3D8_H ) #define WINED3DLIGHT D3DLIGHT8 @@ -101,13 +115,17 @@ typedef struct IWineD3DResource IW typedef struct IWineD3DVertexBuffer IWineD3DVertexBuffer; typedef struct IWineD3DIndexBuffer IWineD3DIndexBuffer; typedef struct IWineD3DBaseTexture IWineD3DBaseTexture; +typedef struct IWineD3DTexture IWineD3DTexture; +typedef struct IWineD3DCubeTexture IWineD3DCubeTexture; +typedef struct IWineD3DVolumeTexture IWineD3DVolumeTexture; typedef struct IWineD3DStateBlock IWineD3DStateBlock; typedef struct IWineD3DSurface IWineD3DSurface; +typedef struct IWineD3DVolume IWineD3DVolume; /***************************************************************************** * Callback functions required for predefining surfaces / stencils */ -typedef HRESULT WINAPI (*D3DCB_CREATERENDERTARGETFN) (IUnknown *pSurface, +typedef HRESULT WINAPI (*D3DCB_CREATERENDERTARGETFN) (IUnknown *pDevice, UINT Width, UINT Height, D3DFORMAT Format, @@ -117,6 +135,24 @@ typedef HRESULT WINAPI (*D3DCB_CREATEREN IWineD3DSurface **ppSurface, HANDLE * pSharedHandle); +typedef HRESULT WINAPI (*D3DCB_CREATESURFACEFN) (IUnknown *pDevice, + UINT Width, + UINT Height, + D3DFORMAT Format, + D3DPOOL Pool, + IWineD3DSurface **ppSurface, + HANDLE * pSharedHandle); + +typedef HRESULT WINAPI (*D3DCB_CREATEVOLUMEFN) (IUnknown *pDevice, + UINT Width, + UINT Height, + UINT Depth, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Usage, + IWineD3DVolume **ppVolume, + HANDLE * pSharedHandle); + /***************************************************************************** * WineD3D interface */ @@ -189,6 +225,11 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnkno STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DIndexBuffer** ppIndexBuffer, HANDLE* pSharedHandle, IUnknown *parent) PURE; STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type, IWineD3DStateBlock **ppStateBlock, IUnknown *parent) PURE; STDMETHOD(CreateRenderTarget)(THIS_ UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IWineD3DSurface** ppSurface, HANDLE* pSharedHandle, IUnknown *parent) PURE; + STDMETHOD(CreateOffscreenPlainSurface)(THIS_ UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IWineD3DSurface** ppSurface, HANDLE* pSharedHandle, IUnknown *parent) PURE; + STDMETHOD(CreateTexture)(THIS_ UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DTexture** ppTexture, HANDLE* pSharedHandle, IUnknown *parent, D3DCB_CREATESURFACEFN pFn) PURE; + STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DVolumeTexture** ppVolumeTexture, HANDLE* pSharedHandle, IUnknown *parent, D3DCB_CREATEVOLUMEFN pFn) PURE; + STDMETHOD(CreateVolume)(THIS_ UINT Width, UINT Height, UINT Depth, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DVolume** ppVolumeTexture, HANDLE* pSharedHandle, IUnknown *parent) PURE; + STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DCubeTexture** ppCubeTexture, HANDLE* pSharedHandle, IUnknown *parent, D3DCB_CREATESURFACEFN pFn) PURE; STDMETHOD(SetFVF)(THIS_ DWORD fvf) PURE; STDMETHOD(GetFVF)(THIS_ DWORD * pfvf) PURE; STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IWineD3DVertexBuffer * pStreamData,UINT Offset,UINT Stride) PURE; @@ -240,6 +281,11 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnkno #define IWineD3DDevice_CreateIndexBuffer(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e,f,g) #define IWineD3DDevice_CreateStateBlock(p,a,b,c) (p)->lpVtbl->CreateStateBlock(p,a,b,c) #define IWineD3DDevice_CreateRenderTarget(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f,g,h,i) +#define IWineD3DDevice_CreateOffscreenPlainSurface(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateOffscreenPlainSurface(p,a,b,c,d,e,f,g) +#define IWineD3DDevice_CreateTexture(p,a,b,c,d,e,f,g,h,i,j) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g,h,i,j) +#define IWineD3DDevice_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i,j,k) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i,j,k) +#define IWineD3DDevice_CreateVolume(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateVolume(p,a,b,c,d,e,f,g,h,i) +#define IWineD3DDevice_CreateCubeTexture(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f,g,h,i) #define IWineD3DDevice_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a) #define IWineD3DDevice_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a) #define IWineD3DDevice_SetStreamSource(p,a,b,c,d) (p)->lpVtbl->SetStreamSource(p,a,b,c,d) @@ -442,6 +488,7 @@ DECLARE_INTERFACE_(IWineD3DBaseTexture,I STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; STDMETHOD_(BOOL, SetDirty)(THIS_ BOOL) PURE; + STDMETHOD_(BOOL, GetDirty)(THIS) PURE; }; #undef INTERFACE @@ -451,7 +498,7 @@ DECLARE_INTERFACE_(IWineD3DBaseTexture,I #define IWineD3DBaseTexture_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) #define IWineD3DBaseTexture_AddRef(p) (p)->lpVtbl->AddRef(p) #define IWineD3DBaseTexture_Release(p) (p)->lpVtbl->Release(p) -/*** IWineD3DBaseTexture methods: IDirect3DResource9 ***/ +/*** IWineD3DBaseTexture methods: IWineD3DResource ***/ #define IWineD3DBaseTexture_GetParent(p,a) (p)->lpVtbl->GetParent(p,a) #define IWineD3DBaseTexture_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) #define IWineD3DBaseTexture_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) @@ -469,6 +516,219 @@ DECLARE_INTERFACE_(IWineD3DBaseTexture,I #define IWineD3DBaseTexture_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) #define IWineD3DBaseTexture_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) #define IWineD3DBaseTexture_SetDirty(p,a) (p)->lpVtbl->SetDirty(p,a) +#define IWineD3DBaseTexture_GetDirty(p) (p)->lpVtbl->GetDirty(p) +#endif + +/***************************************************************************** + * IWineD3DTexture interface + */ +#define INTERFACE IWineD3DTexture +DECLARE_INTERFACE_(IWineD3DTexture,IWineD3DBaseTexture) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IWineD3DResource methods ***/ + STDMETHOD(GetParent)(THIS_ IUnknown **pParent) PURE; + 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; + /*** IWineD3DBaseTexture methods ***/ + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; + STDMETHOD_(BOOL, SetDirty)(THIS_ BOOL) PURE; + STDMETHOD_(BOOL, GetDirty)(THIS) PURE; + /*** IWineD3DTexture methods ***/ + STDMETHOD(GetLevelDesc)(THIS_ UINT Level, WINED3DSURFACE_DESC* pDesc) PURE; + STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level, IWineD3DSurface** ppSurfaceLevel) PURE; + STDMETHOD(LockRect)(THIS_ UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IWineD3DTexture_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IWineD3DTexture_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IWineD3DTexture_Release(p) (p)->lpVtbl->Release(p) +/*** IWineD3DTexture methods: IWineD3DResource ***/ +#define IWineD3DTexture_GetParent(p,a) (p)->lpVtbl->GetParent(p,a) +#define IWineD3DTexture_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IWineD3DTexture_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IWineD3DTexture_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IWineD3DTexture_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IWineD3DTexture_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IWineD3DTexture_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IWineD3DTexture_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IWineD3DTexture_GetType(p) (p)->lpVtbl->GetType(p) +/*** IWineD3DTexture methods: IWineD3DBaseTexture ***/ +#define IWineD3DTexture_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IWineD3DTexture_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IWineD3DTexture_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IWineD3DTexture_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IWineD3DTexture_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IWineD3DTexture_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#define IWineD3DTexture_SetDirty(p,a) (p)->lpVtbl->SetDirty(p,a) +#define IWineD3DTexture_GetDirty(p) (p)->lpVtbl->GetDirty(p) +/*** IWineD3DTexture methods ***/ +#define IWineD3DTexture_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IWineD3DTexture_GetSurfaceLevel(p,a,b) (p)->lpVtbl->GetSurfaceLevel(p,a,b) +#define IWineD3DTexture_LockRect(p,a,b,c,d) (p)->lpVtbl->LockRect(p,a,b,c,d) +#define IWineD3DTexture_UnlockRect(p,a) (p)->lpVtbl->UnlockRect(p,a) +#define IWineD3DTexture_AddDirtyRect(p,a) (p)->lpVtbl->AddDirtyRect(p,a) +#endif + +/***************************************************************************** + * IWineD3DCubeTexture interface + */ +#define INTERFACE IWineD3DCubeTexture +DECLARE_INTERFACE_(IWineD3DCubeTexture,IWineD3DBaseTexture) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IWineD3DResource methods ***/ + STDMETHOD(GetParent)(THIS_ IUnknown **pParent) PURE; + 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; + /*** IWineD3DBaseTexture methods ***/ + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; + STDMETHOD_(BOOL, SetDirty)(THIS_ BOOL) PURE; + STDMETHOD_(BOOL, GetDirty)(THIS) PURE; + /*** IWineD3DCubeTexture methods ***/ + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,WINED3DSURFACE_DESC* pDesc) PURE; + STDMETHOD(GetCubeMapSurface)(THIS_ D3DCUBEMAP_FACES FaceType, UINT Level, IWineD3DSurface** ppCubeMapSurface) PURE; + STDMETHOD(LockRect)(THIS_ D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ D3DCUBEMAP_FACES FaceType, UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IWineD3DCubeTexture_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IWineD3DCubeTexture_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IWineD3DCubeTexture_Release(p) (p)->lpVtbl->Release(p) +/*** IWineD3DCubeTexture methods: IWineD3DResource ***/ +#define IWineD3DCubeTexture_GetParent(p,a) (p)->lpVtbl->GetParent(p,a) +#define IWineD3DCubeTexture_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IWineD3DCubeTexture_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IWineD3DCubeTexture_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IWineD3DCubeTexture_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IWineD3DCubeTexture_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IWineD3DCubeTexture_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IWineD3DCubeTexture_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IWineD3DCubeTexture_GetType(p) (p)->lpVtbl->GetType(p) +/*** IWineD3DCubeTexture methods: IWineD3DBaseTexture ***/ +#define IWineD3DCubeTexture_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IWineD3DCubeTexture_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IWineD3DCubeTexture_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IWineD3DCubeTexture_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IWineD3DCubeTexture_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IWineD3DCubeTexture_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#define IWineD3DCubeTexture_SetDirty(p,a) (p)->lpVtbl->SetDirty(p,a) +#define IWineD3DCubeTexture_GetDirty(p) (p)->lpVtbl->GetDirty(p) +/*** IWineD3DCubeTexture methods ***/ +#define IWineD3DCubeTexture_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IWineD3DCubeTexture_GetCubeMapSurface(p,a,b,c) (p)->lpVtbl->GetCubeMapSurface(p,a,b,c) +#define IWineD3DCubeTexture_LockRect(p,a,b,c,d,e) (p)->lpVtbl->LockRect(p,a,b,c,d,e) +#define IWineD3DCubeTexture_UnlockRect(p,a,b) (p)->lpVtbl->UnlockRect(p,a,b) +#define IWineD3DCubeTexture_AddDirtyRect(p,a,b) (p)->lpVtbl->AddDirtyRect(p,a,b) +#endif + + +/***************************************************************************** + * IWineD3DVolumeTexture interface + */ +#define INTERFACE IWineD3DVolumeTexture +DECLARE_INTERFACE_(IWineD3DVolumeTexture,IWineD3DBaseTexture) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IWineD3DResource methods ***/ + STDMETHOD(GetParent)(THIS_ IUnknown **pParent) PURE; + 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; + /*** IWineD3DBaseTexture methods ***/ + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; + STDMETHOD_(BOOL, SetDirty)(THIS_ BOOL) PURE; + STDMETHOD_(BOOL, GetDirty)(THIS) PURE; + /*** IWineD3DVolumeTexture methods ***/ + STDMETHOD(GetLevelDesc)(THIS_ UINT Level, WINED3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(GetVolumeLevel)(THIS_ UINT Level, IWineD3DVolume** ppVolumeLevel) PURE; + STDMETHOD(LockBox)(THIS_ UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyBox)(THIS_ CONST D3DBOX* pDirtyBox) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IWineD3DVolumeTexture_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IWineD3DVolumeTexture_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IWineD3DVolumeTexture_Release(p) (p)->lpVtbl->Release(p) +/*** IWineD3DVolumeTexture methods: IWineD3DResource ***/ +#define IWineD3DVolumeTexture_GetParent(p,a) (p)->lpVtbl->GetParent(p,a) +#define IWineD3DVolumeTexture_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IWineD3DVolumeTexture_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IWineD3DVolumeTexture_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IWineD3DVolumeTexture_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IWineD3DVolumeTexture_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IWineD3DVolumeTexture_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IWineD3DVolumeTexture_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IWineD3DVolumeTexture_GetType(p) (p)->lpVtbl->GetType(p) +/*** IWineD3DVolumeTexture methods: IWineD3DBaseTexture ***/ +#define IWineD3DVolumeTexture_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IWineD3DVolumeTexture_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IWineD3DVolumeTexture_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IWineD3DVolumeTexture_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IWineD3DVolumeTexture_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IWineD3DVolumeTexture_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#define IWineD3DVolumeTexture_SetDirty(p,a) (p)->lpVtbl->SetDirty(p,a) +#define IWineD3DVolumeTexture_GetDirty(p) (p)->lpVtbl->GetDirty(p) + +/*** IWineD3DVolumeTexture methods ***/ +#define IWineD3DVolumeTexture_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IWineD3DVolumeTexture_GetVolumeLevel(p,a,b) (p)->lpVtbl->GetVolumeLevel(p,a,b) +#define IWineD3DVolumeTexture_LockBox(p,a,b,c,d) (p)->lpVtbl->LockBox(p,a,b,c,d) +#define IWineD3DVolumeTexture_UnlockBox(p,a) (p)->lpVtbl->UnlockBox(p,a) +#define IWineD3DVolumeTexture_AddDirtyBox(p,a) (p)->lpVtbl->AddDirtyBox(p,a) #endif /***************************************************************************** @@ -537,6 +797,50 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWine #endif /***************************************************************************** + * IWineD3DVolume interface + */ +#define INTERFACE IWineD3DVolume +DECLARE_INTERFACE_(IWineD3DVolume,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IWineD3DVolume methods ***/ + STDMETHOD(GetParent)(THIS_ IUnknown **pParent) PURE; + 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(GetContainer)(THIS_ REFIID riid, void ** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ WINED3DVOLUME_DESC * pDesc) PURE; + STDMETHOD(LockBox)(THIS_ D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS) PURE; + STDMETHOD(AddDirtyBox)(THIS_ CONST D3DBOX* pDirtyBox) PURE; + STDMETHOD(CleanDirtyBox)(THIS) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IWineD3DVolume_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IWineD3DVolume_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IWineD3DVolume_Release(p) (p)->lpVtbl->Release(p) +/*** IWineD3DVolume methods ***/ +#define IWineD3DVolume_GetParent(p,a) (p)->lpVtbl->GetParent(p,a) +#define IWineD3DVolume_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IWineD3DVolume_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IWineD3DVolume_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IWineD3DVolume_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IWineD3DVolume_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IWineD3DVolume_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IWineD3DVolume_LockBox(p,a,b,c) (p)->lpVtbl->LockBox(p,a,b,c) +#define IWineD3DVolume_UnlockBox(p) (p)->lpVtbl->UnlockBox(p) +#define IWineD3DVolume_AddDirtyBox(p,a) (p)->lpVtbl->AddDirtyBox(p,a) +#define IWineD3DVolume_CleanDirtyBox(p) (p)->lpVtbl->CleanDirtyBox(p) +#endif + +/***************************************************************************** * WineD3DStateBlock interface */ #define INTERFACE IWineD3DStateBlock Index: wine/dlls/wined3d/wined3d_private.h diff -u -p wine/dlls/wined3d/wined3d_private.h:1.20 wine/dlls/wined3d/wined3d_private.h:1.21 --- wine/dlls/wined3d/wined3d_private.h:1.20 Sun May 19 15:10:15 2013 +++ wine/dlls/wined3d/wined3d_private.h Sun May 19 15:10:15 2013 @@ -92,6 +92,8 @@ extern int num_lock; #define GLACTIVETEXTURE(textureNo) \ glActiveTexture(GL_TEXTURE0 + textureNo); \ checkGLcall("glActiveTexture"); +#define GLCLIENTACTIVETEXTURE(textureNo) \ + glClientActiveTexture(GL_TEXTURE0 + textureNo); #define GLMULTITEXCOORD1F(a,b) \ glMultiTexCoord1f(GL_TEXTURE0 + a, b); #define GLMULTITEXCOORD2F(a,b,c) \ @@ -100,10 +102,13 @@ extern int num_lock; glMultiTexCoord3f(GL_TEXTURE0 + a, b, c, d); #define GLMULTITEXCOORD4F(a,b,c,d,e) \ glMultiTexCoord4f(GL_TEXTURE0 + a, b, c, d, e); +#define GLTEXTURECUBEMAP GL_TEXTURE_CUBE_MAP #else #define GLACTIVETEXTURE(textureNo) \ glActiveTextureARB(GL_TEXTURE0_ARB + textureNo); \ checkGLcall("glActiveTextureARB"); +#define GLCLIENTACTIVETEXTURE(textureNo) \ + glClientActiveTextureARB(GL_TEXTURE0_ARB + textureNo); #define GLMULTITEXCOORD1F(a,b) \ glMultiTexCoord1fARB(GL_TEXTURE0_ARB + a, b); #define GLMULTITEXCOORD2F(a,b,c) \ @@ -112,10 +117,13 @@ extern int num_lock; glMultiTexCoord3fARB(GL_TEXTURE0_ARB + a, b, c, d); #define GLMULTITEXCOORD4F(a,b,c,d,e) \ glMultiTexCoord4fARB(GL_TEXTURE0_ARB + a, b, c, d, e); +#define GLTEXTURECUBEMAP GL_TEXTURE_CUBE_MAP_ARB #endif /* DirectX Device Limits */ /* --------------------- */ +#define MAX_LEVELS 256 /* Maximum number of mipmap levels. Guessed at 256 */ + #define MAX_STREAMS 16 /* Maximum possible streams - used for fixed size arrays See MaxStreams in MSDN under GetDeviceCaps */ #define HIGHEST_TRANSFORMSTATE 512 @@ -328,7 +336,7 @@ typedef struct IWineD3DDeviceImpl DWORD ref; /* Note: Ref counting not required */ /* WineD3D Information */ - IUnknown *parent; /* TODO - to be a new interface eventually */ + IUnknown *parent; IWineD3D *wineD3D; /* X and GL Information */ @@ -456,13 +464,14 @@ typedef struct IWineD3DBaseTextureClass { UINT levels; BOOL dirty; + D3DFORMAT format; } IWineD3DBaseTextureClass; typedef struct IWineD3DBaseTextureImpl { /* IUnknown & WineD3DResource Information */ - IWineD3DIndexBufferVtbl *lpVtbl; + IWineD3DBaseTextureVtbl *lpVtbl; IWineD3DResourceClass resource; IWineD3DBaseTextureClass baseTexture; @@ -471,6 +480,98 @@ typedef struct IWineD3DBaseTextureImpl extern IWineD3DBaseTextureVtbl IWineD3DBaseTexture_Vtbl; /***************************************************************************** + * IWineD3DTexture implementation structure (extends IWineD3DBaseTextureImpl) + */ +typedef struct IWineD3DTextureImpl +{ + /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */ + IWineD3DTextureVtbl *lpVtbl; + IWineD3DResourceClass resource; + IWineD3DBaseTextureClass baseTexture; + + /* IWineD3DTexture */ + IWineD3DSurfaceImpl *surfaces[MAX_LEVELS]; + + UINT width; + UINT height; + DWORD usage; + +} IWineD3DTextureImpl; + +extern IWineD3DTextureVtbl IWineD3DTexture_Vtbl; + +/***************************************************************************** + * IWineD3DCubeTexture implementation structure (extends IWineD3DBaseTextureImpl) + */ +typedef struct IWineD3DCubeTextureImpl +{ + /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */ + IWineD3DCubeTextureVtbl *lpVtbl; + IWineD3DResourceClass resource; + IWineD3DBaseTextureClass baseTexture; + + /* IWineD3DCubeTexture */ + IWineD3DSurfaceImpl *surfaces[6][MAX_LEVELS]; + + UINT edgeLength; + DWORD usage; +} IWineD3DCubeTextureImpl; + +extern IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl; + +/***************************************************************************** + * IWineD3DVolume implementation structure (extends IUnknown) + */ +typedef struct IWineD3DVolumeImpl +{ + /* IUnknown fields */ + IWineD3DVolumeVtbl *lpVtbl; + DWORD ref; /* Note: Ref counting not required */ + + /* WineD3DVolume Information */ + IUnknown *parent; + D3DRESOURCETYPE resourceType; + IWineD3DDeviceImpl *wineD3DDevice; + + D3DVOLUME_DESC currentDesc; + UINT textureName; + BYTE *allocatedMemory; + IUnknown *container; + UINT bytesPerPixel; + + BOOL lockable; + BOOL locked; + D3DBOX lockedBox; + D3DBOX dirtyBox; + BOOL dirty; + + +} IWineD3DVolumeImpl; + +extern IWineD3DVolumeVtbl IWineD3DVolume_Vtbl; + +/***************************************************************************** + * IWineD3DVolumeTexture implementation structure (extends IWineD3DBaseTextureImpl) + */ +typedef struct IWineD3DVolumeTextureImpl +{ + /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */ + IWineD3DVolumeTextureVtbl *lpVtbl; + IWineD3DResourceClass resource; + IWineD3DBaseTextureClass baseTexture; + + /* IWineD3DVolumeTexture */ + IWineD3DVolumeImpl *volumes[MAX_LEVELS]; + + UINT width; + UINT height; + UINT depth; + DWORD usage; +} IWineD3DVolumeTextureImpl; + +extern IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl; + +/***************************************************************************** * IWineD3DSurface implementation structure */ struct IWineD3DSurfaceImpl @@ -593,6 +694,7 @@ const char* debug_d3dusage(DWORD usage); const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType); const char* debug_d3drenderstate(DWORD state); const char* debug_d3dtexturestate(DWORD state); +const char* debug_d3dpool(D3DPOOL pool); /* Routines for GL <-> D3D values */ GLenum StencilOp(DWORD op); @@ -605,6 +707,300 @@ GLenum D3DFmt2GLFmt(IWineD3DDeviceImpl* GLenum D3DFmt2GLType(IWineD3DDeviceImpl *This, D3DFORMAT fmt); GLint D3DFmt2GLIntFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt); +/***************************************************************************** + * To enable calling of inherited functions, requires prototypes + */ + /*** IUnknown methods ***/ + extern HRESULT WINAPI IWineD3DImpl_QueryInterface(IWineD3D *iface, REFIID riid, void** ppvObject); + extern ULONG WINAPI IWineD3DImpl_AddRef(IWineD3D *iface); + extern ULONG WINAPI IWineD3DImpl_Release(IWineD3D *iface); + /*** IWineD3D methods ***/ + extern HRESULT WINAPI IWineD3DImpl_GetParent(IWineD3D *iface, IUnknown **pParent); + extern UINT WINAPI IWineD3DImpl_GetAdapterCount(IWineD3D *iface); + extern HRESULT WINAPI IWineD3DImpl_RegisterSoftwareDevice(IWineD3D *iface, void * pInitializeFunction); + extern HMONITOR WINAPI IWineD3DImpl_GetAdapterMonitor(IWineD3D *iface, UINT Adapter); + extern UINT WINAPI IWineD3DImpl_GetAdapterModeCount(IWineD3D *iface, UINT Adapter, D3DFORMAT Format); + extern HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapter, UINT Mode, D3DFORMAT Format, D3DDISPLAYMODE * pMode); + extern HRESULT WINAPI IWineD3DImpl_GetAdapterDisplayMode(IWineD3D *iface, UINT Adapter, D3DDISPLAYMODE * pMode); + extern HRESULT WINAPI IWineD3DImpl_GetAdapterIdentifier(IWineD3D *iface, UINT Adapter, DWORD Flags, WINED3DADAPTER_IDENTIFIER* pIdentifier); + extern HRESULT WINAPI IWineD3DImpl_CheckDeviceMultiSampleType(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD *pQuality); + extern HRESULT WINAPI IWineD3DImpl_CheckDepthStencilMatch(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat); + extern HRESULT WINAPI IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat, D3DFORMAT BackBufferFormat, BOOL Windowed); + extern HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat); + extern HRESULT WINAPI IWineD3DImpl_CheckDeviceFormatConversion(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat); + extern HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType, void * pCaps); + extern HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType,HWND hFocusWindow, DWORD BehaviorFlags, WINED3DPRESENT_PARAMETERS * pPresentationParameters, IWineD3DDevice ** ppReturnedDeviceInterface, IUnknown *parent, D3DCB_CREATERENDERTARGETFN pFn); + + /*** IUnknown methods ***/ + extern HRESULT WINAPI IWineD3DDeviceImpl_QueryInterface(IWineD3DDevice *iface, REFIID riid, void** ppvObject); + extern ULONG WINAPI IWineD3DDeviceImpl_AddRef(IWineD3DDevice *iface); + extern ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface); + /*** IWineD3D methods ***/ + extern HRESULT WINAPI IWineD3DDeviceImpl_GetParent(IWineD3DDevice *iface, IUnknown **pParent); + extern HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *iface, UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IWineD3DVertexBuffer **ppVertexBuffer, HANDLE *sharedHandle, IUnknown *parent); + extern HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface, UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DIndexBuffer** ppIndexBuffer, HANDLE* pSharedHandle, IUnknown *parent); + extern HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice *iface, D3DSTATEBLOCKTYPE Type, IWineD3DStateBlock **ppStateBlock, IUnknown *parent); + extern HRESULT WINAPI IWineD3DDeviceImpl_CreateRenderTarget(IWineD3DDevice *iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IWineD3DSurface** ppSurface, HANDLE* pSharedHandle, IUnknown *parent); + extern HRESULT WINAPI IWineD3DDeviceImpl_CreateOffscreenPlainSurface(IWineD3DDevice *iface, UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IWineD3DSurface** ppSurface, HANDLE* pSharedHandle, IUnknown *parent); + extern HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DTexture** ppTexture, HANDLE* pSharedHandle, IUnknown *parent, D3DCB_CREATESURFACEFN pFn); + extern HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *iface, UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DVolumeTexture** ppVolumeTexture, HANDLE* pSharedHandle, IUnknown *parent, D3DCB_CREATEVOLUMEFN pFn); + extern HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface, UINT Width, UINT Height, UINT Depth, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DVolume** ppVolumeTexture, HANDLE* pSharedHandle, IUnknown *parent); + extern HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface, UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DCubeTexture** ppCubeTexture, HANDLE* pSharedHandle, IUnknown *parent, D3DCB_CREATESURFACEFN pFn); + extern HRESULT WINAPI IWineD3DDeviceImpl_SetFVF(IWineD3DDevice *iface, DWORD fvf); + extern HRESULT WINAPI IWineD3DDeviceImpl_GetFVF(IWineD3DDevice *iface, DWORD * pfvf); + extern HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface, UINT StreamNumber,IWineD3DVertexBuffer * pStreamData,UINT Offset,UINT Stride); + extern HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSource(IWineD3DDevice *iface, UINT StreamNumber,IWineD3DVertexBuffer ** ppStreamData,UINT *pOffset, UINT * pStride); + extern HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX * pMatrix); + extern HRESULT WINAPI IWineD3DDeviceImpl_GetTransform(IWineD3DDevice *iface, D3DTRANSFORMSTATETYPE State,D3DMATRIX * pMatrix); + extern HRESULT WINAPI IWineD3DDeviceImpl_MultiplyTransform(IWineD3DDevice *iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX * pMatrix); + extern HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD Index,CONST WINED3DLIGHT * pLight); + extern HRESULT WINAPI IWineD3DDeviceImpl_GetLight(IWineD3DDevice *iface, DWORD Index,WINED3DLIGHT * pLight); + extern HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, DWORD Index,BOOL Enable); + extern HRESULT WINAPI IWineD3DDeviceImpl_GetLightEnable(IWineD3DDevice *iface, DWORD Index,BOOL * pEnable); + extern HRESULT WINAPI IWineD3DDeviceImpl_SetClipPlane(IWineD3DDevice *iface, DWORD Index,CONST float * pPlane); + extern HRESULT WINAPI IWineD3DDeviceImpl_GetClipPlane(IWineD3DDevice *iface, DWORD Index,float * pPlane); + extern HRESULT WINAPI IWineD3DDeviceImpl_SetClipStatus(IWineD3DDevice *iface, CONST WINED3DCLIPSTATUS * pClipStatus); + extern HRESULT WINAPI IWineD3DDeviceImpl_GetClipStatus(IWineD3DDevice *iface, WINED3DCLIPSTATUS * pClipStatus); + extern HRESULT WINAPI IWineD3DDeviceImpl_SetMaterial(IWineD3DDevice *iface, CONST WINED3DMATERIAL * pMaterial); + extern HRESULT WINAPI IWineD3DDeviceImpl_GetMaterial(IWineD3DDevice *iface, WINED3DMATERIAL *pMaterial); + extern HRESULT WINAPI IWineD3DDeviceImpl_SetIndices(IWineD3DDevice *iface, IWineD3DIndexBuffer * pIndexData,UINT BaseVertexIndex); + extern HRESULT WINAPI IWineD3DDeviceImpl_GetIndices(IWineD3DDevice *iface, IWineD3DIndexBuffer ** ppIndexData,UINT * pBaseVertexIndex); + extern HRESULT WINAPI IWineD3DDeviceImpl_SetViewport(IWineD3DDevice *iface, CONST WINED3DVIEWPORT * pViewport); + extern HRESULT WINAPI IWineD3DDeviceImpl_GetViewport(IWineD3DDevice *iface, WINED3DVIEWPORT * pViewport); + extern HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDERSTATETYPE State,DWORD Value); + extern HRESULT WINAPI IWineD3DDeviceImpl_GetRenderState(IWineD3DDevice *iface, D3DRENDERSTATETYPE State,DWORD * pValue); + extern HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value); + extern HRESULT WINAPI IWineD3DDeviceImpl_GetTextureStageState(IWineD3DDevice *iface, DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD * pValue); + extern HRESULT WINAPI IWineD3DDeviceImpl_BeginScene(IWineD3DDevice *iface); + extern HRESULT WINAPI IWineD3DDeviceImpl_EndScene(IWineD3DDevice *iface); + extern HRESULT WINAPI IWineD3DDeviceImpl_Present(IWineD3DDevice *iface, CONST RECT * pSourceRect,CONST RECT * pDestRect,HWND hDestWindowOverride,CONST RGNDATA * pDirtyRegion); + extern HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Count,CONST D3DRECT * pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil); + extern HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount); + extern HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *iface, D3DPRIMITIVETYPE PrimitiveType,INT baseVIdx, UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount); + extern HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface, D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void * pVertexStreamZeroData,UINT VertexStreamZeroStride); + extern HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *iface, D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertexIndices,UINT PrimitiveCount,CONST void * pIndexData,D3DFORMAT IndexDataFormat,CONST void * pVertexStreamZeroData,UINT VertexStreamZeroStride); + /*** Internal use IWineD3D methods ***/ + extern void WINAPI IWineD3DDeviceImpl_SetupTextureStates(IWineD3DDevice *iface, DWORD Stage, DWORD Flags); + + /*** IUnknown methods ***/ + extern HRESULT WINAPI IWineD3DResourceImpl_QueryInterface(IWineD3DResource *iface, REFIID riid, void** ppvObject); + extern ULONG WINAPI IWineD3DResourceImpl_AddRef(IWineD3DResource *iface); + extern ULONG WINAPI IWineD3DResourceImpl_Release(IWineD3DResource *iface); + /*** IWineD3DResource methods ***/ + extern HRESULT WINAPI IWineD3DResourceImpl_GetParent(IWineD3DResource *iface, IUnknown **pParent); + extern HRESULT WINAPI IWineD3DResourceImpl_GetDevice(IWineD3DResource *iface, IWineD3DDevice ** ppDevice); + extern HRESULT WINAPI IWineD3DResourceImpl_SetPrivateData(IWineD3DResource *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags); + extern HRESULT WINAPI IWineD3DResourceImpl_GetPrivateData(IWineD3DResource *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData); + extern HRESULT WINAPI IWineD3DResourceImpl_FreePrivateData(IWineD3DResource *iface, REFGUID refguid); + extern DWORD WINAPI IWineD3DResourceImpl_SetPriority(IWineD3DResource *iface, DWORD PriorityNew); + extern DWORD WINAPI IWineD3DResourceImpl_GetPriority(IWineD3DResource *iface); + extern void WINAPI IWineD3DResourceImpl_PreLoad(IWineD3DResource *iface); + extern D3DRESOURCETYPE WINAPI IWineD3DResourceImpl_GetType(IWineD3DResource *iface); + + /*** IUnknown methods ***/ + extern HRESULT WINAPI IWineD3DVertexBufferImpl_QueryInterface(IWineD3DVertexBuffer *iface, REFIID riid, void** ppvObject); + extern ULONG WINAPI IWineD3DVertexBufferImpl_AddRef(IWineD3DVertexBuffer *iface); + extern ULONG WINAPI IWineD3DVertexBufferImpl_Release(IWineD3DVertexBuffer *iface); + /*** IWineD3DResource methods ***/ + extern HRESULT WINAPI IWineD3DVertexBufferImpl_GetParent(IWineD3DVertexBuffer *iface, IUnknown **pParent); + extern HRESULT WINAPI IWineD3DVertexBufferImpl_GetDevice(IWineD3DVertexBuffer *iface, IWineD3DDevice ** ppDevice); + extern HRESULT WINAPI IWineD3DVertexBufferImpl_SetPrivateData(IWineD3DVertexBuffer *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags); + extern HRESULT WINAPI IWineD3DVertexBufferImpl_GetPrivateData(IWineD3DVertexBuffer *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData); + extern HRESULT WINAPI IWineD3DVertexBufferImpl_FreePrivateData(IWineD3DVertexBuffer *iface, REFGUID refguid); + extern DWORD WINAPI IWineD3DVertexBufferImpl_SetPriority(IWineD3DVertexBuffer *iface, DWORD PriorityNew); + extern DWORD WINAPI IWineD3DVertexBufferImpl_GetPriority(IWineD3DVertexBuffer *iface); + extern void WINAPI IWineD3DVertexBufferImpl_PreLoad(IWineD3DVertexBuffer *iface); + extern D3DRESOURCETYPE WINAPI IWineD3DVertexBufferImpl_GetType(IWineD3DVertexBuffer *iface); + /*** IWineD3DVertexBuffer methods ***/ + extern HRESULT WINAPI IWineD3DVertexBufferImpl_Lock(IWineD3DVertexBuffer *iface, UINT OffsetToLock, UINT SizeToLock, BYTE ** ppbData, DWORD Flags); + extern HRESULT WINAPI IWineD3DVertexBufferImpl_Unlock(IWineD3DVertexBuffer *iface); + extern HRESULT WINAPI IWineD3DVertexBufferImpl_GetDesc(IWineD3DVertexBuffer *iface, D3DVERTEXBUFFER_DESC * pDesc); + + /*** IUnknown methods ***/ + extern HRESULT WINAPI IWineD3DIndexBufferImpl_QueryInterface(IWineD3DIndexBuffer *iface, REFIID riid, void** ppvObject); + extern ULONG WINAPI IWineD3DIndexBufferImpl_AddRef(IWineD3DIndexBuffer *iface); + extern ULONG WINAPI IWineD3DIndexBufferImpl_Release(IWineD3DIndexBuffer *iface); + /*** IWineD3DResource methods ***/ + extern HRESULT WINAPI IWineD3DIndexBufferImpl_GetParent(IWineD3DIndexBuffer *iface, IUnknown **pParent); + extern HRESULT WINAPI IWineD3DIndexBufferImpl_GetDevice(IWineD3DIndexBuffer *iface, IWineD3DDevice ** ppDevice); + extern HRESULT WINAPI IWineD3DIndexBufferImpl_SetPrivateData(IWineD3DIndexBuffer *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags); + extern HRESULT WINAPI IWineD3DIndexBufferImpl_GetPrivateData(IWineD3DIndexBuffer *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData); + extern HRESULT WINAPI IWineD3DIndexBufferImpl_FreePrivateData(IWineD3DIndexBuffer *iface, REFGUID refguid); + extern DWORD WINAPI IWineD3DIndexBufferImpl_SetPriority(IWineD3DIndexBuffer *iface, DWORD PriorityNew); + extern DWORD WINAPI IWineD3DIndexBufferImpl_GetPriority(IWineD3DIndexBuffer *iface); + extern void WINAPI IWineD3DIndexBufferImpl_PreLoad(IWineD3DIndexBuffer *iface); + extern D3DRESOURCETYPE WINAPI IWineD3DIndexBufferImpl_GetType(IWineD3DIndexBuffer *iface); + /*** IWineD3DIndexBuffer methods ***/ + extern HRESULT WINAPI IWineD3DIndexBufferImpl_Lock(IWineD3DIndexBuffer *iface, UINT OffsetToLock, UINT SizeToLock, BYTE ** ppbData, DWORD Flags); + extern HRESULT WINAPI IWineD3DIndexBufferImpl_Unlock(IWineD3DIndexBuffer *iface); + extern HRESULT WINAPI IWineD3DIndexBufferImpl_GetDesc(IWineD3DIndexBuffer *iface, D3DINDEXBUFFER_DESC * pDesc); + + /*** IUnknown methods ***/ + extern HRESULT WINAPI IWineD3DBaseTextureImpl_QueryInterface(IWineD3DBaseTexture *iface, REFIID riid, void** ppvObject); + extern ULONG WINAPI IWineD3DBaseTextureImpl_AddRef(IWineD3DBaseTexture *iface); + extern ULONG WINAPI IWineD3DBaseTextureImpl_Release(IWineD3DBaseTexture *iface); + /*** IWineD3DResource methods ***/ + extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetParent(IWineD3DBaseTexture *iface, IUnknown **pParent); + extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetDevice(IWineD3DBaseTexture *iface, IWineD3DDevice ** ppDevice); + extern HRESULT WINAPI IWineD3DBaseTextureImpl_SetPrivateData(IWineD3DBaseTexture *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags); + extern HRESULT WINAPI IWineD3DBaseTextureImpl_GetPrivateData(IWineD3DBaseTexture *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData); + extern HRESULT WINAPI IWineD3DBaseTextureImpl_FreePrivateData(IWineD3DBaseTexture *iface, REFGUID refguid); + extern DWORD WINAPI IWineD3DBaseTextureImpl_SetPriority(IWineD3DBaseTexture *iface, DWORD PriorityNew); + extern DWORD WINAPI IWineD3DBaseTextureImpl_GetPriority(IWineD3DBaseTexture *iface); + extern void WINAPI IWineD3DBaseTextureImpl_PreLoad(IWineD3DBaseTexture *iface); + extern D3DRESOURCETYPE WINAPI IWineD3DBaseTextureImpl_GetType(IWineD3DBaseTexture *iface); + /*** IWineD3DBaseTexture methods ***/ + extern DWORD WINAPI IWineD3DBaseTextureImpl_SetLOD(IWineD3DBaseTexture *iface, DWORD LODNew); + extern DWORD WINAPI IWineD3DBaseTextureImpl_GetLOD(IWineD3DBaseTexture *iface); + extern DWORD WINAPI IWineD3DBaseTextureImpl_GetLevelCount(IWineD3DBaseTexture *iface); + extern HRESULT WINAPI IWineD3DBaseTextureImpl_SetAutoGenFilterType(IWineD3DBaseTexture *iface, D3DTEXTUREFILTERTYPE FilterType); + extern D3DTEXTUREFILTERTYPE WINAPI IWineD3DBaseTextureImpl_GetAutoGenFilterType(IWineD3DBaseTexture *iface); + extern void WINAPI IWineD3DBaseTextureImpl_GenerateMipSubLevels(IWineD3DBaseTexture *iface); + extern BOOL WINAPI IWineD3DBaseTextureImpl_SetDirty(IWineD3DBaseTexture *iface, BOOL); + extern BOOL WINAPI IWineD3DBaseTextureImpl_GetDirty(IWineD3DBaseTexture *iface); + + /*** IUnknown methods ***/ + extern HRESULT WINAPI IWineD3DTextureImpl_QueryInterface(IWineD3DTexture *iface, REFIID riid, void** ppvObject); + extern ULONG WINAPI IWineD3DTextureImpl_AddRef(IWineD3DTexture *iface); + extern ULONG WINAPI IWineD3DTextureImpl_Release(IWineD3DTexture *iface); + /*** IWineD3DResource methods ***/ + extern HRESULT WINAPI IWineD3DTextureImpl_GetParent(IWineD3DTexture *iface, IUnknown **pParent); + extern HRESULT WINAPI IWineD3DTextureImpl_GetDevice(IWineD3DTexture *iface, IWineD3DDevice ** ppDevice); + extern HRESULT WINAPI IWineD3DTextureImpl_SetPrivateData(IWineD3DTexture *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags); + extern HRESULT WINAPI IWineD3DTextureImpl_GetPrivateData(IWineD3DTexture *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData); + extern HRESULT WINAPI IWineD3DTextureImpl_FreePrivateData(IWineD3DTexture *iface, REFGUID refguid); + extern DWORD WINAPI IWineD3DTextureImpl_SetPriority(IWineD3DTexture *iface, DWORD PriorityNew); + extern DWORD WINAPI IWineD3DTextureImpl_GetPriority(IWineD3DTexture *iface); + extern void WINAPI IWineD3DTextureImpl_PreLoad(IWineD3DTexture *iface); + extern D3DRESOURCETYPE WINAPI IWineD3DTextureImpl_GetType(IWineD3DTexture *iface); + /*** IWineD3DBaseTexture methods ***/ + extern DWORD WINAPI IWineD3DTextureImpl_SetLOD(IWineD3DTexture *iface, DWORD LODNew); + extern DWORD WINAPI IWineD3DTextureImpl_GetLOD(IWineD3DTexture *iface); + extern DWORD WINAPI IWineD3DTextureImpl_GetLevelCount(IWineD3DTexture *iface); + extern HRESULT WINAPI IWineD3DTextureImpl_SetAutoGenFilterType(IWineD3DTexture *iface, D3DTEXTUREFILTERTYPE FilterType); + extern D3DTEXTUREFILTERTYPE WINAPI IWineD3DTextureImpl_GetAutoGenFilterType(IWineD3DTexture *iface); + extern void WINAPI IWineD3DTextureImpl_GenerateMipSubLevels(IWineD3DTexture *iface); + extern BOOL WINAPI IWineD3DTextureImpl_SetDirty(IWineD3DTexture *iface, BOOL); + extern BOOL WINAPI IWineD3DTextureImpl_GetDirty(IWineD3DTexture *iface); + /*** IWineD3DTexture methods ***/ + extern HRESULT WINAPI IWineD3DTextureImpl_GetLevelDesc(IWineD3DTexture *iface, UINT Level, WINED3DSURFACE_DESC* pDesc); + extern HRESULT WINAPI IWineD3DTextureImpl_GetSurfaceLevel(IWineD3DTexture *iface, UINT Level, IWineD3DSurface** ppSurfaceLevel); + extern HRESULT WINAPI IWineD3DTextureImpl_LockRect(IWineD3DTexture *iface, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags); + extern HRESULT WINAPI IWineD3DTextureImpl_UnlockRect(IWineD3DTexture *iface, UINT Level); + extern HRESULT WINAPI IWineD3DTextureImpl_AddDirtyRect(IWineD3DTexture *iface, CONST RECT* pDirtyRect); + + /*** IUnknown methods ***/ + extern HRESULT WINAPI IWineD3DCubeTextureImpl_QueryInterface(IWineD3DCubeTexture *iface, REFIID riid, void** ppvObject); + extern ULONG WINAPI IWineD3DCubeTextureImpl_AddRef(IWineD3DCubeTexture *iface); + extern ULONG WINAPI IWineD3DCubeTextureImpl_Release(IWineD3DCubeTexture *iface); + /*** IWineD3DResource methods ***/ + extern HRESULT WINAPI IWineD3DCubeTextureImpl_GetParent(IWineD3DCubeTexture *iface, IUnknown **pParent); + extern HRESULT WINAPI IWineD3DCubeTextureImpl_GetDevice(IWineD3DCubeTexture *iface, IWineD3DDevice ** ppDevice); + extern HRESULT WINAPI IWineD3DCubeTextureImpl_SetPrivateData(IWineD3DCubeTexture *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags); + extern HRESULT WINAPI IWineD3DCubeTextureImpl_GetPrivateData(IWineD3DCubeTexture *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData); + extern HRESULT WINAPI IWineD3DCubeTextureImpl_FreePrivateData(IWineD3DCubeTexture *iface, REFGUID refguid); + extern DWORD WINAPI IWineD3DCubeTextureImpl_SetPriority(IWineD3DCubeTexture *iface, DWORD PriorityNew); + extern DWORD WINAPI IWineD3DCubeTextureImpl_GetPriority(IWineD3DCubeTexture *iface); + extern void WINAPI IWineD3DCubeTextureImpl_PreLoad(IWineD3DCubeTexture *iface); + extern D3DRESOURCETYPE WINAPI IWineD3DCubeTextureImpl_GetType(IWineD3DCubeTexture *iface); + /*** IWineD3DBaseTexture methods ***/ + extern DWORD WINAPI IWineD3DCubeTextureImpl_SetLOD(IWineD3DCubeTexture *iface, DWORD LODNew); + extern DWORD WINAPI IWineD3DCubeTextureImpl_GetLOD(IWineD3DCubeTexture *iface); + extern DWORD WINAPI IWineD3DCubeTextureImpl_GetLevelCount(IWineD3DCubeTexture *iface); + extern HRESULT WINAPI IWineD3DCubeTextureImpl_SetAutoGenFilterType(IWineD3DCubeTexture *iface, D3DTEXTUREFILTERTYPE FilterType); + extern D3DTEXTUREFILTERTYPE WINAPI IWineD3DCubeTextureImpl_GetAutoGenFilterType(IWineD3DCubeTexture *iface); + extern void WINAPI IWineD3DCubeTextureImpl_GenerateMipSubLevels(IWineD3DCubeTexture *iface); + extern BOOL WINAPI IWineD3DCubeTextureImpl_SetDirty(IWineD3DCubeTexture *iface, BOOL); + extern BOOL WINAPI IWineD3DCubeTextureImpl_GetDirty(IWineD3DCubeTexture *iface); + /*** IWineD3DCubeTexture methods ***/ + extern HRESULT WINAPI IWineD3DCubeTextureImpl_GetLevelDesc(IWineD3DCubeTexture *iface, UINT Level,WINED3DSURFACE_DESC* pDesc); + extern HRESULT WINAPI IWineD3DCubeTextureImpl_GetCubeMapSurface(IWineD3DCubeTexture *iface, D3DCUBEMAP_FACES FaceType, UINT Level, IWineD3DSurface** ppCubeMapSurface); + extern HRESULT WINAPI IWineD3DCubeTextureImpl_LockRect(IWineD3DCubeTexture *iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags); + extern HRESULT WINAPI IWineD3DCubeTextureImpl_UnlockRect(IWineD3DCubeTexture *iface, D3DCUBEMAP_FACES FaceType, UINT Level); + extern HRESULT WINAPI IWineD3DCubeTextureImpl_AddDirtyRect(IWineD3DCubeTexture *iface, D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect); + + /*** IUnknown methods ***/ + extern HRESULT WINAPI IWineD3DVolumeTextureImpl_QueryInterface(IWineD3DVolumeTexture *iface, REFIID riid, void** ppvObject); + extern ULONG WINAPI IWineD3DVolumeTextureImpl_AddRef(IWineD3DVolumeTexture *iface); + extern ULONG WINAPI IWineD3DVolumeTextureImpl_Release(IWineD3DVolumeTexture *iface); + /*** IWineD3DResource methods ***/ + extern HRESULT WINAPI IWineD3DVolumeTextureImpl_GetParent(IWineD3DVolumeTexture *iface, IUnknown **pParent); + extern HRESULT WINAPI IWineD3DVolumeTextureImpl_GetDevice(IWineD3DVolumeTexture *iface, IWineD3DDevice ** ppDevice); + extern HRESULT WINAPI IWineD3DVolumeTextureImpl_SetPrivateData(IWineD3DVolumeTexture *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags); + extern HRESULT WINAPI IWineD3DVolumeTextureImpl_GetPrivateData(IWineD3DVolumeTexture *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData); + extern HRESULT WINAPI IWineD3DVolumeTextureImpl_FreePrivateData(IWineD3DVolumeTexture *iface, REFGUID refguid); + extern DWORD WINAPI IWineD3DVolumeTextureImpl_SetPriority(IWineD3DVolumeTexture *iface, DWORD PriorityNew); + extern DWORD WINAPI IWineD3DVolumeTextureImpl_GetPriority(IWineD3DVolumeTexture *iface); + extern void WINAPI IWineD3DVolumeTextureImpl_PreLoad(IWineD3DVolumeTexture *iface); + extern D3DRESOURCETYPE WINAPI IWineD3DVolumeTextureImpl_GetType(IWineD3DVolumeTexture *iface); + /*** IWineD3DBaseTexture methods ***/ + extern DWORD WINAPI IWineD3DVolumeTextureImpl_SetLOD(IWineD3DVolumeTexture *iface, DWORD LODNew); + extern DWORD WINAPI IWineD3DVolumeTextureImpl_GetLOD(IWineD3DVolumeTexture *iface); + extern DWORD WINAPI IWineD3DVolumeTextureImpl_GetLevelCount(IWineD3DVolumeTexture *iface); + extern HRESULT WINAPI IWineD3DVolumeTextureImpl_SetAutoGenFilterType(IWineD3DVolumeTexture *iface, D3DTEXTUREFILTERTYPE FilterType); + extern D3DTEXTUREFILTERTYPE WINAPI IWineD3DVolumeTextureImpl_GetAutoGenFilterType(IWineD3DVolumeTexture *iface); + extern void WINAPI IWineD3DVolumeTextureImpl_GenerateMipSubLevels(IWineD3DVolumeTexture *iface); + extern BOOL WINAPI IWineD3DVolumeTextureImpl_SetDirty(IWineD3DVolumeTexture *iface, BOOL); + extern BOOL WINAPI IWineD3DVolumeTextureImpl_GetDirty(IWineD3DVolumeTexture *iface); + /*** IWineD3DVolumeTexture methods ***/ + extern HRESULT WINAPI IWineD3DVolumeTextureImpl_GetLevelDesc(IWineD3DVolumeTexture *iface, UINT Level, WINED3DVOLUME_DESC *pDesc); + extern HRESULT WINAPI IWineD3DVolumeTextureImpl_GetVolumeLevel(IWineD3DVolumeTexture *iface, UINT Level, IWineD3DVolume** ppVolumeLevel); + extern HRESULT WINAPI IWineD3DVolumeTextureImpl_LockBox(IWineD3DVolumeTexture *iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags); + extern HRESULT WINAPI IWineD3DVolumeTextureImpl_UnlockBox(IWineD3DVolumeTexture *iface, UINT Level); + extern HRESULT WINAPI IWineD3DVolumeTextureImpl_AddDirtyBox(IWineD3DVolumeTexture *iface, CONST D3DBOX* pDirtyBox); + + /*** IUnknown methods ***/ + extern HRESULT WINAPI IWineD3DSurfaceImpl_QueryInterface(IWineD3DSurface *iface, REFIID riid, void** ppvObject); + extern ULONG WINAPI IWineD3DSurfaceImpl_AddRef(IWineD3DSurface *iface); + extern ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface); + /*** IWineD3DResource methods ***/ + extern HRESULT WINAPI IWineD3DSurfaceImpl_GetParent(IWineD3DSurface *iface, IUnknown **pParent); + extern HRESULT WINAPI IWineD3DSurfaceImpl_GetDevice(IWineD3DSurface *iface, IWineD3DDevice ** ppDevice); + extern HRESULT WINAPI IWineD3DSurfaceImpl_SetPrivateData(IWineD3DSurface *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags); + extern HRESULT WINAPI IWineD3DSurfaceImpl_GetPrivateData(IWineD3DSurface *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData); + extern HRESULT WINAPI IWineD3DSurfaceImpl_FreePrivateData(IWineD3DSurface *iface, REFGUID refguid); + extern DWORD WINAPI IWineD3DSurfaceImpl_SetPriority(IWineD3DSurface *iface, DWORD PriorityNew); + extern DWORD WINAPI IWineD3DSurfaceImpl_GetPriority(IWineD3DSurface *iface); + extern void WINAPI IWineD3DSurfaceImpl_PreLoad(IWineD3DSurface *iface); + extern D3DRESOURCETYPE WINAPI IWineD3DSurfaceImpl_GetType(IWineD3DSurface *iface); + /*** IWineD3DSurface methods ***/ + extern HRESULT WINAPI IWineD3DSurfaceImpl_GetContainer(IWineD3DSurface *iface, REFIID riid, void ** ppContainer); + extern HRESULT WINAPI IWineD3DSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFACE_DESC * pDesc); + extern HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RECT * pLockedRect, CONST RECT * pRect,DWORD Flags); + extern HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface); + extern HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHdc); + extern HRESULT WINAPI IWineD3DSurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC hdc); + /* Internally used methods */ + extern HRESULT WINAPI IWineD3DSurfaceImpl_CleanDirtyRect(IWineD3DSurface *iface); + extern HRESULT WINAPI IWineD3DSurfaceImpl_AddDirtyRect(IWineD3DSurface *iface, CONST RECT* pRect); + extern HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, UINT gl_target, UINT gl_level); + extern HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, const char *filename); + + /*** IUnknown methods ***/ + extern HRESULT WINAPI IWineD3DVolumeImpl_QueryInterface(IWineD3DVolume *iface, REFIID riid, void** ppvObject); + extern ULONG WINAPI IWineD3DVolumeImpl_AddRef(IWineD3DVolume *iface); + extern ULONG WINAPI IWineD3DVolumeImpl_Release(IWineD3DVolume *iface); + /*** IWineD3DVolume methods ***/ + extern HRESULT WINAPI IWineD3DVolumeImpl_GetParent(IWineD3DVolume *iface, IUnknown **pParent); + extern HRESULT WINAPI IWineD3DVolumeImpl_GetDevice(IWineD3DVolume *iface, IWineD3DDevice ** ppDevice); + extern HRESULT WINAPI IWineD3DVolumeImpl_SetPrivateData(IWineD3DVolume *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags); + extern HRESULT WINAPI IWineD3DVolumeImpl_GetPrivateData(IWineD3DVolume *iface, REFGUID refguid, void * pData, DWORD * pSizeOfData); + extern HRESULT WINAPI IWineD3DVolumeImpl_FreePrivateData(IWineD3DVolume *iface, REFGUID refguid); + extern HRESULT WINAPI IWineD3DVolumeImpl_GetContainer(IWineD3DVolume *iface, REFIID riid, void ** ppContainer); + extern HRESULT WINAPI IWineD3DVolumeImpl_GetDesc(IWineD3DVolume *iface, WINED3DVOLUME_DESC * pDesc); + extern HRESULT WINAPI IWineD3DVolumeImpl_LockBox(IWineD3DVolume *iface, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags); + extern HRESULT WINAPI IWineD3DVolumeImpl_UnlockBox(IWineD3DVolume *iface); + extern HRESULT WINAPI IWineD3DVolumeImpl_AddDirtyBox(IWineD3DVolume *iface, CONST D3DBOX* pDirtyBox); + extern HRESULT WINAPI IWineD3DVolumeImpl_CleanDirtyBox(IWineD3DVolume *iface); + + /*** IUnknown methods ***/ + extern HRESULT WINAPI IWineD3DStateBlockImpl_QueryInterface(IWineD3DStateBlock *iface, REFIID riid, void** ppvObject); + extern ULONG WINAPI IWineD3DStateBlockImpl_AddRef(IWineD3DStateBlock *iface); + extern ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface); + /*** IWineD3DStateBlock methods ***/ + extern HRESULT WINAPI IWineD3DStateBlockImpl_GetParent(IWineD3DStateBlock *iface, IUnknown **pParent); + extern HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStateBlock *iface); + #if 0 /* Needs fixing during rework */ /***************************************************************************** Index: wine/dlls/wined3d/vertexbuffer.c diff -u -p wine/dlls/wined3d/vertexbuffer.c:1.6 wine/dlls/wined3d/vertexbuffer.c:1.7 --- wine/dlls/wined3d/vertexbuffer.c:1.6 Sun May 19 15:10:15 2013 +++ wine/dlls/wined3d/vertexbuffer.c Sun May 19 15:10:15 2013 @@ -62,39 +62,39 @@ ULONG WINAPI IWineD3DVertexBufferImpl_Re IWineD3DVertexBuffer IWineD3DResource parts follow **************************************************** */ HRESULT WINAPI IWineD3DVertexBufferImpl_GetDevice(IWineD3DVertexBuffer *iface, IWineD3DDevice** ppDevice) { - return IWineD3DResource_GetDevice((IWineD3DResource *)iface, ppDevice); + return IWineD3DResourceImpl_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); + return IWineD3DResourceImpl_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); + return IWineD3DResourceImpl_GetPrivateData((IWineD3DResource *)iface, refguid, pData, pSizeOfData); } HRESULT WINAPI IWineD3DVertexBufferImpl_FreePrivateData(IWineD3DVertexBuffer *iface, REFGUID refguid) { - return IWineD3DResource_FreePrivateData((IWineD3DResource *)iface, refguid); + return IWineD3DResourceImpl_FreePrivateData((IWineD3DResource *)iface, refguid); } DWORD WINAPI IWineD3DVertexBufferImpl_SetPriority(IWineD3DVertexBuffer *iface, DWORD PriorityNew) { - return IWineD3DResource_SetPriority((IWineD3DResource *)iface, PriorityNew); + return IWineD3DResourceImpl_SetPriority((IWineD3DResource *)iface, PriorityNew); } DWORD WINAPI IWineD3DVertexBufferImpl_GetPriority(IWineD3DVertexBuffer *iface) { - return IWineD3DResource_GetPriority((IWineD3DResource *)iface); + return IWineD3DResourceImpl_GetPriority((IWineD3DResource *)iface); } void WINAPI IWineD3DVertexBufferImpl_PreLoad(IWineD3DVertexBuffer *iface) { - return IWineD3DResource_PreLoad((IWineD3DResource *)iface); + return IWineD3DResourceImpl_PreLoad((IWineD3DResource *)iface); } D3DRESOURCETYPE WINAPI IWineD3DVertexBufferImpl_GetType(IWineD3DVertexBuffer *iface) { - return IWineD3DResource_GetType((IWineD3DResource *)iface); + return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface); } HRESULT WINAPI IWineD3DVertexBufferImpl_GetParent(IWineD3DVertexBuffer *iface, IUnknown **pParent) { - return IWineD3DResource_GetParent((IWineD3DResource *)iface, pParent); + return IWineD3DResourceImpl_GetParent((IWineD3DResource *)iface, pParent); } /* ****************************************************** Index: wine/dlls/wined3d/utils.c diff -u -p wine/dlls/wined3d/utils.c:1.5 wine/dlls/wined3d/utils.c:1.6 --- wine/dlls/wined3d/utils.c:1.5 Sun May 19 15:10:15 2013 +++ wine/dlls/wined3d/utils.c Sun May 19 15:10:15 2013 @@ -271,6 +271,19 @@ const char* debug_d3dtexturestate(DWORD } } +const char* debug_d3dpool(D3DPOOL Pool) { + switch (Pool) { +#define POOL_TO_STR(p) case p: return #p; + POOL_TO_STR(D3DPOOL_DEFAULT); + POOL_TO_STR(D3DPOOL_MANAGED); + POOL_TO_STR(D3DPOOL_SYSTEMMEM); + POOL_TO_STR(D3DPOOL_SCRATCH); +#undef POOL_TO_STR + default: + FIXME("Unrecognized %u D3DPOOL!\n", Pool); + return "unrecognized"; + } +} /***************************************************************************** * Useful functions mapping GL <-> D3D values */ Index: wine/dlls/wined3d/surface.c diff -u -p wine/dlls/wined3d/surface.c:1.1 wine/dlls/wined3d/surface.c:1.2 --- wine/dlls/wined3d/surface.c:1.1 Sun May 19 15:10:15 2013 +++ wine/dlls/wined3d/surface.c Sun May 19 15:10:15 2013 @@ -62,39 +62,39 @@ ULONG WINAPI IWineD3DSurfaceImpl_Release IWineD3DSurface IWineD3DResource parts follow **************************************************** */ HRESULT WINAPI IWineD3DSurfaceImpl_GetDevice(IWineD3DSurface *iface, IWineD3DDevice** ppDevice) { - return IWineD3DResource_GetDevice((IWineD3DResource *)iface, ppDevice); + return IWineD3DResourceImpl_GetDevice((IWineD3DResource *)iface, ppDevice); } HRESULT WINAPI IWineD3DSurfaceImpl_SetPrivateData(IWineD3DSurface *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { - return IWineD3DResource_SetPrivateData((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags); + return IWineD3DResourceImpl_SetPrivateData((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags); } HRESULT WINAPI IWineD3DSurfaceImpl_GetPrivateData(IWineD3DSurface *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { - return IWineD3DResource_GetPrivateData((IWineD3DResource *)iface, refguid, pData, pSizeOfData); + return IWineD3DResourceImpl_GetPrivateData((IWineD3DResource *)iface, refguid, pData, pSizeOfData); } HRESULT WINAPI IWineD3DSurfaceImpl_FreePrivateData(IWineD3DSurface *iface, REFGUID refguid) { - return IWineD3DResource_FreePrivateData((IWineD3DResource *)iface, refguid); + return IWineD3DResourceImpl_FreePrivateData((IWineD3DResource *)iface, refguid); } DWORD WINAPI IWineD3DSurfaceImpl_SetPriority(IWineD3DSurface *iface, DWORD PriorityNew) { - return IWineD3DResource_SetPriority((IWineD3DResource *)iface, PriorityNew); + return IWineD3DResourceImpl_SetPriority((IWineD3DResource *)iface, PriorityNew); } DWORD WINAPI IWineD3DSurfaceImpl_GetPriority(IWineD3DSurface *iface) { - return IWineD3DResource_GetPriority((IWineD3DResource *)iface); + return IWineD3DResourceImpl_GetPriority((IWineD3DResource *)iface); } void WINAPI IWineD3DSurfaceImpl_PreLoad(IWineD3DSurface *iface) { - return IWineD3DResource_PreLoad((IWineD3DResource *)iface); + return IWineD3DResourceImpl_PreLoad((IWineD3DResource *)iface); } D3DRESOURCETYPE WINAPI IWineD3DSurfaceImpl_GetType(IWineD3DSurface *iface) { - return IWineD3DResource_GetType((IWineD3DResource *)iface); + return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface); } HRESULT WINAPI IWineD3DSurfaceImpl_GetParent(IWineD3DSurface *iface, IUnknown **pParent) { - return IWineD3DResource_GetParent((IWineD3DResource *)iface, pParent); + return IWineD3DResourceImpl_GetParent((IWineD3DResource *)iface, pParent); } /* ****************************************************** @@ -124,6 +124,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDe *(pDesc->Type) = This->currentDesc.Type; *(pDesc->Usage) = This->currentDesc.Usage; *(pDesc->Pool) = This->currentDesc.Pool; + *(pDesc->Size) = This->currentDesc.Size; /* dx8 only */ *(pDesc->MultiSampleType) = This->currentDesc.MultiSampleType; *(pDesc->MultiSampleQuality) = This->currentDesc.MultiSampleQuality; *(pDesc->Width) = This->currentDesc.Width; @@ -727,6 +728,8 @@ HRESULT WINAPI IWineD3DSurfaceImpl_Clean This->dirtyRect.top = This->currentDesc.Height; This->dirtyRect.right = 0; This->dirtyRect.bottom = 0; + TRACE("(%p) : Dirty?%d, Rect:(%ld,%ld,%ld,%ld)\n", This, This->Dirty, This->dirtyRect.left, + This->dirtyRect.top, This->dirtyRect.right, This->dirtyRect.bottom); return D3D_OK; } @@ -747,6 +750,8 @@ extern HRESULT WINAPI IWineD3DSurfaceImp This->dirtyRect.right = This->currentDesc.Width; This->dirtyRect.bottom = This->currentDesc.Height; } + TRACE("(%p) : Dirty?%d, Rect:(%ld,%ld,%ld,%ld)\n", This, This->Dirty, This->dirtyRect.left, + This->dirtyRect.top, This->dirtyRect.right, This->dirtyRect.bottom); return D3D_OK; } Index: wine/dlls/wined3d/indexbuffer.c diff -u -p wine/dlls/wined3d/indexbuffer.c:1.4 wine/dlls/wined3d/indexbuffer.c:1.5 --- wine/dlls/wined3d/indexbuffer.c:1.4 Sun May 19 15:10:15 2013 +++ wine/dlls/wined3d/indexbuffer.c Sun May 19 15:10:15 2013 @@ -62,39 +62,39 @@ ULONG WINAPI IWineD3DIndexBufferImpl_Rel IWineD3DIndexBuffer IWineD3DResource parts follow **************************************************** */ HRESULT WINAPI IWineD3DIndexBufferImpl_GetDevice(IWineD3DIndexBuffer *iface, IWineD3DDevice** ppDevice) { - return IWineD3DResource_GetDevice((IWineD3DResource *)iface, ppDevice); + return IWineD3DResourceImpl_GetDevice((IWineD3DResource *)iface, ppDevice); } HRESULT WINAPI IWineD3DIndexBufferImpl_SetPrivateData(IWineD3DIndexBuffer *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { - return IWineD3DResource_SetPrivateData((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags); + return IWineD3DResourceImpl_SetPrivateData((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags); } HRESULT WINAPI IWineD3DIndexBufferImpl_GetPrivateData(IWineD3DIndexBuffer *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { - return IWineD3DResource_GetPrivateData((IWineD3DResource *)iface, refguid, pData, pSizeOfData); + return IWineD3DResourceImpl_GetPrivateData((IWineD3DResource *)iface, refguid, pData, pSizeOfData); } HRESULT WINAPI IWineD3DIndexBufferImpl_FreePrivateData(IWineD3DIndexBuffer *iface, REFGUID refguid) { - return IWineD3DResource_FreePrivateData((IWineD3DResource *)iface, refguid); + return IWineD3DResourceImpl_FreePrivateData((IWineD3DResource *)iface, refguid); } DWORD WINAPI IWineD3DIndexBufferImpl_SetPriority(IWineD3DIndexBuffer *iface, DWORD PriorityNew) { - return IWineD3DResource_SetPriority((IWineD3DResource *)iface, PriorityNew); + return IWineD3DResourceImpl_SetPriority((IWineD3DResource *)iface, PriorityNew); } DWORD WINAPI IWineD3DIndexBufferImpl_GetPriority(IWineD3DIndexBuffer *iface) { - return IWineD3DResource_GetPriority((IWineD3DResource *)iface); + return IWineD3DResourceImpl_GetPriority((IWineD3DResource *)iface); } void WINAPI IWineD3DIndexBufferImpl_PreLoad(IWineD3DIndexBuffer *iface) { - return IWineD3DResource_PreLoad((IWineD3DResource *)iface); + return IWineD3DResourceImpl_PreLoad((IWineD3DResource *)iface); } D3DRESOURCETYPE WINAPI IWineD3DIndexBufferImpl_GetType(IWineD3DIndexBuffer *iface) { - return IWineD3DResource_GetType((IWineD3DResource *)iface); + return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface); } HRESULT WINAPI IWineD3DIndexBufferImpl_GetParent(IWineD3DIndexBuffer *iface, IUnknown **pParent) { - return IWineD3DResource_GetParent((IWineD3DResource *)iface, pParent); + return IWineD3DResourceImpl_GetParent((IWineD3DResource *)iface, pParent); } /* ****************************************************** Index: wine/dlls/wined3d/drawprim.c diff -u -p wine/dlls/wined3d/drawprim.c:1.4 wine/dlls/wined3d/drawprim.c:1.5 --- wine/dlls/wined3d/drawprim.c:1.4 Sun May 19 15:10:15 2013 +++ wine/dlls/wined3d/drawprim.c Sun May 19 15:10:15 2013 @@ -649,9 +649,7 @@ void draw_vertex(IWineD3DDevice *iface, void drawStridedFast(IWineD3DDevice *iface, Direct3DVertexStridedData *sd, int PrimitiveType, ULONG NumPrimitives, const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx) { -#if 0 /* TODO: Texture support */ unsigned int textureNo = 0; -#endif GLenum glPrimType = GL_POINTS; int NumVertexes = NumPrimitives; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; @@ -806,47 +804,32 @@ void drawStridedFast(IWineD3DDevice *ifa } /* Texture coords -------------------------------------------*/ -#if 0 /* TODO: Texture support */ for (textureNo = 0; textureNo < GL_LIMITS(textures); ++textureNo) { /* Select the correct texture stage */ -#if defined(GL_VERSION_1_3) - glClientActiveTexture(GL_TEXTURE0 + textureNo); -#else - glClientActiveTextureARB(GL_TEXTURE0_ARB + textureNo); -#endif + GLCLIENTACTIVETEXTURE(textureNo); /* Query tex coords */ if (This->stateBlock->textures[textureNo] != NULL) { - int coordIdx = This->updateStateBlock->texture_state[textureNo][D3DTSS_TEXCOORDINDEX]; + int coordIdx = This->updateStateBlock->textureState[textureNo][D3DTSS_TEXCOORDINDEX]; if (!GL_SUPPORT(ARB_MULTITEXTURE) && textureNo > 0) { FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n"); glDisableClientState(GL_TEXTURE_COORD_ARRAY); -#if defined(GL_VERSION_1_3) - glMultiTexCoord4f(GL_TEXTURE0 + textureNo, 0, 0, 0, 1); -#else - glMultiTexCoord4fARB(GL_TEXTURE0_ARB + textureNo, 0, 0, 0, 1); -#endif + GLMULTITEXCOORD4F(textureNo, 0, 0, 0, 1); continue; } if (coordIdx > 7) { VTRACE(("tex: %d - Skip tex coords, as being system generated\n", textureNo)); glDisableClientState(GL_TEXTURE_COORD_ARRAY); -#if defined(GL_VERSION_1_3) - glMultiTexCoord4f(GL_TEXTURE0 + textureNo, 0, 0, 0, 1); -#else - glMultiTexCoord4fARB(GL_TEXTURE0_ARB + textureNo, 0, 0, 0, 1); -#endif + GLMULTITEXCOORD4F(textureNo, 0, 0, 0, 1); + } else if (sd->u.s.texCoords[coordIdx].lpData == NULL) { VTRACE(("Bound texture but no texture coordinates supplied, so skipping\n")); glDisableClientState(GL_TEXTURE_COORD_ARRAY); -#if defined(GL_VERSION_1_3) - glMultiTexCoord4f(GL_TEXTURE0 + textureNo, 0, 0, 0, 1); -#else - glMultiTexCoord4fARB(GL_TEXTURE0_ARB + textureNo, 0, 0, 0, 1); -#endif + GLMULTITEXCOORD4F(textureNo, 0, 0, 0, 1); + } else { /* The coords to supply depend completely on the fvf / vertex shader */ @@ -870,14 +853,9 @@ void drawStridedFast(IWineD3DDevice *ifa } } else { glDisableClientState(GL_TEXTURE_COORD_ARRAY); -#if defined(GL_VERSION_1_3) - glMultiTexCoord4f(GL_TEXTURE0 + textureNo, 0, 0, 0, 1); -#else - glMultiTexCoord4fARB(GL_TEXTURE0_ARB + textureNo, 0, 0, 0, 1); -#endif + GLMULTITEXCOORD4F(textureNo, 0, 0, 0, 1); } } -#endif /* TODO: Texture support */ /* Ok, Work out which primitive is requested and how many vertexes that will be */ @@ -915,9 +893,7 @@ void drawStridedSlow(IWineD3DDevice *ifa int PrimitiveType, ULONG NumPrimitives, const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx) { -#if 0 /* TODO: Texture support */ unsigned int textureNo = 0; -#endif GLenum glPrimType = GL_POINTS; int NumVertexes = NumPrimitives; const short *pIdxBufS = NULL; @@ -1029,7 +1005,6 @@ void drawStridedSlow(IWineD3DDevice *ifa } /* Texture coords --------------------------- */ -#if 0 /* TODO: Texture support */ for (textureNo = 0; textureNo < GL_LIMITS(textures); ++textureNo) { if (!GL_SUPPORT(ARB_MULTITEXTURE) && textureNo > 0) { @@ -1040,7 +1015,7 @@ void drawStridedSlow(IWineD3DDevice *ifa /* Query tex coords */ if (This->stateBlock->textures[textureNo] != NULL) { - int coordIdx = This->updateStateBlock->texture_state[textureNo][D3DTSS_TEXCOORDINDEX]; + int coordIdx = This->updateStateBlock->textureState[textureNo][D3DTSS_TEXCOORDINDEX]; float *ptrToCoords = (float *)(sd->u.s.texCoords[coordIdx].lpData + (SkipnStrides * sd->u.s.texCoords[coordIdx].dwStride)); float s = 0.0, t = 0.0, r = 0.0, q = 0.0; @@ -1064,10 +1039,10 @@ void drawStridedSlow(IWineD3DDevice *ifa /* Projected is more 'fun' - Move the last coord to the 'q' parameter (see comments under D3DTSS_TEXTURETRANSFORMFLAGS */ - if ((This->updateStateBlock->texture_state[textureNo][D3DTSS_TEXTURETRANSFORMFLAGS] != D3DTTFF_DISABLE) && - (This->updateStateBlock->texture_state[textureNo][D3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED)) { + if ((This->updateStateBlock->textureState[textureNo][D3DTSS_TEXTURETRANSFORMFLAGS] != D3DTTFF_DISABLE) && + (This->updateStateBlock->textureState[textureNo][D3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED)) { - if (This->updateStateBlock->texture_state[textureNo][D3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED) { + if (This->updateStateBlock->textureState[textureNo][D3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED) { switch (coordsToUse) { case 0: /* Drop Through */ case 1: @@ -1087,7 +1062,7 @@ void drawStridedSlow(IWineD3DDevice *ifa break; default: FIXME("Unexpected D3DTSS_TEXTURETRANSFORMFLAGS value of %ld\n", - This->updateStateBlock->texture_state[textureNo][D3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED); + This->updateStateBlock->textureState[textureNo][D3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED); } } } @@ -1096,11 +1071,7 @@ void drawStridedSlow(IWineD3DDevice *ifa case D3DTTFF_COUNT1: VTRACE(("tex:%d, s=%f\n", textureNo, s)); if (GL_SUPPORT(ARB_MULTITEXTURE)) { -#if defined(GL_VERSION_1_3) - glMultiTexCoord1f(GL_TEXTURE0 + textureNo, s); -#else - glMultiTexCoord1fARB(GL_TEXTURE0_ARB + textureNo, s); -#endif + GLMULTITEXCOORD1F(textureNo, s); } else { glTexCoord1f(s); } @@ -1108,11 +1079,7 @@ void drawStridedSlow(IWineD3DDevice *ifa case D3DTTFF_COUNT2: VTRACE(("tex:%d, s=%f, t=%f\n", textureNo, s, t)); if (GL_SUPPORT(ARB_MULTITEXTURE)) { -#if defined(GL_VERSION_1_3) - glMultiTexCoord2f(GL_TEXTURE0 + textureNo, s, t); -#else - glMultiTexCoord2fARB(GL_TEXTURE0_ARB + textureNo, s, t); -#endif + GLMULTITEXCOORD2F(textureNo, s, t); } else { glTexCoord2f(s, t); } @@ -1120,11 +1087,7 @@ void drawStridedSlow(IWineD3DDevice *ifa case D3DTTFF_COUNT3: VTRACE(("tex:%d, s=%f, t=%f, r=%f\n", textureNo, s, t, r)); if (GL_SUPPORT(ARB_MULTITEXTURE)) { -#if defined(GL_VERSION_1_3) - glMultiTexCoord3f(GL_TEXTURE0 + textureNo, s, t, r); -#else - glMultiTexCoord3fARB(GL_TEXTURE0_ARB + textureNo, s, t, r); -#endif + GLMULTITEXCOORD3F(textureNo, s, t, r); } else { glTexCoord3f(s, t, r); } @@ -1132,11 +1095,7 @@ void drawStridedSlow(IWineD3DDevice *ifa case D3DTTFF_COUNT4: VTRACE(("tex:%d, s=%f, t=%f, r=%f, q=%f\n", textureNo, s, t, r, q)); if (GL_SUPPORT(ARB_MULTITEXTURE)) { -#if defined(GL_VERSION_1_3) - glMultiTexCoord4f(GL_TEXTURE0 + textureNo, s, t, r, q); -#else - glMultiTexCoord4fARB(GL_TEXTURE0_ARB + textureNo, s, t, r, q); -#endif + GLMULTITEXCOORD4F(textureNo, s, t, r, q); } else { glTexCoord4f(s, t, r, q); } @@ -1147,7 +1106,6 @@ void drawStridedSlow(IWineD3DDevice *ifa } } } /* End of textures */ -#endif /* TODO: Texture support */ /* Diffuse -------------------------------- */ if (sd->u.s.diffuse.lpData != NULL) { @@ -1458,9 +1416,9 @@ void drawPrimitive(IWineD3DDevice *iface #if 0 /* TODO: vertex and pixel shaders */ IDirect3DVertexShaderImpl *vertex_shader = NULL; IDirect3DPixelShaderImpl *pixel_shader = NULL; - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - unsigned int i; #endif + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + unsigned int i; BOOL useVertexShaderFunction = FALSE; BOOL isLightingOn = FALSE; Direct3DVertexStridedData dataLocations; @@ -1560,19 +1518,17 @@ void drawPrimitive(IWineD3DDevice *iface init_materials(iface, (dataLocations.u.s.diffuse.lpData != NULL)); -#if 0 /* TODO: Texture support */ /* And re-upload any dirty textures */ for (i=0; istateBlock->textures[i] != NULL) && - (IWineD3DBaseTextureImpl_IsDirty(This->stateBlock->textures[i]))) + (IWineD3DBaseTexture_GetDirty(This->stateBlock->textures[i]))) { /* Load up the texture now */ - IWineD3DTextureImpl_PreLoad((IWineD3DTexture8 *) This->stateBlock->textures[i]); + IWineD3DTexture_PreLoad((IWineD3DTexture *) This->stateBlock->textures[i]); /* TODO: Is this right, as its cast all texture types to texture8... checkme */ } } -#endif /* Now draw the graphics to the screen */ if (useVertexShaderFunction) { Index: wine/dlls/wined3d/device.c diff -u -p wine/dlls/wined3d/device.c:1.17 wine/dlls/wined3d/device.c:1.18 --- wine/dlls/wined3d/device.c:1.17 Sun May 19 15:10:15 2013 +++ wine/dlls/wined3d/device.c Sun May 19 15:10:15 2013 @@ -208,6 +208,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetPar return D3D_OK; } +/***** + * Creation of other classes + *****/ HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *iface, UINT Size, DWORD Usage, DWORD FVF, D3DPOOL Pool, IWineD3DVertexBuffer** ppVertexBuffer, HANDLE *sharedHandle, IUnknown *parent) { @@ -347,6 +350,337 @@ HRESULT WINAPI IWineD3DDeviceImpl_Create return D3D_OK; } +HRESULT WINAPI IWineD3DDeviceImpl_CreateOffscreenPlainSurface(IWineD3DDevice *iface, + UINT Width, UINT Height, + D3DFORMAT Format, D3DPOOL Pool, + IWineD3DSurface** ppSurface, + HANDLE* pSharedHandle, IUnknown *parent) { + + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + IWineD3DSurfaceImpl *object; + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DSurfaceImpl)); + if (NULL == object) { + *ppSurface = NULL; + return D3DERR_OUTOFVIDEOMEMORY; + } + + object->lpVtbl = &IWineD3DSurface_Vtbl; + object->resource.wineD3DDevice = This; + IWineD3DDevice_AddRef(iface); + object->resource.resourceType = D3DRTYPE_VOLUME; + object->resource.parent = parent; + object->resource.ref = 1; + *ppSurface = (IWineD3DSurface *)object; + object->container = (IUnknown*) This; + + TRACE("(%p) : W(%d) H(%d), Fmt(%u,%s), Pool(%s)\n", This, Width, Height, + Format, debug_d3dformat(Format), debug_d3dpool(Pool)); + + object->currentDesc.Width = Width; + object->currentDesc.Height = Height; + object->currentDesc.Format = Format; + object->currentDesc.Type = D3DRTYPE_SURFACE; + object->currentDesc.Usage = 0; + object->currentDesc.Pool = Pool; + object->bytesPerPixel = D3DFmtGetBpp(This, Format); + + /* DXTn mipmaps use the same number of 'levels' down to eg. 8x1, but since + it is based around 4x4 pixel blocks it requires padding, so allocate enough + space! */ + if (Format == D3DFMT_DXT1) { + object->currentDesc.Size = ((max(Width,4) * object->bytesPerPixel) * max(Height,4)) / 2; /* DXT1 is half byte per pixel */ + } else if (Format == D3DFMT_DXT2 || Format == D3DFMT_DXT3 || + Format == D3DFMT_DXT4 || Format == D3DFMT_DXT5) { + object->currentDesc.Size = ((max(Width,4) * object->bytesPerPixel) * max(Height,4)); + } else { + object->currentDesc.Size = (Width * object->bytesPerPixel) * Height; + } + object->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, object->currentDesc.Size); + object->lockable = TRUE; + object->locked = FALSE; + object->Dirty = FALSE; + TRACE("(%p) : w(%d) h(%d) fmt(%d,%s) surf@%p, surfmem@%p, %d bytes\n", This, Width, Height, Format, debug_d3dformat(Format), *ppSurface, object->allocatedMemory, object->currentDesc.Size); + + memset(&object->lockedRect, 0, sizeof(RECT)); + return IWineD3DSurface_CleanDirtyRect(*ppSurface); +} + +HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, UINT Width, + UINT Height, UINT Levels, DWORD Usage, + D3DFORMAT Format, D3DPOOL Pool, + IWineD3DTexture** ppTexture, + HANDLE* pSharedHandle, IUnknown *parent, + D3DCB_CREATESURFACEFN D3DCB_CreateSurface) { + + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + IWineD3DTextureImpl *object; + unsigned int i; + UINT tmpW; + UINT tmpH; + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DTextureImpl)); + if (NULL == object) { + *ppTexture = NULL; + return D3DERR_OUTOFVIDEOMEMORY; + } + + object->lpVtbl = &IWineD3DTexture_Vtbl; + object->resource.wineD3DDevice = This; + IWineD3DDevice_AddRef(iface); + object->resource.resourceType = D3DRTYPE_TEXTURE; + object->resource.parent = parent; + object->resource.ref = 1; + *ppTexture = (IWineD3DTexture *)object; + + TRACE("(%p) : W(%d) H(%d), Lvl(%d) Usage(%ld), Fmt(%u,%s), Pool(%s)\n", This, + Width, Height, Levels, Usage, Format, debug_d3dformat(Format), debug_d3dpool(Pool)); + object->width = Width; + object->height = Height; + object->usage = Usage; + object->baseTexture.levels = Levels; + object->baseTexture.format = Format; + + /* Calculate levels for mip mapping */ + if (Levels == 0) { + object->baseTexture.levels++; + tmpW = Width; + tmpH = Height; + while (tmpW > 1 && tmpH > 1) { + tmpW = max(1, tmpW / 2); + tmpH = max(1, tmpH / 2); + object->baseTexture.levels++; + } + TRACE("Calculated levels = %d\n", object->baseTexture.levels); + } + + /* Generate all the surfaces */ + tmpW = Width; + tmpH = Height; + for (i = 0; i < object->baseTexture.levels; i++) + { + D3DCB_CreateSurface(This->parent, tmpW, tmpH, Format, Pool, + (IWineD3DSurface **)&object->surfaces[i], pSharedHandle); + object->surfaces[i]->container = (IUnknown*) object; + object->surfaces[i]->currentDesc.Usage = Usage; + object->surfaces[i]->currentDesc.Pool = Pool; + + /** + * As written in msdn in IDirect3DTexture8::LockRect + * Textures created in D3DPOOL_DEFAULT are not lockable. + */ + if (D3DPOOL_DEFAULT == Pool) { + object->surfaces[i]->lockable = FALSE; + } + + TRACE("Created surface level %d @ %p, memory at %p\n", i, object->surfaces[i], object->surfaces[i]->allocatedMemory); + tmpW = max(1, tmpW / 2); + tmpH = max(1, tmpH / 2); + } + + *ppTexture = (IWineD3DTexture *) object; + TRACE("(%p) : Created texture %p\n", This, object); + return D3D_OK; +} + +HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *iface, + UINT Width, UINT Height, UINT Depth, + UINT Levels, DWORD Usage, + D3DFORMAT Format, D3DPOOL Pool, + IWineD3DVolumeTexture** ppVolumeTexture, + HANDLE* pSharedHandle, IUnknown *parent, + D3DCB_CREATEVOLUMEFN D3DCB_CreateVolume) { + + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + IWineD3DVolumeTextureImpl *object; + unsigned int i; + UINT tmpW; + UINT tmpH; + UINT tmpD; + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DVolumeTextureImpl)); + if (NULL == object) { + *ppVolumeTexture = NULL; + return D3DERR_OUTOFVIDEOMEMORY; + } + + object->lpVtbl = &IWineD3DVolumeTexture_Vtbl; + object->resource.wineD3DDevice = This; + IWineD3DDevice_AddRef(iface); + object->resource.resourceType = D3DRTYPE_VOLUMETEXTURE; + object->resource.parent = parent; + object->resource.ref = 1; + *ppVolumeTexture = (IWineD3DVolumeTexture *)object; + + TRACE("(%p) : W(%d) H(%d) D(%d), Lvl(%d) Usage(%ld), Fmt(%u,%s), Pool(%s)\n", This, Width, Height, + Depth, Levels, Usage, Format, debug_d3dformat(Format), debug_d3dpool(Pool)); + + object->width = Width; + object->height = Height; + object->depth = Depth; + object->usage = Usage; + object->baseTexture.levels = Levels; + object->baseTexture.format = Format; + + /* Calculate levels for mip mapping */ + if (Levels == 0) { + object->baseTexture.levels++; + tmpW = Width; + tmpH = Height; + tmpD = Depth; + while (tmpW > 1 && tmpH > 1 && tmpD > 1) { + tmpW = max(1, tmpW / 2); + tmpH = max(1, tmpH / 2); + tmpD = max(1, tmpD / 2); + object->baseTexture.levels++; + } + TRACE("Calculated levels = %d\n", object->baseTexture.levels); + } + + /* Generate all the surfaces */ + tmpW = Width; + tmpH = Height; + tmpD = Depth; + + for (i = 0; i < object->baseTexture.levels; i++) + { + /* Create the volume - No entry point for this seperately?? */ + D3DCB_CreateVolume(This->parent, Width, Height, Depth, Format, Pool, Usage, + (IWineD3DVolume **)&object->volumes[i], pSharedHandle); + object->volumes[i]->container = (IUnknown*) object; + + tmpW = max(1, tmpW / 2); + tmpH = max(1, tmpH / 2); + tmpD = max(1, tmpD / 2); + } + + *ppVolumeTexture = (IWineD3DVolumeTexture *) object; + TRACE("(%p) : Created volume texture %p\n", This, object); + return D3D_OK; +} + +HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface, + UINT Width, UINT Height, UINT Depth, + DWORD Usage, + D3DFORMAT Format, D3DPOOL Pool, + IWineD3DVolume** ppVolume, + HANDLE* pSharedHandle, IUnknown *parent) { + + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + IWineD3DVolumeImpl *object; + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DVolumeImpl)); + if (NULL == object) { + *ppVolume = NULL; + return D3DERR_OUTOFVIDEOMEMORY; + } + + object->lpVtbl = &IWineD3DVolume_Vtbl; + object->wineD3DDevice = This; + IWineD3DDevice_AddRef(iface); + object->resourceType = D3DRTYPE_VOLUME; + object->parent = parent; + object->ref = 1; + *ppVolume = (IWineD3DVolume *)object; + + TRACE("(%p) : W(%d) H(%d) D(%d), Usage(%ld), Fmt(%u,%s), Pool(%s)\n", This, Width, Height, + Depth, Usage, Format, debug_d3dformat(Format), debug_d3dpool(Pool)); + + object->currentDesc.Width = Width; + object->currentDesc.Height = Height; + object->currentDesc.Depth = Depth; + object->currentDesc.Format = Format; + object->currentDesc.Type = D3DRTYPE_VOLUME; + object->currentDesc.Pool = Pool; + object->currentDesc.Usage = Usage; + object->bytesPerPixel = D3DFmtGetBpp(This, Format); + + /* Note: Volume textures cannot be dxtn, hence no need to check here */ + object->currentDesc.Size = (Width * object->bytesPerPixel) * Height * Depth; + object->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, object->currentDesc.Size); + object->lockable = TRUE; + object->locked = FALSE; + memset(&object->lockedBox, 0, sizeof(D3DBOX)); + object->dirty = FALSE; + return IWineD3DVolume_CleanDirtyBox((IWineD3DVolume *) object); +} + +HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface, UINT EdgeLength, + UINT Levels, DWORD Usage, + D3DFORMAT Format, D3DPOOL Pool, + IWineD3DCubeTexture** ppCubeTexture, + HANDLE* pSharedHandle, IUnknown *parent, + D3DCB_CREATESURFACEFN D3DCB_CreateSurface) { + + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + IWineD3DCubeTextureImpl *object; + unsigned int i,j; + UINT tmpW; + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DCubeTextureImpl)); + if (NULL == object) { + *ppCubeTexture = NULL; + return D3DERR_OUTOFVIDEOMEMORY; + } + + object->lpVtbl = &IWineD3DCubeTexture_Vtbl; + object->resource.wineD3DDevice = This; + IWineD3DDevice_AddRef(iface); + object->resource.resourceType = D3DRTYPE_CUBETEXTURE; + object->resource.parent = parent; + object->resource.ref = 1; + *ppCubeTexture = (IWineD3DCubeTexture *)object; + + /* Allocate the storage for it */ + TRACE("(%p) : Len(%d), Lvl(%d) Usage(%ld), Fmt(%u,%s), Pool(%s)\n", This, EdgeLength, Levels, Usage, Format, debug_d3dformat(Format), debug_d3dpool(Pool)); + + object->usage = Usage; + object->edgeLength = EdgeLength; + object->baseTexture.levels = Levels; + object->baseTexture.format = Format; + + /* Calculate levels for mip mapping */ + if (Levels == 0) { + object->baseTexture.levels++; + tmpW = EdgeLength; + while (tmpW > 1) { + tmpW = max(1, tmpW / 2); + object->baseTexture.levels++; + } + TRACE("Calculated levels = %d\n", object->baseTexture.levels); + } + + /* Generate all the surfaces */ + tmpW = EdgeLength; + for (i = 0; i < object->baseTexture.levels; i++) { + + /* Create the 6 faces */ + for (j = 0; j < 6; j++) { + + D3DCB_CreateSurface(This->parent, tmpW, tmpW, Format, Pool, + (IWineD3DSurface **)&object->surfaces[j][i], pSharedHandle); + object->surfaces[j][i]->container = (IUnknown*) object; + object->surfaces[j][i]->currentDesc.Usage = Usage; + object->surfaces[j][i]->currentDesc.Pool = Pool; + + /** + * As written in msdn in IDirect3DCubeTexture8::LockRect + * Textures created in D3DPOOL_DEFAULT are not lockable. + */ + if (D3DPOOL_DEFAULT == Pool) { + object->surfaces[j][i]->lockable = FALSE; + } + + TRACE("Created surface level %d @ %p, memory at %p\n", i, object->surfaces[j][i], object->surfaces[j][i]->allocatedMemory); + } + tmpW = max(1, tmpW / 2); + } + + TRACE("(%p) : Created Cube Texture %p\n", This, object); + *ppCubeTexture = (IWineD3DCubeTexture *) object; + return D3D_OK; +} + /***** * Get / Set FVF *****/ @@ -3032,6 +3366,11 @@ IWineD3DDeviceVtbl IWineD3DDevice_Vtbl = IWineD3DDeviceImpl_CreateIndexBuffer, IWineD3DDeviceImpl_CreateStateBlock, IWineD3DDeviceImpl_CreateRenderTarget, + IWineD3DDeviceImpl_CreateOffscreenPlainSurface, + IWineD3DDeviceImpl_CreateTexture, + IWineD3DDeviceImpl_CreateVolumeTexture, + IWineD3DDeviceImpl_CreateVolume, + IWineD3DDeviceImpl_CreateCubeTexture, IWineD3DDeviceImpl_SetFVF, IWineD3DDeviceImpl_GetFVF, Index: wine/dlls/wined3d/basetexture.c diff -u -p wine/dlls/wined3d/basetexture.c:1.2 wine/dlls/wined3d/basetexture.c:1.3 --- wine/dlls/wined3d/basetexture.c:1.2 Sun May 19 15:10:15 2013 +++ wine/dlls/wined3d/basetexture.c Sun May 19 15:10:15 2013 @@ -60,39 +60,39 @@ ULONG WINAPI IWineD3DBaseTextureImpl_Rel IWineD3DBaseTexture IWineD3DResource parts follow **************************************************** */ HRESULT WINAPI IWineD3DBaseTextureImpl_GetDevice(IWineD3DBaseTexture *iface, IWineD3DDevice** ppDevice) { - return IWineD3DResource_GetDevice((IWineD3DResource *)iface, ppDevice); + return IWineD3DResourceImpl_GetDevice((IWineD3DResource *)iface, ppDevice); } HRESULT WINAPI IWineD3DBaseTextureImpl_SetPrivateData(IWineD3DBaseTexture *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { - return IWineD3DResource_SetPrivateData((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags); + return IWineD3DResourceImpl_SetPrivateData((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags); } HRESULT WINAPI IWineD3DBaseTextureImpl_GetPrivateData(IWineD3DBaseTexture *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { - return IWineD3DResource_GetPrivateData((IWineD3DResource *)iface, refguid, pData, pSizeOfData); + return IWineD3DResourceImpl_GetPrivateData((IWineD3DResource *)iface, refguid, pData, pSizeOfData); } HRESULT WINAPI IWineD3DBaseTextureImpl_FreePrivateData(IWineD3DBaseTexture *iface, REFGUID refguid) { - return IWineD3DResource_FreePrivateData((IWineD3DResource *)iface, refguid); + return IWineD3DResourceImpl_FreePrivateData((IWineD3DResource *)iface, refguid); } DWORD WINAPI IWineD3DBaseTextureImpl_SetPriority(IWineD3DBaseTexture *iface, DWORD PriorityNew) { - return IWineD3DResource_SetPriority((IWineD3DResource *)iface, PriorityNew); + return IWineD3DResourceImpl_SetPriority((IWineD3DResource *)iface, PriorityNew); } DWORD WINAPI IWineD3DBaseTextureImpl_GetPriority(IWineD3DBaseTexture *iface) { - return IWineD3DResource_GetPriority((IWineD3DResource *)iface); + return IWineD3DResourceImpl_GetPriority((IWineD3DResource *)iface); } void WINAPI IWineD3DBaseTextureImpl_PreLoad(IWineD3DBaseTexture *iface) { - return IWineD3DResource_PreLoad((IWineD3DResource *)iface); + return IWineD3DResourceImpl_PreLoad((IWineD3DResource *)iface); } D3DRESOURCETYPE WINAPI IWineD3DBaseTextureImpl_GetType(IWineD3DBaseTexture *iface) { - return IWineD3DResource_GetType((IWineD3DResource *)iface); + return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface); } HRESULT WINAPI IWineD3DBaseTextureImpl_GetParent(IWineD3DBaseTexture *iface, IUnknown **pParent) { - return IWineD3DResource_GetParent((IWineD3DResource *)iface, pParent); + return IWineD3DResourceImpl_GetParent((IWineD3DResource *)iface, pParent); } /* ****************************************************** @@ -143,6 +143,11 @@ BOOL WINAPI IWineD3DBaseTextureImpl_SetD return old; } +BOOL WINAPI IWineD3DBaseTextureImpl_GetDirty(IWineD3DBaseTexture *iface) { + IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; + return This->baseTexture.dirty; +} + IWineD3DBaseTextureVtbl IWineD3DBaseTexture_Vtbl = { IWineD3DBaseTextureImpl_QueryInterface, @@ -163,5 +168,6 @@ IWineD3DBaseTextureVtbl IWineD3DBaseText IWineD3DBaseTextureImpl_SetAutoGenFilterType, IWineD3DBaseTextureImpl_GetAutoGenFilterType, IWineD3DBaseTextureImpl_GenerateMipSubLevels, - IWineD3DBaseTextureImpl_SetDirty + IWineD3DBaseTextureImpl_SetDirty, + IWineD3DBaseTextureImpl_GetDirty }; Index: wine/dlls/wined3d/Makefile.in diff -u -p wine/dlls/wined3d/Makefile.in:1.11 wine/dlls/wined3d/Makefile.in:1.12 --- wine/dlls/wined3d/Makefile.in:1.11 Sun May 19 15:10:15 2013 +++ wine/dlls/wined3d/Makefile.in Sun May 19 15:10:15 2013 @@ -9,6 +9,7 @@ EXTRALIBS = -ldxguid -luuid @X_LIBS@ @X_ C_SRCS = \ basetexture.c \ + cubetexture.c \ device.c \ directx.c \ drawprim.c \ @@ -16,9 +17,12 @@ C_SRCS = \ resource.c \ stateblock.c \ surface.c \ + texture.c \ utils.c \ vertexbuffer.c \ vertexshader.c \ + volume.c \ + volumetexture.c \ wined3d_main.c @MAKE_DLL_RULES@ Index: wine/dlls/d3d9/volumetexture.c diff -u -p wine/dlls/d3d9/volumetexture.c:1.7 wine/dlls/d3d9/volumetexture.c:1.8 --- wine/dlls/d3d9/volumetexture.c:1.7 Sun May 19 15:10:15 2013 +++ wine/dlls/d3d9/volumetexture.c Sun May 19 15:10:15 2013 @@ -1,7 +1,7 @@ /* * IDirect3DVolumeTexture9 implementation * - * Copyright 2002-2003 Jason Edmeades + * Copyright 2002-2005 Jason Edmeades * Raphael Junqueira * * This library is free software; you can redistribute it and/or @@ -44,22 +44,16 @@ HRESULT WINAPI IDirect3DVolumeTexture9Im ULONG WINAPI IDirect3DVolumeTexture9Impl_AddRef(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; TRACE("(%p) : AddRef from %ld\n", This, This->ref); - return ++(This->ref); + return InterlockedIncrement(&This->ref); } ULONG WINAPI IDirect3DVolumeTexture9Impl_Release(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - ULONG ref = --This->ref; - UINT i; + ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); if (ref == 0) { - for (i = 0; i < This->levels; i++) { - if (This->volumes[i] != NULL) { - TRACE("(%p) : Releasing volume %p\n", This, This->volumes[i]); - IDirect3DVolume9Impl_Release((LPDIRECT3DVOLUME9) This->volumes[i]); - } - } + IWineD3DVolumeTexture_Release(This->wineD3DVolumeTexture); HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -73,134 +67,115 @@ HRESULT WINAPI IDirect3DVolumeTexture9Im HRESULT WINAPI IDirect3DVolumeTexture9Impl_SetPrivateData(LPDIRECT3DVOLUMETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DVolumeTexture_SetPrivateData(This->wineD3DVolumeTexture,refguid,pData,SizeOfData,Flags); } HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetPrivateData(LPDIRECT3DVOLUMETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DVolumeTexture_GetPrivateData(This->wineD3DVolumeTexture,refguid,pData,pSizeOfData); } HRESULT WINAPI IDirect3DVolumeTexture9Impl_FreePrivateData(LPDIRECT3DVOLUMETEXTURE9 iface, REFGUID refguid) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DVolumeTexture_FreePrivateData(This->wineD3DVolumeTexture,refguid); } DWORD WINAPI IDirect3DVolumeTexture9Impl_SetPriority(LPDIRECT3DVOLUMETEXTURE9 iface, DWORD PriorityNew) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9) This, PriorityNew); + return IWineD3DVolumeTexture_SetPriority(This->wineD3DVolumeTexture, PriorityNew); } DWORD WINAPI IDirect3DVolumeTexture9Impl_GetPriority(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9) This); + return IWineD3DVolumeTexture_GetPriority(This->wineD3DVolumeTexture); } void WINAPI IDirect3DVolumeTexture9Impl_PreLoad(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return ; + return IWineD3DVolumeTexture_PreLoad(This->wineD3DVolumeTexture); } D3DRESOURCETYPE WINAPI IDirect3DVolumeTexture9Impl_GetType(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9) This); + return IWineD3DVolumeTexture_GetType(This->wineD3DVolumeTexture); } /* IDirect3DVolumeTexture9 IDirect3DBaseTexture9 Interface follow: */ DWORD WINAPI IDirect3DVolumeTexture9Impl_SetLOD(LPDIRECT3DVOLUMETEXTURE9 iface, DWORD LODNew) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - return IDirect3DBaseTexture9Impl_SetLOD((LPDIRECT3DBASETEXTURE9) This, LODNew); + return IWineD3DVolumeTexture_SetLOD(This->wineD3DVolumeTexture, LODNew); } DWORD WINAPI IDirect3DVolumeTexture9Impl_GetLOD(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - return IDirect3DBaseTexture9Impl_GetLOD((LPDIRECT3DBASETEXTURE9) This); + return IWineD3DVolumeTexture_GetLOD(This->wineD3DVolumeTexture); } DWORD WINAPI IDirect3DVolumeTexture9Impl_GetLevelCount(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - return IDirect3DBaseTexture9Impl_GetLevelCount((LPDIRECT3DBASETEXTURE9) This); + return IWineD3DVolumeTexture_GetLevelCount(This->wineD3DVolumeTexture); } HRESULT WINAPI IDirect3DVolumeTexture9Impl_SetAutoGenFilterType(LPDIRECT3DVOLUMETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - return IDirect3DBaseTexture9Impl_SetAutoGenFilterType((LPDIRECT3DBASETEXTURE9) This, FilterType); + return IWineD3DVolumeTexture_SetAutoGenFilterType(This->wineD3DVolumeTexture, FilterType); } D3DTEXTUREFILTERTYPE WINAPI IDirect3DVolumeTexture9Impl_GetAutoGenFilterType(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - return IDirect3DBaseTexture9Impl_GetAutoGenFilterType((LPDIRECT3DBASETEXTURE9) This); + return IWineD3DVolumeTexture_GetAutoGenFilterType(This->wineD3DVolumeTexture); } void WINAPI IDirect3DVolumeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return ; + return IWineD3DVolumeTexture_GenerateMipSubLevels(This->wineD3DVolumeTexture); } /* IDirect3DVolumeTexture9 Interface follow: */ HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetLevelDesc(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, D3DVOLUME_DESC* pDesc) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - if (Level < This->levels) { - TRACE("(%p) Level (%d)\n", This, Level); - return IDirect3DVolume9Impl_GetDesc((LPDIRECT3DVOLUME9) This->volumes[Level], pDesc); - } - FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); - return D3DERR_INVALIDCALL; + WINED3DVOLUME_DESC wined3ddesc; + UINT tmpInt = -1; + + /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */ + wined3ddesc.Format = &pDesc->Format; + wined3ddesc.Type = &pDesc->Type; + wined3ddesc.Usage = &pDesc->Usage; + wined3ddesc.Pool = &pDesc->Pool; + wined3ddesc.Size = &tmpInt; + wined3ddesc.Width = &pDesc->Width; + wined3ddesc.Height = &pDesc->Height; + wined3ddesc.Depth = &pDesc->Depth; + + return IWineD3DVolumeTexture_GetLevelDesc(This->wineD3DVolumeTexture, Level, &wined3ddesc); } HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, IDirect3DVolume9** ppVolumeLevel) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - if (Level < This->levels) { - *ppVolumeLevel = (LPDIRECT3DVOLUME9) This->volumes[Level]; - IDirect3DVolume9Impl_AddRef((LPDIRECT3DVOLUME9) *ppVolumeLevel); - TRACE("(%p) -> level(%d) returning volume@%p\n", This, Level, *ppVolumeLevel); - } else { - FIXME("(%p) Level(%d) overflow Levels(%d)\n", This, Level, This->levels); - return D3DERR_INVALIDCALL; + HRESULT hrc = D3D_OK; + + IWineD3DVolume *myVolume = NULL; + hrc = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume); + if (hrc == D3D_OK) { + IWineD3DVolumeTexture_GetParent(myVolume, (IUnknown **)ppVolumeLevel); + IWineD3DVolumeTexture_Release(myVolume); } - return D3D_OK; - + return hrc; } + HRESULT WINAPI IDirect3DVolumeTexture9Impl_LockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) { - HRESULT hr; IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - if (Level < This->levels) { - /** - * Not dirtified while Surfaces don't notify dirtification - * This->Dirty = TRUE; - */ - hr = IDirect3DVolume9Impl_LockBox((LPDIRECT3DVOLUME9) This->volumes[Level], pLockedVolume, pBox, Flags); - TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr); - } else { - FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); - return D3DERR_INVALIDCALL; - } - return hr; + return IWineD3DVolumeTexture_LockBox(This->wineD3DVolumeTexture, Level, pLockedVolume, pBox, Flags); } HRESULT WINAPI IDirect3DVolumeTexture9Impl_UnlockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level) { - HRESULT hr; IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - if (Level < This->levels) { - hr = IDirect3DVolume9Impl_UnlockBox((LPDIRECT3DVOLUME9) This->volumes[Level]); - TRACE("(%p) -> level(%d) success(%lu)\n", This, Level, hr); - } else { - FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); - return D3DERR_INVALIDCALL; - } - return hr; + return IWineD3DVolumeTexture_UnlockBox(This->wineD3DVolumeTexture, Level); } HRESULT WINAPI IDirect3DVolumeTexture9Impl_AddDirtyBox(LPDIRECT3DVOLUMETEXTURE9 iface, CONST D3DBOX* pDirtyBox) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - This->Dirty = TRUE; - return D3D_OK; + return IWineD3DVolumeTexture_AddDirtyBox(This->wineD3DVolumeTexture, pDirtyBox); } @@ -237,7 +212,17 @@ HRESULT WINAPI IDirect3DDevice9Impl_Cr D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle) { + IDirect3DVolumeTexture9Impl *object; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - FIXME("(%p) : stub\n", This); + + /* Allocate the storage for the device */ + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVolumeTexture9Impl)); + object->lpVtbl = &Direct3DVolumeTexture9_Vtbl; + object->ref = 1; + IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels, Usage, + Format, Pool, &(object->wineD3DVolumeTexture), pSharedHandle, + (IUnknown *)object, D3D9CB_CreateVolume); + + *ppVolumeTexture = (LPDIRECT3DVOLUMETEXTURE9) object; return D3D_OK; } Index: wine/dlls/d3d9/volume.c diff -u -p wine/dlls/d3d9/volume.c:1.7 wine/dlls/d3d9/volume.c:1.8 --- wine/dlls/d3d9/volume.c:1.7 Sun May 19 15:10:15 2013 +++ wine/dlls/d3d9/volume.c Sun May 19 15:10:15 2013 @@ -1,7 +1,7 @@ /* * IDirect3DVolume9 implementation * - * Copyright 2002-2003 Jason Edmeades + * Copyright 2002-2005 Jason Edmeades * Raphael Junqueira * * This library is free software; you can redistribute it and/or @@ -42,15 +42,15 @@ HRESULT WINAPI IDirect3DVolume9Impl_Quer ULONG WINAPI IDirect3DVolume9Impl_AddRef(LPDIRECT3DVOLUME9 iface) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; TRACE("(%p) : AddRef from %ld\n", This, This->ref); - return ++(This->ref); + return InterlockedIncrement(&This->ref); } ULONG WINAPI IDirect3DVolume9Impl_Release(LPDIRECT3DVOLUME9 iface) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; - ULONG ref = --This->ref; + ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); if (ref == 0) { - HeapFree(GetProcessHeap(), 0, This->allocatedMemory); + IWineD3DVolume_Release(This->wineD3DVolume); HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -59,62 +59,73 @@ ULONG WINAPI IDirect3DVolume9Impl_Releas /* IDirect3DVolume9 Interface follow: */ HRESULT WINAPI IDirect3DVolume9Impl_GetDevice(LPDIRECT3DVOLUME9 iface, IDirect3DDevice9** ppDevice) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; - TRACE("(%p) : returning %p\n", This, This->Device); - *ppDevice = (LPDIRECT3DDEVICE9) This->Device; - - /* Note Calling this method will increase the internal reference count - on the IDirect3DDevice9 interface. */ - IDirect3DDevice9Impl_AddRef(*ppDevice); + IWineD3DDevice *myDevice = NULL; + IWineD3DVolume_GetDevice(This->wineD3DVolume, &myDevice); + IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice); + IWineD3DDevice_Release(myDevice); return D3D_OK; } HRESULT WINAPI IDirect3DVolume9Impl_SetPrivateData(LPDIRECT3DVOLUME9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DVolume_SetPrivateData(This->wineD3DVolume, refguid, pData, SizeOfData, Flags); } HRESULT WINAPI IDirect3DVolume9Impl_GetPrivateData(LPDIRECT3DVOLUME9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DVolume_GetPrivateData(This->wineD3DVolume, refguid, pData, pSizeOfData); } HRESULT WINAPI IDirect3DVolume9Impl_FreePrivateData(LPDIRECT3DVOLUME9 iface, REFGUID refguid) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DVolume_FreePrivateData(This->wineD3DVolume, refguid); } HRESULT WINAPI IDirect3DVolume9Impl_GetContainer(LPDIRECT3DVOLUME9 iface, REFIID riid, void** ppContainer) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; - TRACE("(%p) : returning %p\n", This, This->Container); - *ppContainer = This->Container; - IUnknown_AddRef(This->Container); - return D3D_OK; + HRESULT res; + + IUnknown *IWineContainer = NULL; + res = IWineD3DVolume_GetContainer(This->wineD3DVolume, riid, (void **)&IWineContainer); + + /* If this works, the only valid container is a child of resource (volumetexture) */ + if (res == D3D_OK) { + IWineD3DResource_GetParent((IWineD3DResource *)IWineContainer, (IUnknown **)ppContainer); + IWineD3DResource_Release((IWineD3DResource *)IWineContainer); + } + + return res; } HRESULT WINAPI IDirect3DVolume9Impl_GetDesc(LPDIRECT3DVOLUME9 iface, D3DVOLUME_DESC* pDesc) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; - TRACE("(%p) : copying into %p\n", This, pDesc); - memcpy(pDesc, &This->myDesc, sizeof(D3DVOLUME_DESC)); - return D3D_OK; + WINED3DVOLUME_DESC wined3ddesc; + UINT tmpInt = -1; + + /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */ + wined3ddesc.Format = &pDesc->Format; + wined3ddesc.Type = &pDesc->Type; + wined3ddesc.Usage = &pDesc->Usage; + wined3ddesc.Pool = &pDesc->Pool; + wined3ddesc.Size = &tmpInt; + wined3ddesc.Width = &pDesc->Width; + wined3ddesc.Height = &pDesc->Height; + wined3ddesc.Depth = &pDesc->Depth; + + return IWineD3DVolume_GetDesc(This->wineD3DVolume, &wined3ddesc); } HRESULT WINAPI IDirect3DVolume9Impl_LockBox(LPDIRECT3DVOLUME9 iface, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DVolume_LockBox(This->wineD3DVolume, pLockedVolume, pBox, Flags); } HRESULT WINAPI IDirect3DVolume9Impl_UnlockBox(LPDIRECT3DVOLUME9 iface) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DVolume_UnlockBox(This->wineD3DVolume); } - IDirect3DVolume9Vtbl Direct3DVolume9_Vtbl = { IDirect3DVolume9Impl_QueryInterface, @@ -129,3 +140,19 @@ IDirect3DVolume9Vtbl Direct3DVolume9_Vtb IDirect3DVolume9Impl_LockBox, IDirect3DVolume9Impl_UnlockBox }; + +/* Internal function called back during the CreateVolumeTexture */ +HRESULT WINAPI D3D9CB_CreateVolume(IUnknown *pDevice, UINT Width, UINT Height, UINT Depth, + D3DFORMAT Format, D3DPOOL Pool, DWORD Usage, + IWineD3DVolume **ppVolume, + HANDLE * pSharedHandle) { + IDirect3DVolume9Impl *object; + IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)pDevice; + + /* Allocate the storage for the device */ + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVolume9Impl)); + object->lpVtbl = &Direct3DVolume9_Vtbl; + object->ref = 1; + return IWineD3DDevice_CreateVolume(This->WineD3DDevice, Width, Height, Depth, Usage, Format, + Pool, ppVolume, pSharedHandle, (IUnknown *)object); +} Index: wine/dlls/d3d9/texture.c diff -u -p wine/dlls/d3d9/texture.c:1.8 wine/dlls/d3d9/texture.c:1.9 --- wine/dlls/d3d9/texture.c:1.8 Sun May 19 15:10:16 2013 +++ wine/dlls/d3d9/texture.c Sun May 19 15:10:16 2013 @@ -1,7 +1,7 @@ /* * IDirect3DTexture9 implementation * - * Copyright 2002-2003 Jason Edmeades + * Copyright 2002-2005 Jason Edmeades * Raphael Junqueira * * This library is free software; you can redistribute it and/or @@ -44,22 +44,16 @@ HRESULT WINAPI IDirect3DTexture9Impl_Que ULONG WINAPI IDirect3DTexture9Impl_AddRef(LPDIRECT3DTEXTURE9 iface) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; TRACE("(%p) : AddRef from %ld\n", This, This->ref); - return ++(This->ref); + return InterlockedIncrement(&This->ref); } ULONG WINAPI IDirect3DTexture9Impl_Release(LPDIRECT3DTEXTURE9 iface) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - ULONG ref = --This->ref; - unsigned int i; + ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); if (ref == 0) { - for (i = 0; i < This->levels; i++) { - if (NULL != This->surfaces[i]) { - TRACE("(%p) : Releasing surface %p\n", This, This->surfaces[i]); - IDirect3DSurface9Impl_Release((LPDIRECT3DSURFACE9) This->surfaces[i]); - } - } + IWineD3DTexture_Release(This->wineD3DTexture); HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -73,130 +67,117 @@ HRESULT WINAPI IDirect3DTexture9Impl_Get HRESULT WINAPI IDirect3DTexture9Impl_SetPrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DTexture_SetPrivateData(This->wineD3DTexture,refguid,pData,SizeOfData,Flags); } HRESULT WINAPI IDirect3DTexture9Impl_GetPrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DTexture_GetPrivateData(This->wineD3DTexture,refguid,pData,pSizeOfData); } HRESULT WINAPI IDirect3DTexture9Impl_FreePrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DTexture_FreePrivateData(This->wineD3DTexture,refguid); } DWORD WINAPI IDirect3DTexture9Impl_SetPriority(LPDIRECT3DTEXTURE9 iface, DWORD PriorityNew) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9) This, PriorityNew); + return IWineD3DTexture_SetPriority(This->wineD3DTexture, PriorityNew); } DWORD WINAPI IDirect3DTexture9Impl_GetPriority(LPDIRECT3DTEXTURE9 iface) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9) This); + return IWineD3DTexture_GetPriority(This->wineD3DTexture); } void WINAPI IDirect3DTexture9Impl_PreLoad(LPDIRECT3DTEXTURE9 iface) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return ; + return IWineD3DTexture_PreLoad(This->wineD3DTexture); } D3DRESOURCETYPE WINAPI IDirect3DTexture9Impl_GetType(LPDIRECT3DTEXTURE9 iface) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9) This); + return IWineD3DTexture_GetType(This->wineD3DTexture); } /* IDirect3DTexture9 IDirect3DBaseTexture9 Interface follow: */ DWORD WINAPI IDirect3DTexture9Impl_SetLOD(LPDIRECT3DTEXTURE9 iface, DWORD LODNew) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - return IDirect3DBaseTexture9Impl_SetLOD((LPDIRECT3DBASETEXTURE9) This, LODNew); + return IWineD3DTexture_SetLOD(This->wineD3DTexture, LODNew); } DWORD WINAPI IDirect3DTexture9Impl_GetLOD(LPDIRECT3DTEXTURE9 iface) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - return IDirect3DBaseTexture9Impl_GetLOD((LPDIRECT3DBASETEXTURE9) This); + return IWineD3DTexture_GetLOD(This->wineD3DTexture); } DWORD WINAPI IDirect3DTexture9Impl_GetLevelCount(LPDIRECT3DTEXTURE9 iface) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - return IDirect3DBaseTexture9Impl_GetLevelCount((LPDIRECT3DBASETEXTURE9) This); + return IWineD3DTexture_GetLevelCount(This->wineD3DTexture); } HRESULT WINAPI IDirect3DTexture9Impl_SetAutoGenFilterType(LPDIRECT3DTEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - return IDirect3DBaseTexture9Impl_SetAutoGenFilterType((LPDIRECT3DBASETEXTURE9) This, FilterType); + return IWineD3DTexture_SetAutoGenFilterType(This->wineD3DTexture, FilterType); } D3DTEXTUREFILTERTYPE WINAPI IDirect3DTexture9Impl_GetAutoGenFilterType(LPDIRECT3DTEXTURE9 iface) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - return IDirect3DBaseTexture9Impl_GetAutoGenFilterType((LPDIRECT3DBASETEXTURE9) This); + return IWineD3DTexture_GetAutoGenFilterType(This->wineD3DTexture); } void WINAPI IDirect3DTexture9Impl_GenerateMipSubLevels(LPDIRECT3DTEXTURE9 iface) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return ; + return IWineD3DTexture_GenerateMipSubLevels(This->wineD3DTexture); } /* IDirect3DTexture9 Interface follow: */ HRESULT WINAPI IDirect3DTexture9Impl_GetLevelDesc(LPDIRECT3DTEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - if (Level < This->levels) { - TRACE("(%p) Level (%d)\n", This, Level); - return IDirect3DSurface9Impl_GetDesc((LPDIRECT3DSURFACE9) This->surfaces[Level], pDesc); - } - FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); - return D3DERR_INVALIDCALL; + WINED3DSURFACE_DESC wined3ddesc; + UINT tmpInt = -1; + + /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */ + wined3ddesc.Format = &pDesc->Format; + wined3ddesc.Type = &pDesc->Type; + wined3ddesc.Usage = &pDesc->Usage; + wined3ddesc.Pool = &pDesc->Pool; + wined3ddesc.Size = &tmpInt; + wined3ddesc.MultiSampleType = &pDesc->MultiSampleType; + wined3ddesc.MultiSampleQuality = &pDesc->MultiSampleQuality; + wined3ddesc.Width = &pDesc->Width; + wined3ddesc.Height = &pDesc->Height; + + return IWineD3DTexture_GetLevelDesc(This->wineD3DTexture, Level, &wined3ddesc); } HRESULT WINAPI IDirect3DTexture9Impl_GetSurfaceLevel(LPDIRECT3DTEXTURE9 iface, UINT Level, IDirect3DSurface9** ppSurfaceLevel) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - *ppSurfaceLevel = (LPDIRECT3DSURFACE9) This->surfaces[Level]; - IDirect3DSurface9Impl_AddRef((LPDIRECT3DSURFACE9) This->surfaces[Level]); - TRACE("(%p) : returning %p for level %d\n", This, *ppSurfaceLevel, Level); - return D3D_OK; + HRESULT hrc = D3D_OK; + + IWineD3DSurface *mySurface = NULL; + hrc = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface); + if (hrc == D3D_OK) { + IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppSurfaceLevel); + IWineD3DSurface_Release(mySurface); + } + return hrc; } HRESULT WINAPI IDirect3DTexture9Impl_LockRect(LPDIRECT3DTEXTURE9 iface, UINT Level,D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { - HRESULT hr; IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - if (Level < This->levels) { - /** - * Not dirtified while Surfaces don't notify dirtification - * This->impl.parent.Dirty = TRUE; - */ - hr = IDirect3DSurface9Impl_LockRect((LPDIRECT3DSURFACE9) This->surfaces[Level], pLockedRect, pRect, Flags); - TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr); - } else { - FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); - return D3DERR_INVALIDCALL; - } - return hr; + return IWineD3DTexture_LockRect(This->wineD3DTexture, Level, pLockedRect, pRect, Flags); } HRESULT WINAPI IDirect3DTexture9Impl_UnlockRect(LPDIRECT3DTEXTURE9 iface, UINT Level) { - HRESULT hr; IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - if (Level < This->levels) { - hr = IDirect3DSurface9Impl_UnlockRect((LPDIRECT3DSURFACE9) This->surfaces[Level]); - TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr); - } else { - FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); - return D3DERR_INVALIDCALL; - } - return hr; + return IWineD3DTexture_UnlockRect(This->wineD3DTexture, Level); } HRESULT WINAPI IDirect3DTexture9Impl_AddDirtyRect(LPDIRECT3DTEXTURE9 iface, CONST RECT* pDirtyRect) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - This->Dirty = TRUE; - return D3D_OK; + return IWineD3DTexture_AddDirtyRect(This->wineD3DTexture, pDirtyRect); } @@ -230,7 +211,16 @@ IDirect3DTexture9Vtbl Direct3DTexture9_V /* IDirect3DDevice9 IDirect3DTexture9 Methods follow: */ HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle) { + IDirect3DTexture9Impl *object; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - FIXME("(%p) : stub\n", This); + + /* Allocate the storage for the device */ + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DTexture9Impl)); + object->lpVtbl = &Direct3DTexture9_Vtbl; + object->ref = 1; + IWineD3DDevice_CreateTexture(This->WineD3DDevice, Width, Height, Levels, Usage, + Format, Pool, &(object->wineD3DTexture), pSharedHandle, (IUnknown *)object, D3D9CB_CreateSurface); + + *ppTexture = (LPDIRECT3DTEXTURE9) object; return D3D_OK; } Index: wine/dlls/d3d9/surface.c diff -u -p wine/dlls/d3d9/surface.c:1.8 wine/dlls/d3d9/surface.c:1.9 --- wine/dlls/d3d9/surface.c:1.8 Sun May 19 15:10:16 2013 +++ wine/dlls/d3d9/surface.c Sun May 19 15:10:16 2013 @@ -51,7 +51,7 @@ ULONG WINAPI IDirect3DSurface9Impl_Relea ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); if (ref == 0) { - IWineD3DBaseTexture_Release(This->wineD3DSurface); + IWineD3DSurface_Release(This->wineD3DSurface); HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -130,12 +130,14 @@ HRESULT WINAPI IDirect3DSurface9Impl_Get HRESULT WINAPI IDirect3DSurface9Impl_GetDesc(LPDIRECT3DSURFACE9 iface, D3DSURFACE_DESC* pDesc) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; WINED3DSURFACE_DESC wined3ddesc; + UINT tmpInt = -1; /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */ wined3ddesc.Format = &pDesc->Format; wined3ddesc.Type = &pDesc->Type; wined3ddesc.Usage = &pDesc->Usage; wined3ddesc.Pool = &pDesc->Pool; + wined3ddesc.Size = &tmpInt; wined3ddesc.MultiSampleType = &pDesc->MultiSampleType; wined3ddesc.MultiSampleQuality = &pDesc->MultiSampleQuality; wined3ddesc.Width = &pDesc->Width; @@ -185,3 +187,23 @@ IDirect3DSurface9Vtbl Direct3DSurface9_V IDirect3DSurface9Impl_GetDC, IDirect3DSurface9Impl_ReleaseDC }; + +/* Internal function called back during the CreateTexture and CreateCubeTextures to create the surface(s) */ +HRESULT WINAPI D3D9CB_CreateSurface(IUnknown *pDevice, + UINT Width, + UINT Height, + D3DFORMAT Format, + D3DPOOL Pool, + IWineD3DSurface **ppSurface, + HANDLE * pSharedHandle) { + + HRESULT res = D3D_OK; + IDirect3DSurface9Impl *d3dSurface = NULL; + + res = IDirect3DDevice9_CreateOffscreenPlainSurface((IDirect3DDevice9 *)pDevice, Width, Height, + Format, Pool, (IDirect3DSurface9 **)&d3dSurface, pSharedHandle); + if (res == D3D_OK) { + *ppSurface = d3dSurface->wineD3DSurface; + } + return res; +} Index: wine/dlls/d3d9/resource.c diff -u -p wine/dlls/d3d9/resource.c:1.7 wine/dlls/d3d9/resource.c:1.8 --- wine/dlls/d3d9/resource.c:1.7 Sun May 19 15:10:16 2013 +++ wine/dlls/d3d9/resource.c Sun May 19 15:10:16 2013 @@ -62,6 +62,7 @@ HRESULT WINAPI IDirect3DResource9Impl_Ge IWineD3DDevice *myDevice = NULL; IWineD3DResource_GetDevice(This->wineD3DResource, &myDevice); IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice); + IWineD3DDevice_Release(myDevice); return D3D_OK; } Index: wine/dlls/d3d9/device.c diff -u -p wine/dlls/d3d9/device.c:1.16 wine/dlls/d3d9/device.c:1.17 --- wine/dlls/d3d9/device.c:1.16 Sun May 19 15:10:16 2013 +++ wine/dlls/d3d9/device.c Sun May 19 15:10:16 2013 @@ -219,7 +219,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_Cr object->lpVtbl = &Direct3DSurface9_Vtbl; object->ref = 1; IWineD3DDevice_CreateRenderTarget(This->WineD3DDevice, Width, Height, Format, MultiSample, MultisampleQuality, - Lockable, &object->wineD3DSurface, pSharedHandle, (IUnknown *)This); + Lockable, &object->wineD3DSurface, pSharedHandle, (IUnknown *)object); *ppSurface = (LPDIRECT3DSURFACE9) object; return D3D_OK; @@ -274,8 +274,17 @@ HRESULT WINAPI IDirect3DDevice9Impl_Co } HRESULT WINAPI IDirect3DDevice9Impl_CreateOffscreenPlainSurface(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) { + IDirect3DSurface9Impl *object; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - FIXME("(%p) : stub\n", This); + + /* Allocate the storage for the device */ + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface9Impl)); + object->lpVtbl = &Direct3DSurface9_Vtbl; + object->ref = 1; + IWineD3DDevice_CreateOffscreenPlainSurface(This->WineD3DDevice, Width, Height, Format, Pool, + &(object->wineD3DSurface), pSharedHandle, (IUnknown *)object); + + *ppSurface = (LPDIRECT3DSURFACE9) object; return D3D_OK; } Index: wine/dlls/d3d9/d3d9_private.h diff -u -p wine/dlls/d3d9/d3d9_private.h:1.10 wine/dlls/d3d9/d3d9_private.h:1.11 --- wine/dlls/d3d9/d3d9_private.h:1.10 Sun May 19 15:10:16 2013 +++ wine/dlls/d3d9/d3d9_private.h Sun May 19 15:10:16 2013 @@ -447,20 +447,7 @@ struct IDirect3DVolume9Impl DWORD ref; /* IDirect3DVolume9 fields */ - IDirect3DDevice9Impl *Device; - D3DRESOURCETYPE ResourceType; - - IUnknown *Container; - D3DVOLUME_DESC myDesc; - BYTE *allocatedMemory; - UINT textureName; - UINT bytesPerPixel; - - BOOL lockable; - BOOL locked; - D3DBOX lockedBox; - D3DBOX dirtyBox; - BOOL Dirty; + IWineD3DVolume *wineD3DVolume; }; /* IUnknown: */ @@ -756,17 +743,7 @@ struct IDirect3DCubeTexture9Impl DWORD ref; /* IDirect3DResource9 fields */ - D3DRESOURCETYPE ResourceType; - - /* IDirect3DBaseTexture9 fields */ - BOOL Dirty; - D3DFORMAT format; - UINT levels; - - /* IDirect3DCubeTexture9 fields */ - UINT edgeLength; - DWORD usage; - IDirect3DSurface9Impl *surfaces[6][MAX_LEVELS]; + IWineD3DCubeTexture *wineD3DCubeTexture; }; /* IUnknown: */ @@ -819,18 +796,8 @@ struct IDirect3DTexture9Impl DWORD ref; /* IDirect3DResource9 fields */ - D3DRESOURCETYPE ResourceType; + IWineD3DTexture *wineD3DTexture; - /* IDirect3DBaseTexture9 fields */ - BOOL Dirty; - D3DFORMAT format; - UINT levels; - - /* IDirect3DTexture9 fields */ - UINT width; - UINT height; - DWORD usage; - IDirect3DSurface9Impl *surfaces[MAX_LEVELS]; }; /* IUnknown: */ @@ -883,19 +850,7 @@ struct IDirect3DVolumeTexture9Impl DWORD ref; /* IDirect3DResource9 fields */ - D3DRESOURCETYPE ResourceType; - - /* IDirect3DBaseTexture9 fields */ - BOOL Dirty; - D3DFORMAT format; - UINT levels; - - /* IDirect3DVolumeTexture9 fields */ - UINT width; - UINT height; - UINT depth; - DWORD usage; - IDirect3DVolume9Impl *volumes[MAX_LEVELS]; + IWineD3DVolumeTexture *wineD3DVolumeTexture; }; /* IUnknown: */ @@ -1182,5 +1137,16 @@ extern DWORD WINAPI IDirect3DQuer extern HRESULT WINAPI IDirect3DQuery9Impl_Issue(LPDIRECT3DQUERY9 iface, DWORD dwIssueFlags); extern HRESULT WINAPI IDirect3DQuery9Impl_GetData(LPDIRECT3DQUERY9 iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags); - +/* Callbacks */ +extern HRESULT WINAPI D3D9CB_CreateSurface(IUnknown *pDevice, + UINT Width, + UINT Height, + D3DFORMAT Format, + D3DPOOL Pool, + IWineD3DSurface **ppSurface, + HANDLE * pSharedHandle); +extern HRESULT WINAPI D3D9CB_CreateVolume(IUnknown *pDevice, UINT Width, UINT Height, UINT Depth, + D3DFORMAT Format, D3DPOOL Pool, DWORD Usage, + IWineD3DVolume **ppVolume, + HANDLE * pSharedHandle); #endif /* __WINE_D3D9_PRIVATE_H */ Index: wine/dlls/d3d9/cubetexture.c diff -u -p wine/dlls/d3d9/cubetexture.c:1.8 wine/dlls/d3d9/cubetexture.c:1.9 --- wine/dlls/d3d9/cubetexture.c:1.8 Sun May 19 15:10:16 2013 +++ wine/dlls/d3d9/cubetexture.c Sun May 19 15:10:16 2013 @@ -1,7 +1,7 @@ /* * IDirect3DCubeTexture9 implementation * - * Copyright 2002-2003 Jason Edmeades + * Copyright 2002-2005 Jason Edmeades * Raphael Junqueira * * This library is free software; you can redistribute it and/or @@ -44,24 +44,16 @@ HRESULT WINAPI IDirect3DCubeTexture9Impl ULONG WINAPI IDirect3DCubeTexture9Impl_AddRef(LPDIRECT3DCUBETEXTURE9 iface) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; TRACE("(%p) : AddRef from %ld\n", This, This->ref); - return ++(This->ref); + return InterlockedIncrement(&This->ref); } ULONG WINAPI IDirect3DCubeTexture9Impl_Release(LPDIRECT3DCUBETEXTURE9 iface) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - ULONG ref = --This->ref; - unsigned int i, j; + ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); if (ref == 0) { - for (i = 0; i < This->levels; i++) { - for (j = 0; j < 6; j++) { - if (This->surfaces[j][i] != NULL) { - TRACE("(%p) : Releasing surface %p\n", This, This->surfaces[j][i]); - IDirect3DSurface9Impl_Release((LPDIRECT3DSURFACE9) This->surfaces[j][i]); - } - } - } + IWineD3DCubeTexture_Release(This->wineD3DCubeTexture); HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -75,47 +67,43 @@ HRESULT WINAPI IDirect3DCubeTexture9Impl HRESULT WINAPI IDirect3DCubeTexture9Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DCubeTexture_SetPrivateData(This->wineD3DCubeTexture,refguid,pData,SizeOfData,Flags); } HRESULT WINAPI IDirect3DCubeTexture9Impl_GetPrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DCubeTexture_GetPrivateData(This->wineD3DCubeTexture,refguid,pData,pSizeOfData); } HRESULT WINAPI IDirect3DCubeTexture9Impl_FreePrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DCubeTexture_FreePrivateData(This->wineD3DCubeTexture,refguid); } DWORD WINAPI IDirect3DCubeTexture9Impl_SetPriority(LPDIRECT3DCUBETEXTURE9 iface, DWORD PriorityNew) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9) This, PriorityNew); + return IWineD3DCubeTexture_SetPriority(This->wineD3DCubeTexture, PriorityNew); } DWORD WINAPI IDirect3DCubeTexture9Impl_GetPriority(LPDIRECT3DCUBETEXTURE9 iface) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9) This); + return IWineD3DCubeTexture_GetPriority(This->wineD3DCubeTexture); } void WINAPI IDirect3DCubeTexture9Impl_PreLoad(LPDIRECT3DCUBETEXTURE9 iface) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return ; + return IWineD3DCubeTexture_PreLoad(This->wineD3DCubeTexture); } D3DRESOURCETYPE WINAPI IDirect3DCubeTexture9Impl_GetType(LPDIRECT3DCUBETEXTURE9 iface) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9) This); + return IWineD3DCubeTexture_GetType(This->wineD3DCubeTexture); } /* IDirect3DCubeTexture9 IDirect3DBaseTexture9 Interface follow: */ DWORD WINAPI IDirect3DCubeTexture9Impl_SetLOD(LPDIRECT3DCUBETEXTURE9 iface, DWORD LODNew) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - return IDirect3DBaseTexture9Impl_SetLOD((LPDIRECT3DBASETEXTURE9) This, LODNew); + return IWineD3DCubeTexture_SetLOD(This->wineD3DCubeTexture, LODNew); } DWORD WINAPI IDirect3DCubeTexture9Impl_GetLOD(LPDIRECT3DCUBETEXTURE9 iface) { @@ -125,86 +113,71 @@ DWORD WINAPI IDirect3DCubeTexture9Impl_G DWORD WINAPI IDirect3DCubeTexture9Impl_GetLevelCount(LPDIRECT3DCUBETEXTURE9 iface) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - return IDirect3DBaseTexture9Impl_GetLevelCount((LPDIRECT3DBASETEXTURE9) This); + return IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture); } HRESULT WINAPI IDirect3DCubeTexture9Impl_SetAutoGenFilterType(LPDIRECT3DCUBETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - return IDirect3DBaseTexture9Impl_SetAutoGenFilterType((LPDIRECT3DBASETEXTURE9) This, FilterType); + IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + return IWineD3DCubeTexture_SetAutoGenFilterType(This->wineD3DCubeTexture, FilterType); } D3DTEXTUREFILTERTYPE WINAPI IDirect3DCubeTexture9Impl_GetAutoGenFilterType(LPDIRECT3DCUBETEXTURE9 iface) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - return IDirect3DBaseTexture9Impl_GetAutoGenFilterType((LPDIRECT3DBASETEXTURE9) This); + IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + return IWineD3DCubeTexture_GetAutoGenFilterType(This->wineD3DCubeTexture); } void WINAPI IDirect3DCubeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DCUBETEXTURE9 iface) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return ; + IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + return IWineD3DCubeTexture_GenerateMipSubLevels(This->wineD3DCubeTexture); } /* IDirect3DCubeTexture9 Interface follow: */ HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - if (Level < This->levels) { - TRACE("(%p) level (%d)\n", This, Level); - return IDirect3DSurface9Impl_GetDesc((LPDIRECT3DSURFACE9) This->surfaces[0][Level], pDesc); - } - FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); - return D3DERR_INVALIDCALL; - return D3D_OK; + WINED3DSURFACE_DESC wined3ddesc; + UINT tmpInt = -1; + + /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */ + wined3ddesc.Format = &pDesc->Format; + wined3ddesc.Type = &pDesc->Type; + wined3ddesc.Usage = &pDesc->Usage; + wined3ddesc.Pool = &pDesc->Pool; + wined3ddesc.Size = &tmpInt; + wined3ddesc.MultiSampleType = &pDesc->MultiSampleType; + wined3ddesc.MultiSampleQuality = &pDesc->MultiSampleQuality; + wined3ddesc.Width = &pDesc->Width; + wined3ddesc.Height = &pDesc->Height; + + return IWineD3DCubeTexture_GetLevelDesc(This->wineD3DCubeTexture, Level, &wined3ddesc); } HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9** ppCubeMapSurface) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - if (Level < This->levels) { - *ppCubeMapSurface = (LPDIRECT3DSURFACE9) This->surfaces[FaceType][Level]; - IDirect3DSurface9Impl_AddRef((LPDIRECT3DSURFACE9) *ppCubeMapSurface); - TRACE("(%p) -> faceType(%d) level(%d) returning surface@%p \n", This, FaceType, Level, This->surfaces[FaceType][Level]); - } else { - FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); - return D3DERR_INVALIDCALL; + HRESULT hrc = D3D_OK; + + IWineD3DSurface *mySurface = NULL; + hrc = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, FaceType, Level, &mySurface); + if (hrc == D3D_OK) { + IWineD3DCubeTexture_GetParent(mySurface, (IUnknown **)ppCubeMapSurface); + IWineD3DCubeTexture_Release(mySurface); } - return D3D_OK; + return hrc; } HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { - HRESULT hr; IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - if (Level < This->levels) { - /** - * Not dirtified while Surfaces don't notify dirtification - * This->Dirty = TRUE; - */ - hr = IDirect3DSurface9Impl_LockRect((LPDIRECT3DSURFACE9) This->surfaces[FaceType][Level], pLockedRect, pRect, Flags); - TRACE("(%p) -> faceType(%d) level(%d) returning memory@%p success(%lu)\n", This, FaceType, Level, pLockedRect->pBits, hr); - } else { - FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); - return D3DERR_INVALIDCALL; - } - return hr; + return IWineD3DCubeTexture_LockRect(This->wineD3DCubeTexture, FaceType, Level, pLockedRect, pRect, Flags); } HRESULT WINAPI IDirect3DCubeTexture9Impl_UnlockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level) { - HRESULT hr; IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - if (Level < This->levels) { - hr = IDirect3DSurface9Impl_UnlockRect((LPDIRECT3DSURFACE9) This->surfaces[FaceType][Level]); - TRACE("(%p) -> faceType(%d) level(%d) success(%lu)\n", This, FaceType, Level, hr); - } else { - FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); - return D3DERR_INVALIDCALL; - } - return hr; + return IWineD3DCubeTexture_UnlockRect(This->wineD3DCubeTexture, FaceType, Level); } HRESULT WINAPI IDirect3DCubeTexture9Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - This->Dirty = TRUE; - return D3D_OK; + return IWineD3DCubeTexture_AddDirtyRect(This->wineD3DCubeTexture, FaceType, pDirtyRect); } @@ -238,10 +211,20 @@ IDirect3DCubeTexture9Vtbl Direct3DCubeTe /* IDirect3DDevice9 IDirect3DCubeTexture9 Methods follow: */ HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9 iface, UINT EdgeLength, UINT Levels, DWORD Usage, - D3DFORMAT Format, D3DPOOL Pool, + D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle) { + IDirect3DCubeTexture9Impl *object; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - FIXME("(%p) : stub\n", This); + + /* Allocate the storage for the device */ + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DCubeTexture9Impl)); + object->lpVtbl = &Direct3DCubeTexture9_Vtbl; + object->ref = 1; + IWineD3DDevice_CreateCubeTexture(This->WineD3DDevice, EdgeLength, Levels, Usage, + Format, Pool, &(object->wineD3DCubeTexture), pSharedHandle, (IUnknown *)object, + D3D9CB_CreateSurface); + + *ppCubeTexture = (LPDIRECT3DCUBETEXTURE9) object; return D3D_OK; } Index: wine/dlls/d3d9/basetexture.c diff -u -p wine/dlls/d3d9/basetexture.c:1.7 wine/dlls/d3d9/basetexture.c:1.8 --- wine/dlls/d3d9/basetexture.c:1.7 Sun May 19 15:10:16 2013 +++ wine/dlls/d3d9/basetexture.c Sun May 19 15:10:16 2013 @@ -102,41 +102,34 @@ D3DRESOURCETYPE WINAPI IDirect3DBaseText /* IDirect3DBaseTexture9 Interface follow: */ DWORD WINAPI IDirect3DBaseTexture9Impl_SetLOD(LPDIRECT3DBASETEXTURE9 iface, DWORD LODNew) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return 0; + return IWineD3DBaseTexture_SetLOD(This->wineD3DBaseTexture, LODNew); } DWORD WINAPI IDirect3DBaseTexture9Impl_GetLOD(LPDIRECT3DBASETEXTURE9 iface) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return 0; + return IWineD3DBaseTexture_GetLOD(This->wineD3DBaseTexture); } DWORD WINAPI IDirect3DBaseTexture9Impl_GetLevelCount(LPDIRECT3DBASETEXTURE9 iface) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return 0; + return IWineD3DBaseTexture_GetLevelCount(This->wineD3DBaseTexture); } HRESULT WINAPI IDirect3DBaseTexture9Impl_SetAutoGenFilterType(LPDIRECT3DBASETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) { - IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + return IWineD3DBaseTexture_SetAutoGenFilterType(This->wineD3DBaseTexture, FilterType); } D3DTEXTUREFILTERTYPE WINAPI IDirect3DBaseTexture9Impl_GetAutoGenFilterType(LPDIRECT3DBASETEXTURE9 iface) { - IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3DTEXF_NONE; + IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + return IWineD3DBaseTexture_GetAutoGenFilterType(This->wineD3DBaseTexture); } void WINAPI IDirect3DBaseTexture9Impl_GenerateMipSubLevels(LPDIRECT3DBASETEXTURE9 iface) { - IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return ; + IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + return IWineD3DBaseTexture_GenerateMipSubLevels(This->wineD3DBaseTexture); } - IDirect3DBaseTexture9Vtbl Direct3DBaseTexture9_Vtbl = { IDirect3DBaseTexture9Impl_QueryInterface, Index: wine/dlls/wined3d/volumetexture.c diff -u -p /dev/null wine/dlls/wined3d/volumetexture.c:1.1 --- /dev/null Sun May 19 15:10:16 2013 +++ wine/dlls/wined3d/volumetexture.c Sun May 19 15:10:16 2013 @@ -0,0 +1,295 @@ +/* + * IDirect3DVolumeTexture9 implementation + * + * Copyright 2002-2005 Jason Edmeades + * Raphael Junqueira + * + * 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); +#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info + +/* ******************************************* + IWineD3DTexture IUnknown parts follow + ******************************************* */ +HRESULT WINAPI IWineD3DVolumeTextureImpl_QueryInterface(IWineD3DVolumeTexture *iface, REFIID riid, LPVOID *ppobj) +{ + IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface; + WARN("(%p)->(%s,%p) should not be called\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IWineD3DVolumeTextureImpl_AddRef(IWineD3DVolumeTexture *iface) { + IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface; + TRACE("(%p) : AddRef increasing from %ld\n", This, This->resource.ref); + IUnknown_AddRef(This->resource.parent); + return InterlockedIncrement(&This->resource.ref); +} + +ULONG WINAPI IWineD3DVolumeTextureImpl_Release(IWineD3DVolumeTexture *iface) { + IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface; + ULONG ref; + int i; + TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref); + ref = InterlockedDecrement(&This->resource.ref); + if (ref == 0) { + for (i = 0; i < This->baseTexture.levels; i++) { + if (This->volumes[i] != NULL) { + TRACE("(%p) : Releasing volume %p\n", This, This->volumes[i]); + IWineD3DVolume_Release((IWineD3DSurface *) This->volumes[i]); + } + } + IWineD3DDevice_Release((IWineD3DDevice *)This->resource.wineD3DDevice); + HeapFree(GetProcessHeap(), 0, This); + } else { + IUnknown_Release(This->resource.parent); /* Released the reference to the d3dx object */ + } + return ref; +} + +/* **************************************************** + IWineD3DVolumeTexture IWineD3DResource parts follow + **************************************************** */ +HRESULT WINAPI IWineD3DVolumeTextureImpl_GetDevice(IWineD3DVolumeTexture *iface, IWineD3DDevice** ppDevice) { + return IWineD3DResourceImpl_GetDevice((IWineD3DResource *)iface, ppDevice); +} + +HRESULT WINAPI IWineD3DVolumeTextureImpl_SetPrivateData(IWineD3DVolumeTexture *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { + return IWineD3DResourceImpl_SetPrivateData((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags); +} + +HRESULT WINAPI IWineD3DVolumeTextureImpl_GetPrivateData(IWineD3DVolumeTexture *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { + return IWineD3DResourceImpl_GetPrivateData((IWineD3DResource *)iface, refguid, pData, pSizeOfData); +} + +HRESULT WINAPI IWineD3DVolumeTextureImpl_FreePrivateData(IWineD3DVolumeTexture *iface, REFGUID refguid) { + return IWineD3DResourceImpl_FreePrivateData((IWineD3DResource *)iface, refguid); +} + +DWORD WINAPI IWineD3DVolumeTextureImpl_SetPriority(IWineD3DVolumeTexture *iface, DWORD PriorityNew) { + return IWineD3DResourceImpl_SetPriority((IWineD3DResource *)iface, PriorityNew); +} + +DWORD WINAPI IWineD3DVolumeTextureImpl_GetPriority(IWineD3DVolumeTexture *iface) { + return IWineD3DResourceImpl_GetPriority((IWineD3DResource *)iface); +} + +void WINAPI IWineD3DVolumeTextureImpl_PreLoad(IWineD3DVolumeTexture *iface) { + /* Overrider the IWineD3DResource Preload method */ + unsigned int i; + IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface; + + TRACE("(%p) : About to load texture\n", This); + + ENTER_GL(); + + for (i = 0; i < This->baseTexture.levels; i++) { + + if (i == 0 && This->volumes[i]->textureName != 0 && This->baseTexture.dirty == FALSE) { + glBindTexture(GL_TEXTURE_3D, This->volumes[i]->textureName); + checkGLcall("glBindTexture"); + TRACE("Texture %p (level %d) given name %d\n", This->volumes[i], i, This->volumes[i]->textureName); + /* No need to walk through all mip-map levels, since already all assigned */ + i = This->baseTexture.levels; + + } else { + + if (i == 0) { + if (This->volumes[i]->textureName == 0) { + glGenTextures(1, &This->volumes[i]->textureName); + checkGLcall("glGenTextures"); + TRACE("Texture %p (level %d) given name %d\n", This->volumes[i], i, This->volumes[i]->textureName); + } + + glBindTexture(GL_TEXTURE_3D, This->volumes[i]->textureName); + checkGLcall("glBindTexture"); + + TRACE("Setting GL_TEXTURE_MAX_LEVEL to %d\n", This->baseTexture.levels - 1); + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAX_LEVEL, This->baseTexture.levels - 1); + checkGLcall("glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAX_LEVEL, This->levels - 1)"); + } + + TRACE("Calling glTexImage3D %x i=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p\n", + GL_TEXTURE_3D, + i, + D3DFmt2GLIntFmt(This->resource.wineD3DDevice, This->volumes[i]->currentDesc.Format), + This->volumes[i]->currentDesc.Width, + This->volumes[i]->currentDesc.Height, + This->volumes[i]->currentDesc.Depth, + 0, + D3DFmt2GLFmt(This->resource.wineD3DDevice, This->volumes[i]->currentDesc.Format), + D3DFmt2GLType(This->resource.wineD3DDevice, This->volumes[i]->currentDesc.Format), + This->volumes[i]->allocatedMemory); + glTexImage3D(GL_TEXTURE_3D, + i, + D3DFmt2GLIntFmt(This->resource.wineD3DDevice, This->volumes[i]->currentDesc.Format), + This->volumes[i]->currentDesc.Width, + This->volumes[i]->currentDesc.Height, + This->volumes[i]->currentDesc.Depth, + 0, + D3DFmt2GLFmt(This->resource.wineD3DDevice, This->volumes[i]->currentDesc.Format), + D3DFmt2GLType(This->resource.wineD3DDevice, This->volumes[i]->currentDesc.Format), + This->volumes[i]->allocatedMemory); + checkGLcall("glTexImage3D"); + + This->baseTexture.dirty = FALSE; + } + } + + LEAVE_GL(); + + return ; +} + +D3DRESOURCETYPE WINAPI IWineD3DVolumeTextureImpl_GetType(IWineD3DVolumeTexture *iface) { + return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface); +} + +HRESULT WINAPI IWineD3DVolumeTextureImpl_GetParent(IWineD3DVolumeTexture *iface, IUnknown **pParent) { + return IWineD3DResourceImpl_GetParent((IWineD3DResource *)iface, pParent); +} + +/* ****************************************************** + IWineD3DVolumeTexture IWineD3DBaseTexture parts follow + ****************************************************** */ +DWORD WINAPI IWineD3DVolumeTextureImpl_SetLOD(IWineD3DVolumeTexture *iface, DWORD LODNew) { + return IWineD3DBaseTextureImpl_SetLOD((IWineD3DBaseTexture *)iface, LODNew); +} + +DWORD WINAPI IWineD3DVolumeTextureImpl_GetLOD(IWineD3DVolumeTexture *iface) { + return IWineD3DBaseTextureImpl_GetLOD((IWineD3DBaseTexture *)iface); +} + +DWORD WINAPI IWineD3DVolumeTextureImpl_GetLevelCount(IWineD3DVolumeTexture *iface) { + return IWineD3DBaseTextureImpl_GetLevelCount((IWineD3DBaseTexture *)iface); +} + +HRESULT WINAPI IWineD3DVolumeTextureImpl_SetAutoGenFilterType(IWineD3DVolumeTexture *iface, D3DTEXTUREFILTERTYPE FilterType) { + return IWineD3DBaseTextureImpl_SetAutoGenFilterType((IWineD3DBaseTexture *)iface, FilterType); +} + +D3DTEXTUREFILTERTYPE WINAPI IWineD3DVolumeTextureImpl_GetAutoGenFilterType(IWineD3DVolumeTexture *iface) { + return IWineD3DBaseTextureImpl_GetAutoGenFilterType((IWineD3DBaseTexture *)iface); +} + +void WINAPI IWineD3DVolumeTextureImpl_GenerateMipSubLevels(IWineD3DVolumeTexture *iface) { + return IWineD3DBaseTextureImpl_GenerateMipSubLevels((IWineD3DBaseTexture *)iface); +} + +/* Internal function, No d3d mapping */ +BOOL WINAPI IWineD3DVolumeTextureImpl_SetDirty(IWineD3DVolumeTexture *iface, BOOL dirty) { + return IWineD3DBaseTextureImpl_SetDirty((IWineD3DBaseTexture *)iface, TRUE); +} + +BOOL WINAPI IWineD3DVolumeTextureImpl_GetDirty(IWineD3DVolumeTexture *iface) { + return IWineD3DBaseTextureImpl_GetDirty((IWineD3DBaseTexture *)iface); +} + +/* ******************************************* + IWineD3DVolumeTexture IWineD3DVolumeTexture parts follow + ******************************************* */ +HRESULT WINAPI IWineD3DVolumeTextureImpl_GetLevelDesc(IWineD3DVolumeTexture *iface, UINT Level,WINED3DVOLUME_DESC *pDesc) { + IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface; + if (Level < This->baseTexture.levels) { + TRACE("(%p) Level (%d)\n", This, Level); + return IWineD3DVolume_GetDesc((IWineD3DVolume *) This->volumes[Level], pDesc); + } else { + FIXME("(%p) Level (%d)\n", This, Level); + } + return D3D_OK; +} +HRESULT WINAPI IWineD3DVolumeTextureImpl_GetVolumeLevel(IWineD3DVolumeTexture *iface, UINT Level, IWineD3DVolume** ppVolumeLevel) { + IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface; + if (Level < This->baseTexture.levels) { + *ppVolumeLevel = (IWineD3DVolume *)This->volumes[Level]; + IWineD3DVolume_AddRef((IWineD3DVolume *) *ppVolumeLevel); + TRACE("(%p) -> level(%d) returning volume@%p\n", This, Level, *ppVolumeLevel); + } else { + FIXME("(%p) Level(%d) overflow Levels(%d)\n", This, Level, This->baseTexture.levels); + return D3DERR_INVALIDCALL; + } + return D3D_OK; + +} +HRESULT WINAPI IWineD3DVolumeTextureImpl_LockBox(IWineD3DVolumeTexture *iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) { + HRESULT hr; + IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface; + + if (Level < This->baseTexture.levels) { + hr = IWineD3DVolume_LockBox((IWineD3DVolume *)This->volumes[Level], pLockedVolume, pBox, Flags); + TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr); + + } else { + FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->baseTexture.levels); + return D3DERR_INVALIDCALL; + } + return hr; +} + +HRESULT WINAPI IWineD3DVolumeTextureImpl_UnlockBox(IWineD3DVolumeTexture *iface, UINT Level) { + HRESULT hr; + IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface; + + if (Level < This->baseTexture.levels) { + hr = IWineD3DVolume_UnlockBox((IWineD3DVolume*) This->volumes[Level]); + TRACE("(%p) -> level(%d) success(%lu)\n", This, Level, hr); + + } else { + FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->baseTexture.levels); + return D3DERR_INVALIDCALL; + } + return hr; +} + +HRESULT WINAPI IWineD3DVolumeTextureImpl_AddDirtyBox(IWineD3DVolumeTexture *iface, CONST D3DBOX* pDirtyBox) { + IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface; + This->baseTexture.dirty = TRUE; + TRACE("(%p) : dirtyfication of volume Level (0)\n", This); + return IWineD3DVolume_AddDirtyBox((IWineD3DVolume *) This->volumes[0], pDirtyBox); +} + + +IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl = +{ + IWineD3DVolumeTextureImpl_QueryInterface, + IWineD3DVolumeTextureImpl_AddRef, + IWineD3DVolumeTextureImpl_Release, + IWineD3DVolumeTextureImpl_GetParent, + IWineD3DVolumeTextureImpl_GetDevice, + IWineD3DVolumeTextureImpl_SetPrivateData, + IWineD3DVolumeTextureImpl_GetPrivateData, + IWineD3DVolumeTextureImpl_FreePrivateData, + IWineD3DVolumeTextureImpl_SetPriority, + IWineD3DVolumeTextureImpl_GetPriority, + IWineD3DVolumeTextureImpl_PreLoad, + IWineD3DVolumeTextureImpl_GetType, + IWineD3DVolumeTextureImpl_SetLOD, + IWineD3DVolumeTextureImpl_GetLOD, + IWineD3DVolumeTextureImpl_GetLevelCount, + IWineD3DVolumeTextureImpl_SetAutoGenFilterType, + IWineD3DVolumeTextureImpl_GetAutoGenFilterType, + IWineD3DVolumeTextureImpl_GenerateMipSubLevels, + IWineD3DVolumeTextureImpl_SetDirty, + IWineD3DVolumeTextureImpl_GetDirty, + IWineD3DVolumeTextureImpl_GetLevelDesc, + IWineD3DVolumeTextureImpl_GetVolumeLevel, + IWineD3DVolumeTextureImpl_LockBox, + IWineD3DVolumeTextureImpl_UnlockBox, + IWineD3DVolumeTextureImpl_AddDirtyBox +}; Index: wine/dlls/wined3d/volume.c diff -u -p /dev/null wine/dlls/wined3d/volume.c:1.1 --- /dev/null Sun May 19 15:10:16 2013 +++ wine/dlls/wined3d/volume.c Sun May 19 15:10:16 2013 @@ -0,0 +1,245 @@ +/* + * IWineD3DVolume implementation + * + * Copyright 2002-2005 Jason Edmeades + * Raphael Junqueira + * + * 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); +#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->wineD3DDevice)->wineD3D))->gl_info + +/* ******************************************* + IWineD3DVolume IUnknown parts follow + ******************************************* */ +HRESULT WINAPI IWineD3DVolumeImpl_QueryInterface(IWineD3DVolume *iface, REFIID riid, LPVOID *ppobj) +{ + IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; + WARN("(%p)->(%s,%p) should not be called\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IWineD3DVolumeImpl_AddRef(IWineD3DVolume *iface) { + IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; + TRACE("(%p) : AddRef increasing from %ld\n", This, This->ref); + IUnknown_AddRef(This->parent); + return InterlockedIncrement(&This->ref); +} + +ULONG WINAPI IWineD3DVolumeImpl_Release(IWineD3DVolume *iface) { + IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; + ULONG ref; + TRACE("(%p) : Releasing from %ld\n", This, This->ref); + ref = InterlockedDecrement(&This->ref); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This->allocatedMemory); + IWineD3DDevice_Release((IWineD3DDevice *)This->wineD3DDevice); + HeapFree(GetProcessHeap(), 0, This); + } else { + IUnknown_Release(This->parent); /* Released the reference to the d3dx object */ + } + return ref; +} + +/* ******************************************* + IWineD3DVolume parts follow + ******************************************* */ +HRESULT WINAPI IWineD3DVolumeImpl_GetParent(IWineD3DVolume *iface, IUnknown **pParent) { + IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; + IUnknown_AddRef(This->parent); + *pParent = This->parent; + return D3D_OK; +} + +HRESULT WINAPI IWineD3DVolumeImpl_GetDevice(IWineD3DVolume *iface, IWineD3DDevice** ppDevice) { + IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; + TRACE("(%p) : returning %p\n", This, This->wineD3DDevice); + + *ppDevice = (IWineD3DDevice *) This->wineD3DDevice; + IWineD3DDevice_AddRef(*ppDevice); + + return D3D_OK; +} + +HRESULT WINAPI IWineD3DVolumeImpl_SetPrivateData(IWineD3DVolume *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { + IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; + FIXME("(%p) : stub\n", This); + return D3D_OK; +} + +HRESULT WINAPI IWineD3DVolumeImpl_GetPrivateData(IWineD3DVolume *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { + IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; + FIXME("(%p) : stub\n", This); + return D3D_OK; +} + +HRESULT WINAPI IWineD3DVolumeImpl_FreePrivateData(IWineD3DVolume *iface, REFGUID refguid) { + IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; + FIXME("(%p) : stub\n", This); + return D3D_OK; +} + +HRESULT WINAPI IWineD3DVolumeImpl_GetContainer(IWineD3DVolume *iface, REFIID riid, void** ppContainer) { + IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; + TRACE("(%p) : returning %p\n", This, This->container); + *ppContainer = This->container; + IUnknown_AddRef(This->container); + return D3D_OK; +} + +HRESULT WINAPI IWineD3DVolumeImpl_GetDesc(IWineD3DVolume *iface, WINED3DVOLUME_DESC* pDesc) { + IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; + TRACE("(%p) : copying into %p\n", This, pDesc); + + *(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; /* dx8 only */ + *(pDesc->Width) = This->currentDesc.Width; + *(pDesc->Height) = This->currentDesc.Height; + *(pDesc->Depth) = This->currentDesc.Depth; + return D3D_OK; +} + +HRESULT WINAPI IWineD3DVolumeImpl_LockBox(IWineD3DVolume *iface, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) { + IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; + FIXME("(%p) : pBox=%p stub\n", This, pBox); + + /* fixme: should we really lock as such? */ + TRACE("(%p) : box=%p, output pbox=%p, allMem=%p\n", This, pBox, pLockedVolume, This->allocatedMemory); + + pLockedVolume->RowPitch = This->bytesPerPixel * This->currentDesc.Width; /* Bytes / row */ + pLockedVolume->SlicePitch = This->bytesPerPixel * This->currentDesc.Width * This->currentDesc.Height; /* Bytes / slice */ + if (!pBox) { + TRACE("No box supplied - all is ok\n"); + pLockedVolume->pBits = This->allocatedMemory; + This->lockedBox.Left = 0; + This->lockedBox.Top = 0; + This->lockedBox.Front = 0; + This->lockedBox.Right = This->currentDesc.Width; + This->lockedBox.Bottom = This->currentDesc.Height; + This->lockedBox.Back = This->currentDesc.Depth; + } else { + TRACE("Lock Box (%p) = l %d, t %d, r %d, b %d, fr %d, ba %d\n", pBox, pBox->Left, pBox->Top, pBox->Right, pBox->Bottom, pBox->Front, pBox->Back); + pLockedVolume->pBits = This->allocatedMemory + + (pLockedVolume->SlicePitch * pBox->Front) + /* FIXME: is front < back or vica versa? */ + (pLockedVolume->RowPitch * pBox->Top) + + (pBox->Left * This->bytesPerPixel); + This->lockedBox.Left = pBox->Left; + This->lockedBox.Top = pBox->Top; + This->lockedBox.Front = pBox->Front; + This->lockedBox.Right = pBox->Right; + This->lockedBox.Bottom = pBox->Bottom; + This->lockedBox.Back = pBox->Back; + } + + if (Flags & (D3DLOCK_NO_DIRTY_UPDATE | D3DLOCK_READONLY)) { + /* Don't dirtify */ + } else { + /** + * Dirtify on lock + * as seen in msdn docs + */ + IWineD3DVolume_AddDirtyBox(iface, &This->lockedBox); + + /** Dirtify Container if needed */ + if (NULL != This->container) { + + IWineD3DVolumeTexture *cont = (IWineD3DVolumeTexture*) This->container; + D3DRESOURCETYPE containerType = IWineD3DBaseTexture_GetType((IWineD3DBaseTexture *) cont); + + if (containerType == D3DRTYPE_VOLUMETEXTURE) { + IWineD3DBaseTextureImpl* pTexture = (IWineD3DBaseTextureImpl*) cont; + pTexture->baseTexture.dirty = TRUE; + } else { + FIXME("Set dirty on container type %d\n", containerType); + } + } + } + + This->locked = TRUE; + TRACE("returning memory@%p rpitch(%d) spitch(%d)\n", pLockedVolume->pBits, pLockedVolume->RowPitch, pLockedVolume->SlicePitch); + return D3D_OK; +} + +HRESULT WINAPI IWineD3DVolumeImpl_UnlockBox(IWineD3DVolume *iface) { + IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; + if (FALSE == This->locked) { + ERR("trying to lock unlocked volume@%p\n", This); + return D3DERR_INVALIDCALL; + } + TRACE("(%p) : unlocking volume\n", This); + This->locked = FALSE; + memset(&This->lockedBox, 0, sizeof(RECT)); + return D3D_OK; +} + +/* Internal use functions follow : */ + +HRESULT WINAPI IWineD3DVolumeImpl_CleanDirtyBox(IWineD3DVolume *iface) { + IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; + This->dirty = FALSE; + This->lockedBox.Left = This->currentDesc.Width; + This->lockedBox.Top = This->currentDesc.Height; + This->lockedBox.Front = This->currentDesc.Depth; + This->lockedBox.Right = 0; + This->lockedBox.Bottom = 0; + This->lockedBox.Back = 0; + return D3D_OK; +} + +HRESULT WINAPI IWineD3DVolumeImpl_AddDirtyBox(IWineD3DVolume *iface, CONST D3DBOX* pDirtyBox) { + IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; + This->dirty = TRUE; + if (NULL != pDirtyBox) { + This->lockedBox.Left = min(This->lockedBox.Left, pDirtyBox->Left); + This->lockedBox.Top = min(This->lockedBox.Top, pDirtyBox->Top); + This->lockedBox.Front = min(This->lockedBox.Front, pDirtyBox->Front); + This->lockedBox.Right = max(This->lockedBox.Right, pDirtyBox->Right); + This->lockedBox.Bottom = max(This->lockedBox.Bottom, pDirtyBox->Bottom); + This->lockedBox.Back = max(This->lockedBox.Back, pDirtyBox->Back); + } else { + This->lockedBox.Left = 0; + This->lockedBox.Top = 0; + This->lockedBox.Front = 0; + This->lockedBox.Right = This->currentDesc.Width; + This->lockedBox.Bottom = This->currentDesc.Height; + This->lockedBox.Back = This->currentDesc.Depth; + } + return D3D_OK; +} + +IWineD3DVolumeVtbl IWineD3DVolume_Vtbl = +{ + IWineD3DVolumeImpl_QueryInterface, + IWineD3DVolumeImpl_AddRef, + IWineD3DVolumeImpl_Release, + IWineD3DVolumeImpl_GetParent, + IWineD3DVolumeImpl_GetDevice, + IWineD3DVolumeImpl_SetPrivateData, + IWineD3DVolumeImpl_GetPrivateData, + IWineD3DVolumeImpl_FreePrivateData, + IWineD3DVolumeImpl_GetContainer, + IWineD3DVolumeImpl_GetDesc, + IWineD3DVolumeImpl_LockBox, + IWineD3DVolumeImpl_UnlockBox, + IWineD3DVolumeImpl_AddDirtyBox, + IWineD3DVolumeImpl_CleanDirtyBox +}; Index: wine/dlls/wined3d/texture.c diff -u -p /dev/null wine/dlls/wined3d/texture.c:1.1 --- /dev/null Sun May 19 15:10:16 2013 +++ wine/dlls/wined3d/texture.c Sun May 19 15:10:16 2013 @@ -0,0 +1,270 @@ +/* + * IDirect3DTexture9 implementation + * + * Copyright 2002-2005 Jason Edmeades + * Raphael Junqueira + * + * 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); +#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info + +/* ******************************************* + IWineD3DTexture IUnknown parts follow + ******************************************* */ +HRESULT WINAPI IWineD3DTextureImpl_QueryInterface(IWineD3DTexture *iface, REFIID riid, LPVOID *ppobj) +{ + IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; + WARN("(%p)->(%s,%p) should not be called\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IWineD3DTextureImpl_AddRef(IWineD3DTexture *iface) { + IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; + TRACE("(%p) : AddRef increasing from %ld\n", This, This->resource.ref); + IUnknown_AddRef(This->resource.parent); + return InterlockedIncrement(&This->resource.ref); +} + +ULONG WINAPI IWineD3DTextureImpl_Release(IWineD3DTexture *iface) { + IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; + ULONG ref; + TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref); + ref = InterlockedDecrement(&This->resource.ref); + if (ref == 0) { + int i; + for (i = 0; i < This->baseTexture.levels; i++) { + if (This->surfaces[i] != NULL) { + TRACE("(%p) : Releasing surface %p\n", This, This->surfaces[i]); + IWineD3DSurface_Release((IWineD3DSurface *) This->surfaces[i]); + } + } + IWineD3DDevice_Release((IWineD3DDevice *)This->resource.wineD3DDevice); + HeapFree(GetProcessHeap(), 0, This); + } else { + IUnknown_Release(This->resource.parent); /* Released the reference to the d3dx object */ + } + return ref; +} + +/* **************************************************** + IWineD3DTexture IWineD3DResource parts follow + **************************************************** */ +HRESULT WINAPI IWineD3DTextureImpl_GetDevice(IWineD3DTexture *iface, IWineD3DDevice** ppDevice) { + return IWineD3DResourceImpl_GetDevice((IWineD3DResource *)iface, ppDevice); +} + +HRESULT WINAPI IWineD3DTextureImpl_SetPrivateData(IWineD3DTexture *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { + return IWineD3DResourceImpl_SetPrivateData((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags); +} + +HRESULT WINAPI IWineD3DTextureImpl_GetPrivateData(IWineD3DTexture *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { + return IWineD3DResourceImpl_GetPrivateData((IWineD3DResource *)iface, refguid, pData, pSizeOfData); +} + +HRESULT WINAPI IWineD3DTextureImpl_FreePrivateData(IWineD3DTexture *iface, REFGUID refguid) { + return IWineD3DResourceImpl_FreePrivateData((IWineD3DResource *)iface, refguid); +} + +DWORD WINAPI IWineD3DTextureImpl_SetPriority(IWineD3DTexture *iface, DWORD PriorityNew) { + return IWineD3DResourceImpl_SetPriority((IWineD3DResource *)iface, PriorityNew); +} + +DWORD WINAPI IWineD3DTextureImpl_GetPriority(IWineD3DTexture *iface) { + return IWineD3DResourceImpl_GetPriority((IWineD3DResource *)iface); +} + +void WINAPI IWineD3DTextureImpl_PreLoad(IWineD3DTexture *iface) { + /* Override the IWineD3DResource Preload method */ + unsigned int i; + IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; + + TRACE("(%p) : About to load texture\n", This); + + ENTER_GL(); + + for (i = 0; i < This->baseTexture.levels; i++) { + if (i == 0 && This->surfaces[i]->textureName != 0 && This->baseTexture.dirty == FALSE) { + glBindTexture(GL_TEXTURE_2D, This->surfaces[i]->textureName); + checkGLcall("glBindTexture"); + TRACE("Texture %p (level %d) given name %d\n", This->surfaces[i], i, This->surfaces[i]->textureName); + /* No need to walk through all mip-map levels, since already all assigned */ + i = This->baseTexture.levels; + + } else { + if (i == 0) { + if (This->surfaces[i]->textureName == 0) { + glGenTextures(1, &This->surfaces[i]->textureName); + checkGLcall("glGenTextures"); + TRACE("Texture %p (level %d) given name %d\n", This->surfaces[i], i, This->surfaces[i]->textureName); + } + + glBindTexture(GL_TEXTURE_2D, This->surfaces[i]->textureName); + checkGLcall("glBindTexture"); + } + IWineD3DSurface_LoadTexture((IWineD3DSurface *) This->surfaces[i], GL_TEXTURE_2D, i); + } + } + + /* No longer dirty */ + This->baseTexture.dirty = FALSE; + + /* Always need to reset the number of mipmap levels when rebinding as it is + a property of the active texture unit, and another texture may have set it + to a different value */ + TRACE("Setting GL_TEXTURE_MAX_LEVEL to %d\n", This->baseTexture.levels - 1); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, This->baseTexture.levels - 1); + checkGLcall("glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, This->levels)"); + + LEAVE_GL(); + + return ; +} + +D3DRESOURCETYPE WINAPI IWineD3DTextureImpl_GetType(IWineD3DTexture *iface) { + return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface); +} + +HRESULT WINAPI IWineD3DTextureImpl_GetParent(IWineD3DTexture *iface, IUnknown **pParent) { + return IWineD3DResourceImpl_GetParent((IWineD3DResource *)iface, pParent); +} + +/* ****************************************************** + IWineD3DTexture IWineD3DBaseTexture parts follow + ****************************************************** */ +DWORD WINAPI IWineD3DTextureImpl_SetLOD(IWineD3DTexture *iface, DWORD LODNew) { + return IWineD3DBaseTextureImpl_SetLOD((IWineD3DBaseTexture *)iface, LODNew); +} + +DWORD WINAPI IWineD3DTextureImpl_GetLOD(IWineD3DTexture *iface) { + return IWineD3DBaseTextureImpl_GetLOD((IWineD3DBaseTexture *)iface); +} + +DWORD WINAPI IWineD3DTextureImpl_GetLevelCount(IWineD3DTexture *iface) { + return IWineD3DBaseTextureImpl_GetLevelCount((IWineD3DBaseTexture *)iface); +} + +HRESULT WINAPI IWineD3DTextureImpl_SetAutoGenFilterType(IWineD3DTexture *iface, D3DTEXTUREFILTERTYPE FilterType) { + return IWineD3DBaseTextureImpl_SetAutoGenFilterType((IWineD3DBaseTexture *)iface, FilterType); +} + +D3DTEXTUREFILTERTYPE WINAPI IWineD3DTextureImpl_GetAutoGenFilterType(IWineD3DTexture *iface) { + return IWineD3DBaseTextureImpl_GetAutoGenFilterType((IWineD3DBaseTexture *)iface); +} + +void WINAPI IWineD3DTextureImpl_GenerateMipSubLevels(IWineD3DTexture *iface) { + return IWineD3DBaseTextureImpl_GenerateMipSubLevels((IWineD3DBaseTexture *)iface); +} + +/* Internal function, No d3d mapping */ +BOOL WINAPI IWineD3DTextureImpl_SetDirty(IWineD3DTexture *iface, BOOL dirty) { + return IWineD3DBaseTextureImpl_SetDirty((IWineD3DBaseTexture *)iface, TRUE); +} + +BOOL WINAPI IWineD3DTextureImpl_GetDirty(IWineD3DTexture *iface) { + return IWineD3DBaseTextureImpl_GetDirty((IWineD3DBaseTexture *)iface); +} + +/* ******************************************* + IWineD3DTexture IWineD3DTexture parts follow + ******************************************* */ +HRESULT WINAPI IWineD3DTextureImpl_GetLevelDesc(IWineD3DTexture *iface, UINT Level, WINED3DSURFACE_DESC* pDesc) { + IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; + + if (Level < This->baseTexture.levels) { + TRACE("(%p) Level (%d)\n", This, Level); + return IWineD3DSurface_GetDesc((IWineD3DSurface *) This->surfaces[Level], pDesc); + } + FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->baseTexture.levels); + return D3DERR_INVALIDCALL; +} + +HRESULT WINAPI IWineD3DTextureImpl_GetSurfaceLevel(IWineD3DTexture *iface, UINT Level, IWineD3DSurface** ppSurfaceLevel) { + IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; + *ppSurfaceLevel = (IWineD3DSurface *) This->surfaces[Level]; + IWineD3DSurface_AddRef((IWineD3DSurface *) This->surfaces[Level]); + TRACE("(%p) : returning %p for level %d\n", This, *ppSurfaceLevel, Level); + return D3D_OK; +} + +HRESULT WINAPI IWineD3DTextureImpl_LockRect(IWineD3DTexture *iface, UINT Level, D3DLOCKED_RECT *pLockedRect, + CONST RECT *pRect, DWORD Flags) { + HRESULT hr; + IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; + + if (Level < This->baseTexture.levels) { + + hr = IWineD3DSurface_LockRect((IWineD3DSurface *) This->surfaces[Level], pLockedRect, pRect, Flags); + TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr); + } else { + FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->baseTexture.levels); + return D3DERR_INVALIDCALL; + } + return hr; +} + +HRESULT WINAPI IWineD3DTextureImpl_UnlockRect(IWineD3DTexture *iface, UINT Level) { + HRESULT hr; + IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; + + if (Level < This->baseTexture.levels) { + hr = IWineD3DSurface_UnlockRect((IWineD3DSurface *) This->surfaces[Level]); + TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr); + } else { + FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->baseTexture.levels); + return D3DERR_INVALIDCALL; + } + return hr; +} + +HRESULT WINAPI IWineD3DTextureImpl_AddDirtyRect(IWineD3DTexture *iface, CONST RECT* pDirtyRect) { + IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; + This->baseTexture.dirty = TRUE; + TRACE("(%p) : dirtyfication of surface Level (0)\n", This); + return IWineD3DSurface_AddDirtyRect((IWineD3DSurface *)This->surfaces[0], pDirtyRect); +} + +IWineD3DTextureVtbl IWineD3DTexture_Vtbl = +{ + IWineD3DTextureImpl_QueryInterface, + IWineD3DTextureImpl_AddRef, + IWineD3DTextureImpl_Release, + IWineD3DTextureImpl_GetParent, + IWineD3DTextureImpl_GetDevice, + IWineD3DTextureImpl_SetPrivateData, + IWineD3DTextureImpl_GetPrivateData, + IWineD3DTextureImpl_FreePrivateData, + IWineD3DTextureImpl_SetPriority, + IWineD3DTextureImpl_GetPriority, + IWineD3DTextureImpl_PreLoad, + IWineD3DTextureImpl_GetType, + IWineD3DTextureImpl_SetLOD, + IWineD3DTextureImpl_GetLOD, + IWineD3DTextureImpl_GetLevelCount, + IWineD3DTextureImpl_SetAutoGenFilterType, + IWineD3DTextureImpl_GetAutoGenFilterType, + IWineD3DTextureImpl_GenerateMipSubLevels, + IWineD3DTextureImpl_SetDirty, + IWineD3DTextureImpl_GetDirty, + IWineD3DTextureImpl_GetLevelDesc, + IWineD3DTextureImpl_GetSurfaceLevel, + IWineD3DTextureImpl_LockRect, + IWineD3DTextureImpl_UnlockRect, + IWineD3DTextureImpl_AddDirtyRect +}; Index: wine/dlls/wined3d/cubetexture.c diff -u -p /dev/null wine/dlls/wined3d/cubetexture.c:1.1 --- /dev/null Sun May 19 15:10:16 2013 +++ wine/dlls/wined3d/cubetexture.c Sun May 19 15:10:16 2013 @@ -0,0 +1,300 @@ +/* + * IDirect3DCubeTexture9 implementation + * + * Copyright 2002-2005 Jason Edmeades + * Raphael Junqueira + * + * 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); +#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info + +static const GLenum cube_targets[6] = { +#if defined(GL_VERSION_1_3) + GL_TEXTURE_CUBE_MAP_POSITIVE_X, + GL_TEXTURE_CUBE_MAP_NEGATIVE_X, + GL_TEXTURE_CUBE_MAP_POSITIVE_Y, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, + GL_TEXTURE_CUBE_MAP_POSITIVE_Z, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z +#else + GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, + GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, + GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, + GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB +#endif +}; + +/* ******************************************* + IWineD3DCubeTexture IUnknown parts follow + ******************************************* */ +HRESULT WINAPI IWineD3DCubeTextureImpl_QueryInterface(IWineD3DCubeTexture *iface, REFIID riid, LPVOID *ppobj) +{ + IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface; + WARN("(%p)->(%s,%p) should not be called\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +ULONG WINAPI IWineD3DCubeTextureImpl_AddRef(IWineD3DCubeTexture *iface) { + IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface; + TRACE("(%p) : AddRef increasing from %ld\n", This, This->resource.ref); + IUnknown_AddRef(This->resource.parent); + return InterlockedIncrement(&This->resource.ref); +} + +ULONG WINAPI IWineD3DCubeTextureImpl_Release(IWineD3DCubeTexture *iface) { + IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface; + ULONG ref; + TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref); + ref = InterlockedDecrement(&This->resource.ref); + if (ref == 0) { + int i,j; + for (i = 0; i < This->baseTexture.levels; i++) { + for (j = 0; j < 6; j++) { + if (This->surfaces[j][i] != NULL) { + TRACE("(%p) : Releasing surface %p\n", This, This->surfaces[j][i]); + IWineD3DSurface_Release((IWineD3DSurface *) This->surfaces[j][i]); + } + } + } + IWineD3DDevice_Release((IWineD3DDevice *)This->resource.wineD3DDevice); + HeapFree(GetProcessHeap(), 0, This); + } else { + IUnknown_Release(This->resource.parent); /* Released the reference to the d3dx object */ + } + return ref; +} + +/* **************************************************** + IWineD3DCubeTexture IWineD3DResource parts follow + **************************************************** */ +HRESULT WINAPI IWineD3DCubeTextureImpl_GetDevice(IWineD3DCubeTexture *iface, IWineD3DDevice** ppDevice) { + return IWineD3DResourceImpl_GetDevice((IWineD3DResource *)iface, ppDevice); +} + +HRESULT WINAPI IWineD3DCubeTextureImpl_SetPrivateData(IWineD3DCubeTexture *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { + return IWineD3DResourceImpl_SetPrivateData((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags); +} + +HRESULT WINAPI IWineD3DCubeTextureImpl_GetPrivateData(IWineD3DCubeTexture *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { + return IWineD3DResourceImpl_GetPrivateData((IWineD3DResource *)iface, refguid, pData, pSizeOfData); +} + +HRESULT WINAPI IWineD3DCubeTextureImpl_FreePrivateData(IWineD3DCubeTexture *iface, REFGUID refguid) { + return IWineD3DResourceImpl_FreePrivateData((IWineD3DResource *)iface, refguid); +} + +DWORD WINAPI IWineD3DCubeTextureImpl_SetPriority(IWineD3DCubeTexture *iface, DWORD PriorityNew) { + return IWineD3DResourceImpl_SetPriority((IWineD3DResource *)iface, PriorityNew); +} + +DWORD WINAPI IWineD3DCubeTextureImpl_GetPriority(IWineD3DCubeTexture *iface) { + return IWineD3DResourceImpl_GetPriority((IWineD3DResource *)iface); +} + +void WINAPI IWineD3DCubeTextureImpl_PreLoad(IWineD3DCubeTexture *iface) { + /* Override the IWineD3DResource Preload method */ + unsigned int i,j; + IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface; + + TRACE("(%p) : About to load texture: dirtified(%d)\n", This, This->baseTexture.dirty); + + ENTER_GL(); + + for (i = 0; i < This->baseTexture.levels; i++) { + if (i == 0 && This->surfaces[0][0]->textureName != 0 && This->baseTexture.dirty == FALSE) { + glEnable(GL_TEXTURE_CUBE_MAP_ARB); + glBindTexture(GLTEXTURECUBEMAP, This->surfaces[0][0]->textureName); + checkGLcall("glBindTexture"); + TRACE("Texture %p (level %d) given name %d\n", This->surfaces[0][0], i, This->surfaces[0][0]->textureName); + /* No need to walk through all mip-map levels, since already all assigned */ + i = This->baseTexture.levels; + + } else { + if (i == 0) { + if (This->surfaces[0][0]->textureName == 0) { + glGenTextures(1, &This->surfaces[0][0]->textureName); + checkGLcall("glGenTextures"); + TRACE("Texture %p (level %d) given name %d\n", This->surfaces[0][i], i, This->surfaces[0][0]->textureName); + } + + glBindTexture(GLTEXTURECUBEMAP, This->surfaces[0][0]->textureName); + checkGLcall("glBindTexture"); + + TRACE("Setting GL_TEXTURE_MAX_LEVEL to %d\n", This->baseTexture.levels - 1); + glTexParameteri(GLTEXTURECUBEMAP, GL_TEXTURE_MAX_LEVEL, This->baseTexture.levels - 1); + checkGLcall("glTexParameteri(GL_TEXTURE_CUBE, GL_TEXTURE_MAX_LEVEL, This->levels - 1)"); + } + + for (j = 0; j < 6; j++) { + IWineD3DSurface_LoadTexture((IWineD3DSurface *) This->surfaces[j][i], cube_targets[j], i); +#if 0 + static int gen = 0; + char buffer[4096]; + snprintf(buffer, sizeof(buffer), "/tmp/cube%d_face%d_level%d_%d.png", This->surfaces[0][0]->textureName, j, i, ++gen); + IWineD3DSurfaceImpl_SaveSnapshot((IWineD3DSurface *) This->surfaces[j][i], buffer); +#endif + } + /* Removed glTexParameterf now TextureStageStates are initialized at startup */ + This->baseTexture.dirty = FALSE; + } + } + + LEAVE_GL(); + + return ; +} + +D3DRESOURCETYPE WINAPI IWineD3DCubeTextureImpl_GetType(IWineD3DCubeTexture *iface) { + return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface); +} + +HRESULT WINAPI IWineD3DCubeTextureImpl_GetParent(IWineD3DCubeTexture *iface, IUnknown **pParent) { + return IWineD3DResourceImpl_GetParent((IWineD3DResource *)iface, pParent); +} + +/* ****************************************************** + IWineD3DCubeTexture IWineD3DBaseTexture parts follow + ****************************************************** */ +DWORD WINAPI IWineD3DCubeTextureImpl_SetLOD(IWineD3DCubeTexture *iface, DWORD LODNew) { + return IWineD3DBaseTextureImpl_SetLOD((IWineD3DBaseTexture *)iface, LODNew); +} + +DWORD WINAPI IWineD3DCubeTextureImpl_GetLOD(IWineD3DCubeTexture *iface) { + return IWineD3DBaseTextureImpl_GetLOD((IWineD3DBaseTexture *)iface); +} + +DWORD WINAPI IWineD3DCubeTextureImpl_GetLevelCount(IWineD3DCubeTexture *iface) { + return IWineD3DBaseTextureImpl_GetLevelCount((IWineD3DBaseTexture *)iface); +} + +HRESULT WINAPI IWineD3DCubeTextureImpl_SetAutoGenFilterType(IWineD3DCubeTexture *iface, D3DTEXTUREFILTERTYPE FilterType) { + return IWineD3DBaseTextureImpl_SetAutoGenFilterType((IWineD3DBaseTexture *)iface, FilterType); +} + +D3DTEXTUREFILTERTYPE WINAPI IWineD3DCubeTextureImpl_GetAutoGenFilterType(IWineD3DCubeTexture *iface) { + return IWineD3DBaseTextureImpl_GetAutoGenFilterType((IWineD3DBaseTexture *)iface); +} + +void WINAPI IWineD3DCubeTextureImpl_GenerateMipSubLevels(IWineD3DCubeTexture *iface) { + return IWineD3DBaseTextureImpl_GenerateMipSubLevels((IWineD3DBaseTexture *)iface); +} + +/* Internal function, No d3d mapping */ +BOOL WINAPI IWineD3DCubeTextureImpl_SetDirty(IWineD3DCubeTexture *iface, BOOL dirty) { + return IWineD3DBaseTextureImpl_SetDirty((IWineD3DBaseTexture *)iface, TRUE); +} + +BOOL WINAPI IWineD3DCubeTextureImpl_GetDirty(IWineD3DCubeTexture *iface) { + return IWineD3DBaseTextureImpl_GetDirty((IWineD3DBaseTexture *)iface); +} + +/* ******************************************* + IWineD3DCubeTexture IWineD3DCubeTexture parts follow + ******************************************* */ +HRESULT WINAPI IWineD3DCubeTextureImpl_GetLevelDesc(IWineD3DCubeTexture *iface, UINT Level, WINED3DSURFACE_DESC* pDesc) { + IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface; + + if (Level < This->baseTexture.levels) { + TRACE("(%p) level (%d)\n", This, Level); + return IWineD3DSurface_GetDesc((IWineD3DSurface *) This->surfaces[0][Level], pDesc); + } + FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->baseTexture.levels); + return D3DERR_INVALIDCALL; +} + +HRESULT WINAPI IWineD3DCubeTextureImpl_GetCubeMapSurface(IWineD3DCubeTexture *iface, D3DCUBEMAP_FACES FaceType, UINT Level, IWineD3DSurface** ppCubeMapSurface) { + IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface; + if (Level < This->baseTexture.levels) { + *ppCubeMapSurface = (IWineD3DSurface *) This->surfaces[FaceType][Level]; + IWineD3DSurface_AddRef((IWineD3DSurface *) *ppCubeMapSurface); + TRACE("(%p) -> faceType(%d) level(%d) returning surface@%p \n", This, FaceType, Level, This->surfaces[FaceType][Level]); + } else { + FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->baseTexture.levels); + return D3DERR_INVALIDCALL; + } + return D3D_OK; +} + +HRESULT WINAPI IWineD3DCubeTextureImpl_LockRect(IWineD3DCubeTexture *iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { + HRESULT hr; + IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface; + + if (Level < This->baseTexture.levels) { + hr = IWineD3DSurface_LockRect((IWineD3DSurface *) This->surfaces[FaceType][Level], pLockedRect, pRect, Flags); + TRACE("(%p) -> faceType(%d) level(%d) returning memory@%p success(%lu)\n", This, FaceType, Level, pLockedRect->pBits, hr); + } else { + FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->baseTexture.levels); + return D3DERR_INVALIDCALL; + } + return hr; +} + +HRESULT WINAPI IWineD3DCubeTextureImpl_UnlockRect(IWineD3DCubeTexture *iface, D3DCUBEMAP_FACES FaceType, UINT Level) { + HRESULT hr; + IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface; + + if (Level < This->baseTexture.levels) { + hr = IWineD3DSurface_UnlockRect((IWineD3DSurface *) This->surfaces[FaceType][Level]); + TRACE("(%p) -> faceType(%d) level(%d) success(%lu)\n", This, FaceType, Level, hr); + } else { + FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->baseTexture.levels); + return D3DERR_INVALIDCALL; + } + return hr; +} + +HRESULT WINAPI IWineD3DCubeTextureImpl_AddDirtyRect(IWineD3DCubeTexture *iface, D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect) { + IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface; + This->baseTexture.dirty = TRUE; + TRACE("(%p) : dirtyfication of faceType(%d) Level (0)\n", This, FaceType); + return IWineD3DSurface_AddDirtyRect((IWineD3DSurface *) This->surfaces[FaceType][0], pDirtyRect); +} + + +IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl = +{ + IWineD3DCubeTextureImpl_QueryInterface, + IWineD3DCubeTextureImpl_AddRef, + IWineD3DCubeTextureImpl_Release, + IWineD3DCubeTextureImpl_GetParent, + IWineD3DCubeTextureImpl_GetDevice, + IWineD3DCubeTextureImpl_SetPrivateData, + IWineD3DCubeTextureImpl_GetPrivateData, + IWineD3DCubeTextureImpl_FreePrivateData, + IWineD3DCubeTextureImpl_SetPriority, + IWineD3DCubeTextureImpl_GetPriority, + IWineD3DCubeTextureImpl_PreLoad, + IWineD3DCubeTextureImpl_GetType, + IWineD3DCubeTextureImpl_SetLOD, + IWineD3DCubeTextureImpl_GetLOD, + IWineD3DCubeTextureImpl_GetLevelCount, + IWineD3DCubeTextureImpl_SetAutoGenFilterType, + IWineD3DCubeTextureImpl_GetAutoGenFilterType, + IWineD3DCubeTextureImpl_GenerateMipSubLevels, + IWineD3DCubeTextureImpl_SetDirty, + IWineD3DCubeTextureImpl_GetDirty, + IWineD3DCubeTextureImpl_GetLevelDesc, + IWineD3DCubeTextureImpl_GetCubeMapSurface, + IWineD3DCubeTextureImpl_LockRect, + IWineD3DCubeTextureImpl_UnlockRect, + IWineD3DCubeTextureImpl_AddDirtyRect +};