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

- 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.
parent d1685b00
......@@ -102,41 +102,34 @@ D3DRESOURCETYPE WINAPI IDirect3DBaseTexture9Impl_GetType(LPDIRECT3DBASETEXTURE9
/* 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,
......
......@@ -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;
/* IDirect3DBaseTexture9 fields */
BOOL Dirty;
D3DFORMAT format;
UINT levels;
/* IDirect3DTexture9 fields */
UINT width;
UINT height;
DWORD usage;
IDirect3DSurface9Impl *surfaces[MAX_LEVELS];
IWineD3DTexture *wineD3DTexture;
};
/* 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 IDirect3DQuery9Impl_GetDataSize(LPDIRECT3DQUERY9 ifac
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 */
......@@ -219,7 +219,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateRenderTarget(LPDIRECT3DDEVICE9 iface
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_ColorFill(LPDIRECT3DDEVICE9 iface, IDirect
}
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;
}
......
......@@ -62,6 +62,7 @@ HRESULT WINAPI IDirect3DResource9Impl_GetDevice(LPDIRECT3DRESOURCE9 iface, IDire
IWineD3DDevice *myDevice = NULL;
IWineD3DResource_GetDevice(This->wineD3DResource, &myDevice);
IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice);
IWineD3DDevice_Release(myDevice);
return D3D_OK;
}
......
......@@ -51,7 +51,7 @@ ULONG WINAPI IDirect3DSurface9Impl_Release(LPDIRECT3DSURFACE9 iface) {
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_GetContainer(LPDIRECT3DSURFACE9 iface, REFI
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_Vtbl =
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;
}
/*
* 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_QueryInterface(LPDIRECT3DVOLUME9 iface, REFI
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_Release(LPDIRECT3DVOLUME9 iface) {
/* 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_Vtbl =
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);
}
......@@ -9,6 +9,7 @@ EXTRALIBS = -ldxguid -luuid @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ @OPENGL_
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@
......
......@@ -60,39 +60,39 @@ ULONG WINAPI IWineD3DBaseTextureImpl_Release(IWineD3DBaseTexture *iface) {
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_SetDirty(IWineD3DBaseTexture *iface, BOOL di
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 IWineD3DBaseTexture_Vtbl =
IWineD3DBaseTextureImpl_SetAutoGenFilterType,
IWineD3DBaseTextureImpl_GetAutoGenFilterType,
IWineD3DBaseTextureImpl_GenerateMipSubLevels,
IWineD3DBaseTextureImpl_SetDirty
IWineD3DBaseTextureImpl_SetDirty,
IWineD3DBaseTextureImpl_GetDirty
};
......@@ -62,39 +62,39 @@ ULONG WINAPI IWineD3DIndexBufferImpl_Release(IWineD3DIndexBuffer *iface) {
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);
}
/* ******************************************************
......
......@@ -62,39 +62,39 @@ ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface) {
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_GetDesc(IWineD3DSurface *iface, WINED3DSURFAC
*(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_CleanDirtyRect(IWineD3DSurface *iface) {
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 IWineD3DSurfaceImpl_AddDirtyRect(IWineD3DSurface *iface, C
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;
}
......
......@@ -271,6 +271,19 @@ const char* debug_d3dtexturestate(DWORD state) {
}
}
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
*/
......
......@@ -62,39 +62,39 @@ ULONG WINAPI IWineD3DVertexBufferImpl_Release(IWineD3DVertexBuffer *iface) {
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);
}
/* ******************************************************
......
/*
* 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
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment