Commit eb36d31d authored by Raphael Junqueira's avatar Raphael Junqueira Committed by Alexandre Julliard

- surface pool init fixes

- minor indentation and traces fixes - fix locking/unlocking/dirty behavior (dirtify on lock) + optimisations (only copy when dirty) - fix IDirect3DDevice8::Clear behavior (problem seen after a locking/unlocking code error) - begin to fix volume and cube textures management
parent a872c781
......@@ -86,23 +86,28 @@ HRESULT WINAPI IDirect3DCubeTexture8Impl_GetDevice(LPDIRECT3DCUBETEXTURE
}
HRESULT WINAPI IDirect3DCubeTexture8Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DCubeTexture8Impl_GetPrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DCubeTexture8Impl_FreePrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid) {
ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
DWORD WINAPI IDirect3DCubeTexture8Impl_SetPriority(LPDIRECT3DCUBETEXTURE8 iface, DWORD PriorityNew) {
ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
DWORD WINAPI IDirect3DCubeTexture8Impl_GetPriority(LPDIRECT3DCUBETEXTURE8 iface) {
ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
void WINAPI IDirect3DCubeTexture8Impl_PreLoad(LPDIRECT3DCUBETEXTURE8 iface) {
ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
......@@ -134,36 +139,62 @@ DWORD WINAPI IDirect3DCubeTexture8Impl_GetLevelCount(LPDIRECT3DCUBETEX
}
/* IDirect3DCubeTexture8 */
HRESULT WINAPI IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE8 iface,UINT Level,D3DSURFACE_DESC *pDesc) {
HRESULT WINAPI IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE8 iface, UINT Level, D3DSURFACE_DESC* pDesc) {
ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
if (Level < This->levels) {
TRACE("(%p) Level (%d)\n", This, Level);
return IDirect3DSurface8Impl_GetDesc((LPDIRECT3DSURFACE8)This->surfaces[Level], pDesc);
TRACE("(%p) level (%d)\n", This, Level);
return IDirect3DSurface8Impl_GetDesc((LPDIRECT3DSURFACE8) This->surfaces[Level], pDesc);
} else {
FIXME("(%p) Level (%d)\n", This, Level);
FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
return D3DERR_INVALIDCALL;
}
return D3D_OK;
}
HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE8 iface,D3DCUBEMAP_FACES FaceType,UINT Level,IDirect3DSurface8** ppCubeMapSurface) {
HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface8** ppCubeMapSurface) {
ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
TRACE("(%p) : returning %p\n", This, This->surfaces[FaceType][Level]);
*ppCubeMapSurface = (LPDIRECT3DSURFACE8) This->surfaces[FaceType][Level];
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8)This->surfaces[FaceType][Level]);
if (Level < This->levels) {
*ppCubeMapSurface = (LPDIRECT3DSURFACE8) This->surfaces[FaceType][Level];
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) *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;
}
return D3D_OK;
}
HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(LPDIRECT3DCUBETEXTURE8 iface,D3DCUBEMAP_FACES FaceType,UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) {
HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
HRESULT hr;
ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
FIXME("(%p) : stub\n", This); return D3D_OK;
if (Level < This->levels) {
/**
* Not dirtified while Surfaces don't notify dirtification
* This->Dirty = TRUE;
*/
hr = IDirect3DSurface8_LockRect((LPDIRECT3DSURFACE8) 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;
}
HRESULT WINAPI IDirect3DCubeTexture8Impl_UnlockRect(LPDIRECT3DCUBETEXTURE8 iface,D3DCUBEMAP_FACES FaceType,UINT Level) {
HRESULT WINAPI IDirect3DCubeTexture8Impl_UnlockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level) {
HRESULT hr;
ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
This->Dirty = TRUE;
FIXME("(%p) : stub\n", This); return D3D_OK;
if (Level < This->levels) {
hr = IDirect3DSurface8_UnlockRect((LPDIRECT3DSURFACE8) This->surfaces[FaceType][Level]);
FIXME("(%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;
}
HRESULT WINAPI IDirect3DCubeTexture8Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE8 iface,D3DCUBEMAP_FACES FaceType,CONST RECT* pDirtyRect) {
HRESULT WINAPI IDirect3DCubeTexture8Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect) {
ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
This->Dirty = TRUE;
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
......
......@@ -455,10 +455,13 @@ struct IDirect3DSwapChain8Impl
DWORD ref;
/* IDirect3DSwapChain8 fields */
IDirect3DSurface8Impl *frontBuffer;
IDirect3DSurface8Impl *backBuffer;
D3DPRESENT_PARAMETERS PresentParms;
};
/* IUnknown: */
extern HRESULT WINAPI IDirect3DSwapChain8Impl_QueryInterface(LPDIRECT3DSWAPCHAIN8 iface,REFIID refiid,LPVOID *obj);
extern HRESULT WINAPI IDirect3DSwapChain8Impl_QueryInterface(LPDIRECT3DSWAPCHAIN8 iface, REFIID refiid, LPVOID *obj);
extern ULONG WINAPI IDirect3DSwapChain8Impl_AddRef(LPDIRECT3DSWAPCHAIN8 iface);
extern ULONG WINAPI IDirect3DSwapChain8Impl_Release(LPDIRECT3DSWAPCHAIN8 iface);
......@@ -497,6 +500,7 @@ struct IDirect3DSurface8Impl
BOOL lockable;
BOOL locked;
RECT lockedRect;
BOOL Dirty;
};
/* IUnknown: */
......@@ -669,6 +673,8 @@ struct IDirect3DBaseTexture8Impl
D3DRESOURCETYPE ResourceType;
/* IDirect3DBaseTexture8 fields */
BOOL Dirty;
/*
*BOOL isManaged;
*DWORD lod;
......@@ -718,6 +724,7 @@ struct IDirect3DCubeTexture8Impl
D3DRESOURCETYPE ResourceType;
/* IDirect3DBaseTexture8 fields */
BOOL Dirty;
/* IDirect3DCubeTexture8 fields */
UINT edgeLength;
......@@ -726,7 +733,6 @@ struct IDirect3DCubeTexture8Impl
D3DFORMAT format;
IDirect3DSurface8Impl *surfaces[6][MAX_LEVELS];
BOOL Dirty;
};
/* IUnknown: */
......@@ -779,6 +785,7 @@ struct IDirect3DTexture8Impl
D3DRESOURCETYPE ResourceType;
/* IDirect3DBaseTexture8 fields */
BOOL Dirty;
/* IDirect3DTexture8 fields */
UINT width;
......@@ -787,9 +794,7 @@ struct IDirect3DTexture8Impl
DWORD usage;
D3DFORMAT format;
IDirect3DDevice8Impl *device;
IDirect3DSurface8Impl *surfaces[MAX_LEVELS];
BOOL Dirty;
};
/* IUnknown: */
......@@ -842,6 +847,7 @@ struct IDirect3DVolumeTexture8Impl
D3DRESOURCETYPE ResourceType;
/* IDirect3DBaseTexture8 fields */
BOOL Dirty;
/* IDirect3DVolumeTexture8 fields */
UINT width;
......@@ -852,7 +858,6 @@ struct IDirect3DVolumeTexture8Impl
D3DFORMAT format;
IDirect3DVolume8Impl *volumes[MAX_LEVELS];
BOOL Dirty;
};
/* IUnknown: */
......
......@@ -31,8 +31,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
/* trace: */
#if 1
# define VTRACE(A) FIXME A
#if 0
# define VTRACE(A) TRACE A
#else
# define VTRACE(A)
#endif
......@@ -85,15 +85,18 @@ HRESULT WINAPI IDirect3DSurface8Impl_GetDevice(LPDIRECT3DSURFACE8 iface, IDirect
}
HRESULT WINAPI IDirect3DSurface8Impl_SetPrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
ICOM_THIS(IDirect3DSurface8Impl,iface);
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DSurface8Impl_GetPrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
ICOM_THIS(IDirect3DSurface8Impl,iface);
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DSurface8Impl_FreePrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid) {
ICOM_THIS(IDirect3DSurface8Impl,iface);
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DSurface8Impl_GetContainer(LPDIRECT3DSURFACE8 iface, REFIID riid, void** ppContainer) {
ICOM_THIS(IDirect3DSurface8Impl,iface);
......@@ -118,7 +121,9 @@ HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(LPDIRECT3DSURFACE8 iface, D3DSURFAC
return D3D_OK;
}
HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
HRESULT hr;
ICOM_THIS(IDirect3DSurface8Impl,iface);
/* fixme: should we really lock as such? */
if (FALSE == This->lockable) {
......@@ -126,7 +131,7 @@ HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D3DLOCKE
return D3DERR_INVALIDCALL;
}
TRACE("(%p) : rect=%p, output prect=%p, allMem=%p\n", This, pRect, pLockedRect, This->allocatedMemory);
TRACE("(%p) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->allocatedMemory);
pLockedRect->Pitch = This->bytesPerPixel * This->myDesc.Width; /* Bytes / row */
......@@ -146,7 +151,6 @@ HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D3DLOCKE
}
if (0 == This->myDesc.Usage) { /* classic surface */
/* Nothing to do ;) */
......@@ -227,13 +231,43 @@ HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D3DLOCKE
FIXME("unsupported locking to surface surf@%p usage(%lu)\n", This, This->myDesc.Usage);
}
if (Flags & (D3DLOCK_NO_DIRTY_UPDATE | D3DLOCK_READONLY)) {
/* Dont dirtify */
} else {
/**
* Dirtify on lock
* as seen in msdn docs
*/
This->Dirty = TRUE;
/** Dirtify Container if needed */
if (NULL != This->Container) {
IDirect3DBaseTexture8* cont = NULL;
hr = IUnknown_QueryInterface(This->Container, &IID_IDirect3DBaseTexture8, (void**) &cont);
if (SUCCEEDED(hr) && NULL != cont) {
/* Now setup the texture appropraitly */
D3DRESOURCETYPE containerType = IDirect3DBaseTexture8Impl_GetType(cont);
if (containerType == D3DRTYPE_TEXTURE) {
IDirect3DTexture8Impl* pTexture = (IDirect3DTexture8Impl*) cont;
pTexture->Dirty = TRUE;
} else if (containerType == D3DRTYPE_CUBETEXTURE) {
IDirect3DCubeTexture8Impl* pTexture = (IDirect3DCubeTexture8Impl*) cont;
pTexture->Dirty = TRUE;
} else {
FIXME("Set dirty on container type %d\n", containerType);
}
IDirect3DBaseTexture8_Release(cont);
cont = NULL;
}
}
}
TRACE("returning pBits=%p, pitch=%d\n", pLockedRect->pBits, pLockedRect->Pitch);
This->locked = TRUE;
return D3D_OK;
}
HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(LPDIRECT3DSURFACE8 iface) {
HRESULT hr;
ICOM_THIS(IDirect3DSurface8Impl,iface);
if (FALSE == This->locked) {
......@@ -241,10 +275,17 @@ HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(LPDIRECT3DSURFACE8 iface) {
return D3DERR_INVALIDCALL;
}
TRACE("(%p) : stub\n", This);
TRACE("(%p) : see if behavior is correct\n", This);
if (FALSE == This->Dirty) {
TRACE("(%p) : Not Dirtified so nothing to do, return now\n", This);
goto unlock_end;
}
if (0 == This->myDesc.Usage) { /* classic surface */
#if 0
if (This->Container) {
HRESULT hr;
IDirect3DBaseTexture8* cont = NULL;
hr = IUnknown_QueryInterface(This->Container, &IID_IDirect3DBaseTexture8, (void**) &cont);
......@@ -252,18 +293,19 @@ HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(LPDIRECT3DSURFACE8 iface) {
/* Now setup the texture appropraitly */
int containerType = IDirect3DBaseTexture8Impl_GetType(cont);
if (containerType == D3DRTYPE_TEXTURE) {
IDirect3DTexture8Impl *pTexture = (IDirect3DTexture8Impl *)cont;
pTexture->Dirty = TRUE;
IDirect3DTexture8Impl *pTexture = (IDirect3DTexture8Impl *)cont;
pTexture->Dirty = TRUE;
} else if (containerType == D3DRTYPE_CUBETEXTURE) {
IDirect3DCubeTexture8Impl *pTexture = (IDirect3DCubeTexture8Impl *)cont;
pTexture->Dirty = TRUE;
IDirect3DCubeTexture8Impl *pTexture = (IDirect3DCubeTexture8Impl *)cont;
pTexture->Dirty = TRUE;
} else {
FIXME("Set dirty on container type %d\n", containerType);
FIXME("Set dirty on container type %d\n", containerType);
}
IDirect3DBaseTexture8_Release(cont);
cont = NULL;
}
}
#endif
} else if (D3DUSAGE_RENDERTARGET & This->myDesc.Usage) { /* render surfaces */
if (This == This->Device->backBuffer || This == This->Device->frontBuffer) {
......@@ -336,6 +378,8 @@ HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(LPDIRECT3DSURFACE8 iface) {
} else {
FIXME("unsupported unlocking to surface surf@%p usage(%lu)\n", This, This->myDesc.Usage);
}
unlock_end:
This->locked = FALSE;
return D3D_OK;
}
......
......@@ -192,30 +192,36 @@ HRESULT WINAPI IDirect3DTexture8Impl_GetLevelDesc(LPDIRECT3DTEXTURE8 ifa
HRESULT WINAPI IDirect3DTexture8Impl_GetSurfaceLevel(LPDIRECT3DTEXTURE8 iface, UINT Level,IDirect3DSurface8** ppSurfaceLevel) {
ICOM_THIS(IDirect3DTexture8Impl,iface);
*ppSurfaceLevel = (LPDIRECT3DSURFACE8)This->surfaces[Level];
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8)This->surfaces[Level]);
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) This->surfaces[Level]);
TRACE("(%p) : returning %p for level %d\n", This, *ppSurfaceLevel, Level);
return D3D_OK;
}
HRESULT WINAPI IDirect3DTexture8Impl_LockRect(LPDIRECT3DTEXTURE8 iface, UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) {
HRESULT hr;
ICOM_THIS(IDirect3DTexture8Impl,iface);
TRACE("(%p) Level (%d)\n", This, Level);
if (Level < This->levels) {
return IDirect3DSurface8Impl_LockRect((LPDIRECT3DSURFACE8)This->surfaces[Level], pLockedRect, pRect, Flags);
/**
* Not dirtified while Surfaces don't notify dirtification
* This->Dirty = TRUE;
*/
hr = IDirect3DSurface8Impl_LockRect((LPDIRECT3DSURFACE8) This->surfaces[Level], pLockedRect, pRect, Flags);
TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr);
} else {
FIXME("Levels seems too high?!!\n");
}
return D3D_OK;
return hr;
}
HRESULT WINAPI IDirect3DTexture8Impl_UnlockRect(LPDIRECT3DTEXTURE8 iface, UINT Level) {
ICOM_THIS(IDirect3DTexture8Impl,iface);
This->Dirty = TRUE;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DTexture8Impl_AddDirtyRect(LPDIRECT3DTEXTURE8 iface, CONST RECT* pDirtyRect) {
ICOM_THIS(IDirect3DTexture8Impl,iface);
This->Dirty = TRUE;
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
......
......@@ -77,15 +77,18 @@ HRESULT WINAPI IDirect3DVolume8Impl_GetDevice(LPDIRECT3DVOLUME8 iface, IDirect3D
}
HRESULT WINAPI IDirect3DVolume8Impl_SetPrivateData(LPDIRECT3DVOLUME8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
ICOM_THIS(IDirect3DVolume8Impl,iface);
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DVolume8Impl_GetPrivateData(LPDIRECT3DVOLUME8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
ICOM_THIS(IDirect3DVolume8Impl,iface);
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DVolume8Impl_FreePrivateData(LPDIRECT3DVOLUME8 iface, REFGUID refguid) {
ICOM_THIS(IDirect3DVolume8Impl,iface);
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DVolume8Impl_GetContainer(LPDIRECT3DVOLUME8 iface, REFIID riid, void** ppContainer) {
......@@ -101,7 +104,7 @@ HRESULT WINAPI IDirect3DVolume8Impl_GetDesc(LPDIRECT3DVOLUME8 iface, D3DVOLUME_D
memcpy(pDesc, &This->myDesc, sizeof(D3DVOLUME_DESC));
return D3D_OK;
}
HRESULT WINAPI IDirect3DVolume8Impl_LockBox(LPDIRECT3DVOLUME8 iface, D3DLOCKED_BOX* pLockedVolume,CONST D3DBOX* pBox, DWORD Flags) {
HRESULT WINAPI IDirect3DVolume8Impl_LockBox(LPDIRECT3DVOLUME8 iface, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) {
ICOM_THIS(IDirect3DVolume8Impl,iface);
FIXME("(%p) : pBox=%p stub\n", This, pBox);
......@@ -120,23 +123,45 @@ HRESULT WINAPI IDirect3DVolume8Impl_LockBox(LPDIRECT3DVOLUME8 iface, D3DLOCKED_B
(pLockedVolume->RowPitch * pBox->Top) +
(pBox->Left * This->bytesPerPixel);
}
TRACE("returning pBits=%p, rpitch=%d, spitch=%d\n", pLockedVolume->pBits, pLockedVolume->RowPitch, pLockedVolume->SlicePitch);
if (Flags & (D3DLOCK_NO_DIRTY_UPDATE | D3DLOCK_READONLY)) {
/* Dont dirtify */
} else {
/**
* Dirtify on lock
* as seen in msdn docs
*/
/** Dirtify Container if needed */
if (NULL != This->Container) {
IDirect3DVolumeTexture8* cont = (IDirect3DVolumeTexture8*) This->Container;
D3DRESOURCETYPE containerType = IDirect3DBaseTexture8Impl_GetType((LPDIRECT3DBASETEXTURE8) cont);
if (containerType == D3DRTYPE_VOLUMETEXTURE) {
IDirect3DBaseTexture8Impl* pTexture = (IDirect3DBaseTexture8Impl*) cont;
pTexture->Dirty = TRUE;
} else {
FIXME("Set dirty on container type %d\n", containerType);
}
}
}
TRACE("returning memory@%p rpitch(%d) spitch(%d)\n", pLockedVolume->pBits, pLockedVolume->RowPitch, pLockedVolume->SlicePitch);
return D3D_OK;
}
HRESULT WINAPI IDirect3DVolume8Impl_UnlockBox(LPDIRECT3DVOLUME8 iface) {
ICOM_THIS(IDirect3DVolume8Impl,iface);
TRACE("(%p) : stub\n", This);
#if 0
if (This->Container) {
IDirect3DVolumeTexture8* cont = (IDirect3DVolumeTexture8*) This->Container;
int containerType = IDirect3DBaseTexture8Impl_GetType((LPDIRECT3DBASETEXTURE8) cont);
D3DRESOURCETYPE containerType = IDirect3DBaseTexture8Impl_GetType((LPDIRECT3DBASETEXTURE8) cont);
if (containerType == D3DRTYPE_VOLUMETEXTURE) {
IDirect3DTexture8Impl *pTexture = (IDirect3DTexture8Impl *)cont;
IDirect3DTexture8Impl* pTexture = (IDirect3DTexture8Impl*) cont;
pTexture->Dirty = TRUE;
} else {
FIXME("Set dirty on container type %d\n", containerType);
}
}
#endif
return D3D_OK;
}
......
......@@ -141,33 +141,50 @@ HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetLevelDesc(LPDIRECT3DVOLUME
}
return D3D_OK;
}
HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level,IDirect3DVolume8** ppVolumeLevel) {
HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, IDirect3DVolume8** ppVolumeLevel) {
ICOM_THIS(IDirect3DVolumeTexture8Impl,iface);
IDirect3DVolume8Impl_AddRef((LPDIRECT3DVOLUME8)This->volumes[Level]);
*ppVolumeLevel = (LPDIRECT3DVOLUME8)This->volumes[Level];
TRACE("(%p) : returning %p for level %d\n", This, *ppVolumeLevel, Level);
if (Level < This->levels) {
*ppVolumeLevel = (LPDIRECT3DVOLUME8)This->volumes[Level];
IDirect3DVolume8Impl_AddRef((LPDIRECT3DVOLUME8) *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;
}
return D3D_OK;
}
HRESULT WINAPI IDirect3DVolumeTexture8Impl_LockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level,D3DLOCKED_BOX* pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) {
HRESULT WINAPI IDirect3DVolumeTexture8Impl_LockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) {
HRESULT hr;
ICOM_THIS(IDirect3DVolumeTexture8Impl,iface);
TRACE("(%p) Level (%d)\n", This, Level);
if (Level < This->levels) {
return IDirect3DVolume8Impl_LockBox((LPDIRECT3DVOLUME8)This->volumes[Level], pLockedVolume, pBox, Flags);
/**
* Not dirtified while Surfaces don't notify dirtification
* This->Dirty = TRUE;
*/
hr = IDirect3DVolume8Impl_LockBox((LPDIRECT3DVOLUME8) This->volumes[Level], pLockedVolume, pBox, Flags);
TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr);
} else {
FIXME("Volume Levels seems too high?!!\n");
FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
return D3DERR_INVALIDCALL;
}
return D3D_OK;
return hr;
}
HRESULT WINAPI IDirect3DVolumeTexture8Impl_UnlockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level) {
ICOM_THIS(IDirect3DVolumeTexture8Impl,iface);
This->Dirty = TRUE;
TRACE("(%p) : stub\n", This);
if (Level < This->levels) {
TRACE("(%p) level(%d) stub\n", This, Level);
} else {
FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
return D3DERR_INVALIDCALL;
}
return D3D_OK;
}
HRESULT WINAPI IDirect3DVolumeTexture8Impl_AddDirtyBox(LPDIRECT3DVOLUMETEXTURE8 iface, CONST D3DBOX* pDirtyBox) {
ICOM_THIS(IDirect3DVolumeTexture8Impl,iface);
This->Dirty = TRUE;
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
......
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