Commit 33025b20 authored by Jason Edmeades's avatar Jason Edmeades Committed by Alexandre Julliard

- Handle failures to allocate storage more gracefully.

- Only prototype the interfaces which are subclassed (I overdid it last time!). - Implement Get/Set Texture and GetBackBuffer, plus device's GetDisplayMode / GetDeviceCaps. - Make some of the d3d9 skeleton code issue fixme's to highlight code which hasn't been migrated yet. - Correct the d3d9 headers for D3DSURFACE_DESC which caused stack corruption in demos.
parent 64d7cb16
...@@ -158,7 +158,7 @@ HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE ...@@ -158,7 +158,7 @@ HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE
IWineD3DSurface *mySurface = NULL; IWineD3DSurface *mySurface = NULL;
hrc = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, FaceType, Level, &mySurface); hrc = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, FaceType, Level, &mySurface);
if (hrc == D3D_OK) { if (hrc == D3D_OK && NULL != ppCubeMapSurface) {
IWineD3DCubeTexture_GetParent(mySurface, (IUnknown **)ppCubeMapSurface); IWineD3DCubeTexture_GetParent(mySurface, (IUnknown **)ppCubeMapSurface);
IWineD3DCubeTexture_Release(mySurface); IWineD3DCubeTexture_Release(mySurface);
} }
...@@ -210,21 +210,35 @@ IDirect3DCubeTexture9Vtbl Direct3DCubeTexture9_Vtbl = ...@@ -210,21 +210,35 @@ IDirect3DCubeTexture9Vtbl Direct3DCubeTexture9_Vtbl =
/* IDirect3DDevice9 IDirect3DCubeTexture9 Methods follow: */ /* IDirect3DDevice9 IDirect3DCubeTexture9 Methods follow: */
HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9 iface, HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9 iface,
UINT EdgeLength, UINT Levels, DWORD Usage, UINT EdgeLength, UINT Levels, DWORD Usage,
D3DFORMAT Format, D3DPOOL Pool, D3DFORMAT Format, D3DPOOL Pool,
IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle) { IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle) {
IDirect3DCubeTexture9Impl *object; IDirect3DCubeTexture9Impl *object;
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hr = D3D_OK;
/* Allocate the storage for the device */ /* Allocate the storage for the device */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DCubeTexture9Impl)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DCubeTexture9Impl));
if (NULL == object) {
FIXME("(%p) allocation of CubeTexture failed\n", This);
*ppCubeTexture = NULL;
return D3DERR_OUTOFVIDEOMEMORY;
}
object->lpVtbl = &Direct3DCubeTexture9_Vtbl; object->lpVtbl = &Direct3DCubeTexture9_Vtbl;
object->ref = 1; object->ref = 1;
IWineD3DDevice_CreateCubeTexture(This->WineD3DDevice, EdgeLength, Levels, Usage, hr = IWineD3DDevice_CreateCubeTexture(This->WineD3DDevice, EdgeLength, Levels, Usage,
Format, Pool, &(object->wineD3DCubeTexture), pSharedHandle, (IUnknown *)object, Format, Pool, &(object->wineD3DCubeTexture), pSharedHandle, (IUnknown *)object,
D3D9CB_CreateSurface); D3D9CB_CreateSurface);
*ppCubeTexture = (LPDIRECT3DCUBETEXTURE9) object; if (hr != D3D_OK) {
return D3D_OK; /* free up object */
FIXME("(%p) call to IWineD3DDevice_CreateCubeTexture failed\n", This);
HeapFree(GetProcessHeap(), 0, object);
*ppCubeTexture = NULL;
} else {
*ppCubeTexture = (LPDIRECT3DCUBETEXTURE9) object;
}
return hr;
} }
...@@ -144,7 +144,7 @@ HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormatConversion(LPDIRECT3D9 iface, U ...@@ -144,7 +144,7 @@ HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormatConversion(LPDIRECT3D9 iface, U
HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps) { HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps) {
IDirect3D9Impl *This = (IDirect3D9Impl *)iface; IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
return IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, (void *)pCaps); return IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, (WINED3DCAPS *)pCaps);
} }
HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9 iface, UINT Adapter) { HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9 iface, UINT Adapter) {
...@@ -165,6 +165,8 @@ HRESULT WINAPI D3D9CB_CreateRenderTarget(IUnknown *device, UINT Width, UINT Heig ...@@ -165,6 +165,8 @@ HRESULT WINAPI D3D9CB_CreateRenderTarget(IUnknown *device, UINT Width, UINT Heig
(IDirect3DSurface9 **)&d3dSurface, pSharedHandle); (IDirect3DSurface9 **)&d3dSurface, pSharedHandle);
if (res == D3D_OK) { if (res == D3D_OK) {
*ppSurface = d3dSurface->wineD3DSurface; *ppSurface = d3dSurface->wineD3DSurface;
} else {
*ppSurface = NULL;
} }
return res; return res;
} }
...@@ -179,14 +181,18 @@ HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3 ...@@ -179,14 +181,18 @@ HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3
/* Check the validity range of the adapter parameter */ /* Check the validity range of the adapter parameter */
if (Adapter >= IDirect3D9Impl_GetAdapterCount(iface)) { if (Adapter >= IDirect3D9Impl_GetAdapterCount(iface)) {
*ppReturnedDeviceInterface = NULL;
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
} }
/* Allocate the storage for the device object */ /* Allocate the storage for the device object */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DDevice9Impl)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DDevice9Impl));
if (NULL == object) { if (NULL == object) {
FIXME("Allocation of memory failed\n");
*ppReturnedDeviceInterface = NULL;
return D3DERR_OUTOFVIDEOMEMORY; return D3DERR_OUTOFVIDEOMEMORY;
} }
object->lpVtbl = &Direct3DDevice9_Vtbl; object->lpVtbl = &Direct3DDevice9_Vtbl;
object->ref = 1; object->ref = 1;
object->direct3d = This; object->direct3d = This;
...@@ -208,10 +214,7 @@ HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3 ...@@ -208,10 +214,7 @@ HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3
localParameters.Flags = &pPresentationParameters->Flags; localParameters.Flags = &pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz; localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = &pPresentationParameters->PresentationInterval; localParameters.PresentationInterval = &pPresentationParameters->PresentationInterval;
IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object, D3D9CB_CreateRenderTarget); return IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object, D3D9CB_CreateRenderTarget);
FIXME("(%p) : incomplete stub\n", This);
return D3D_OK;
} }
IDirect3D9Vtbl Direct3D9_Vtbl = IDirect3D9Vtbl Direct3D9_Vtbl =
......
...@@ -142,13 +142,26 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9 iface, ...@@ -142,13 +142,26 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9 iface,
IDirect3DIndexBuffer9Impl *object; IDirect3DIndexBuffer9Impl *object;
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hrc = D3D_OK;
/* Allocate the storage for the device */ /* Allocate the storage for the device */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DIndexBuffer9Impl)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DIndexBuffer9Impl));
if (NULL == object) {
FIXME("Allocation of memory failed\n");
*ppIndexBuffer = NULL;
return D3DERR_OUTOFVIDEOMEMORY;
}
object->lpVtbl = &Direct3DIndexBuffer9_Vtbl; object->lpVtbl = &Direct3DIndexBuffer9_Vtbl;
object->ref = 1; object->ref = 1;
IWineD3DDevice_CreateIndexBuffer(This->WineD3DDevice, Length, Usage, Format, Pool, &(object->wineD3DIndexBuffer), pSharedHandle, (IUnknown *)object); hrc = IWineD3DDevice_CreateIndexBuffer(This->WineD3DDevice, Length, Usage, Format, Pool, &(object->wineD3DIndexBuffer), pSharedHandle, (IUnknown *)object);
if (hrc != D3D_OK) {
*ppIndexBuffer = (LPDIRECT3DINDEXBUFFER9) object; /* free up object */
return D3D_OK; FIXME("(%p) call to IWineD3DDevice_CreateIndexBuffer failed\n", This);
HeapFree(GetProcessHeap(), 0, object);
*ppIndexBuffer = NULL;
} else {
*ppIndexBuffer = (LPDIRECT3DINDEXBUFFER9) object;
}
return hrc;
} }
...@@ -204,6 +204,8 @@ HRESULT WINAPI D3D9CB_CreateSurface(IUnknown *pDevice, ...@@ -204,6 +204,8 @@ HRESULT WINAPI D3D9CB_CreateSurface(IUnknown *pDevice,
Format, Pool, (IDirect3DSurface9 **)&d3dSurface, pSharedHandle); Format, Pool, (IDirect3DSurface9 **)&d3dSurface, pSharedHandle);
if (res == D3D_OK) { if (res == D3D_OK) {
*ppSurface = d3dSurface->wineD3DSurface; *ppSurface = d3dSurface->wineD3DSurface;
} else {
*ppSurface = NULL;
} }
return res; return res;
} }
...@@ -158,7 +158,7 @@ HRESULT WINAPI IDirect3DTexture9Impl_GetSurfaceLevel(LPDIRECT3DTEXTURE9 iface, U ...@@ -158,7 +158,7 @@ HRESULT WINAPI IDirect3DTexture9Impl_GetSurfaceLevel(LPDIRECT3DTEXTURE9 iface, U
IWineD3DSurface *mySurface = NULL; IWineD3DSurface *mySurface = NULL;
hrc = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface); hrc = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface);
if (hrc == D3D_OK) { if (hrc == D3D_OK && NULL != ppSurfaceLevel) {
IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppSurfaceLevel); IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppSurfaceLevel);
IWineD3DSurface_Release(mySurface); IWineD3DSurface_Release(mySurface);
} }
...@@ -213,14 +213,28 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9 iface, UIN ...@@ -213,14 +213,28 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9 iface, UIN
D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle) { D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle) {
IDirect3DTexture9Impl *object; IDirect3DTexture9Impl *object;
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hrc = D3D_OK;
/* Allocate the storage for the device */ /* Allocate the storage for the device */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DTexture9Impl)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DTexture9Impl));
if (NULL == object) {
FIXME("Allocation of memory failed\n");
*ppTexture = NULL;
return D3DERR_OUTOFVIDEOMEMORY;
}
object->lpVtbl = &Direct3DTexture9_Vtbl; object->lpVtbl = &Direct3DTexture9_Vtbl;
object->ref = 1; object->ref = 1;
IWineD3DDevice_CreateTexture(This->WineD3DDevice, Width, Height, Levels, Usage, hrc = IWineD3DDevice_CreateTexture(This->WineD3DDevice, Width, Height, Levels, Usage,
Format, Pool, &(object->wineD3DTexture), pSharedHandle, (IUnknown *)object, D3D9CB_CreateSurface); Format, Pool, &(object->wineD3DTexture), pSharedHandle, (IUnknown *)object, D3D9CB_CreateSurface);
*ppTexture = (LPDIRECT3DTEXTURE9) object; if (hrc != D3D_OK) {
return D3D_OK; /* free up object */
FIXME("(%p) call to IWineD3DDevice_CreateTexture failed\n", This);
HeapFree(GetProcessHeap(), 0, object);
*ppTexture = NULL;
} else {
*ppTexture = (LPDIRECT3DTEXTURE9) object;
}
return hrc;
} }
...@@ -141,13 +141,27 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface, ...@@ -141,13 +141,27 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface,
IDirect3DVertexBuffer9Impl *object; IDirect3DVertexBuffer9Impl *object;
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hrc = D3D_OK;
/* Allocate the storage for the device */ /* Allocate the storage for the device */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVertexBuffer9Impl)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVertexBuffer9Impl));
if (NULL == object) {
FIXME("Allocation of memory failed\n");
*ppVertexBuffer = NULL;
return D3DERR_OUTOFVIDEOMEMORY;
}
object->lpVtbl = &Direct3DVertexBuffer9_Vtbl; object->lpVtbl = &Direct3DVertexBuffer9_Vtbl;
object->ref = 1; object->ref = 1;
IWineD3DDevice_CreateVertexBuffer(This->WineD3DDevice, Size, Usage, FVF, Pool, &(object->wineD3DVertexBuffer), pSharedHandle, (IUnknown *)object); hrc = IWineD3DDevice_CreateVertexBuffer(This->WineD3DDevice, Size, Usage, FVF, Pool, &(object->wineD3DVertexBuffer), pSharedHandle, (IUnknown *)object);
*ppVertexBuffer = (LPDIRECT3DVERTEXBUFFER9) object;
if (hrc != D3D_OK) {
return D3D_OK; /* free up object */
FIXME("(%p) call to IWineD3DDevice_CreateVertexBuffer failed\n", This);
HeapFree(GetProcessHeap(), 0, object);
*ppVertexBuffer = NULL;
} else {
*ppVertexBuffer = (LPDIRECT3DVERTEXBUFFER9) object;
}
return hrc;
} }
...@@ -90,7 +90,7 @@ HRESULT WINAPI IDirect3DVolume9Impl_GetContainer(LPDIRECT3DVOLUME9 iface, REFIID ...@@ -90,7 +90,7 @@ HRESULT WINAPI IDirect3DVolume9Impl_GetContainer(LPDIRECT3DVOLUME9 iface, REFIID
res = IWineD3DVolume_GetContainer(This->wineD3DVolume, riid, (void **)&IWineContainer); res = IWineD3DVolume_GetContainer(This->wineD3DVolume, riid, (void **)&IWineContainer);
/* If this works, the only valid container is a child of resource (volumetexture) */ /* If this works, the only valid container is a child of resource (volumetexture) */
if (res == D3D_OK) { if (res == D3D_OK && NULL != ppContainer) {
IWineD3DResource_GetParent((IWineD3DResource *)IWineContainer, (IUnknown **)ppContainer); IWineD3DResource_GetParent((IWineD3DResource *)IWineContainer, (IUnknown **)ppContainer);
IWineD3DResource_Release((IWineD3DResource *)IWineContainer); IWineD3DResource_Release((IWineD3DResource *)IWineContainer);
} }
...@@ -148,11 +148,27 @@ HRESULT WINAPI D3D9CB_CreateVolume(IUnknown *pDevice, UINT Width, UINT Height, ...@@ -148,11 +148,27 @@ HRESULT WINAPI D3D9CB_CreateVolume(IUnknown *pDevice, UINT Width, UINT Height,
HANDLE * pSharedHandle) { HANDLE * pSharedHandle) {
IDirect3DVolume9Impl *object; IDirect3DVolume9Impl *object;
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)pDevice; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)pDevice;
HRESULT hrc = D3D_OK;
/* Allocate the storage for the device */ /* Allocate the storage for the device */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVolume9Impl)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVolume9Impl));
if (NULL == object) {
FIXME("Allocation of memory failed\n");
*ppVolume = NULL;
return D3DERR_OUTOFVIDEOMEMORY;
}
object->lpVtbl = &Direct3DVolume9_Vtbl; object->lpVtbl = &Direct3DVolume9_Vtbl;
object->ref = 1; object->ref = 1;
return IWineD3DDevice_CreateVolume(This->WineD3DDevice, Width, Height, Depth, Usage, Format, hrc = IWineD3DDevice_CreateVolume(This->WineD3DDevice, Width, Height, Depth, Usage, Format,
Pool, ppVolume, pSharedHandle, (IUnknown *)object); Pool, ppVolume, pSharedHandle, (IUnknown *)object);
if (hrc != D3D_OK) {
/* free up object */
FIXME("(%p) call to IWineD3DDevice_CreateVolume failed\n", This);
HeapFree(GetProcessHeap(), 0, object);
*ppVolume = NULL;
} else {
*ppVolume = (IWineD3DVolume *)object;
}
return hrc;
} }
...@@ -156,7 +156,7 @@ HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTUR ...@@ -156,7 +156,7 @@ HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTUR
IWineD3DVolume *myVolume = NULL; IWineD3DVolume *myVolume = NULL;
hrc = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume); hrc = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume);
if (hrc == D3D_OK) { if (hrc == D3D_OK && NULL != ppVolumeLevel) {
IWineD3DVolumeTexture_GetParent(myVolume, (IUnknown **)ppVolumeLevel); IWineD3DVolumeTexture_GetParent(myVolume, (IUnknown **)ppVolumeLevel);
IWineD3DVolumeTexture_Release(myVolume); IWineD3DVolumeTexture_Release(myVolume);
} }
...@@ -210,19 +210,34 @@ IDirect3DVolumeTexture9Vtbl Direct3DVolumeTexture9_Vtbl = ...@@ -210,19 +210,34 @@ IDirect3DVolumeTexture9Vtbl Direct3DVolumeTexture9_Vtbl =
HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9 iface, HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9 iface,
UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage,
D3DFORMAT Format, D3DPOOL Pool, D3DFORMAT Format, D3DPOOL Pool,
IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle) { IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle) {
IDirect3DVolumeTexture9Impl *object; IDirect3DVolumeTexture9Impl *object;
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hrc = D3D_OK;
/* Allocate the storage for the device */ /* Allocate the storage for the device */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVolumeTexture9Impl)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVolumeTexture9Impl));
if (NULL == object) {
FIXME("(%p) allocation of memory failed\n", This);
*ppVolumeTexture = NULL;
return D3DERR_OUTOFVIDEOMEMORY;
}
object->lpVtbl = &Direct3DVolumeTexture9_Vtbl; object->lpVtbl = &Direct3DVolumeTexture9_Vtbl;
object->ref = 1; object->ref = 1;
IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels, Usage, hrc = IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels, Usage,
Format, Pool, &(object->wineD3DVolumeTexture), pSharedHandle, Format, Pool, &(object->wineD3DVolumeTexture), pSharedHandle,
(IUnknown *)object, D3D9CB_CreateVolume); (IUnknown *)object, D3D9CB_CreateVolume);
*ppVolumeTexture = (LPDIRECT3DVOLUMETEXTURE9) object;
return D3D_OK; if (hrc != D3D_OK) {
/* free up object */
FIXME("(%p) call to IWineD3DDevice_CreateVolumeTexture failed\n", This);
HeapFree(GetProcessHeap(), 0, object);
*ppVolumeTexture = NULL;
} else {
*ppVolumeTexture = (LPDIRECT3DVOLUMETEXTURE9) object;
}
return hrc;
} }
...@@ -986,7 +986,7 @@ HRESULT WINAPI IWineD3DImpl_CheckDeviceFormatConversion(IWineD3D *iface, UINT ...@@ -986,7 +986,7 @@ HRESULT WINAPI IWineD3DImpl_CheckDeviceFormatConversion(IWineD3D *iface, UINT
/* Note: d3d8 passes in a pointer to a D3DCAPS8 structure, which is a true /* Note: d3d8 passes in a pointer to a D3DCAPS8 structure, which is a true
subset of a D3DCAPS9 structure. However, it has to come via a void * subset of a D3DCAPS9 structure. However, it has to come via a void *
as the d3d8 interface cannot import the d3d9 header */ as the d3d8 interface cannot import the d3d9 header */
HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType, void* pCapsIn) { HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType, WINED3DCAPS* pCapsIn) {
IWineD3DImpl *This = (IWineD3DImpl *)iface; IWineD3DImpl *This = (IWineD3DImpl *)iface;
BOOL gotContext = FALSE; BOOL gotContext = FALSE;
......
...@@ -124,7 +124,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFAC ...@@ -124,7 +124,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFAC
*(pDesc->Type) = This->currentDesc.Type; *(pDesc->Type) = This->currentDesc.Type;
*(pDesc->Usage) = This->currentDesc.Usage; *(pDesc->Usage) = This->currentDesc.Usage;
*(pDesc->Pool) = This->currentDesc.Pool; *(pDesc->Pool) = This->currentDesc.Pool;
*(pDesc->Size) = This->currentDesc.Size; /* dx8 only */ *(pDesc->Size) = This->currentDesc_size; /* dx8 only */
*(pDesc->MultiSampleType) = This->currentDesc.MultiSampleType; *(pDesc->MultiSampleType) = This->currentDesc.MultiSampleType;
*(pDesc->MultiSampleQuality) = This->currentDesc.MultiSampleQuality; *(pDesc->MultiSampleQuality) = This->currentDesc.MultiSampleQuality;
*(pDesc->Width) = This->currentDesc.Width; *(pDesc->Width) = This->currentDesc.Width;
...@@ -569,7 +569,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, GLenum gl ...@@ -569,7 +569,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, GLenum gl
This->currentDesc.Width, This->currentDesc.Width,
This->currentDesc.Height, This->currentDesc.Height,
0, 0,
This->currentDesc.Size, This->currentDesc_size,
This->allocatedMemory); This->allocatedMemory);
ENTER_GL(); ENTER_GL();
...@@ -580,7 +580,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, GLenum gl ...@@ -580,7 +580,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, GLenum gl
This->currentDesc.Width, This->currentDesc.Width,
This->currentDesc.Height, This->currentDesc.Height,
0, 0,
This->currentDesc.Size, This->currentDesc_size,
This->allocatedMemory); This->allocatedMemory);
checkGLcall("glCommpressedTexTexImage2D"); checkGLcall("glCommpressedTexTexImage2D");
......
...@@ -1304,7 +1304,6 @@ typedef struct _D3DSURFACE_DESC { ...@@ -1304,7 +1304,6 @@ typedef struct _D3DSURFACE_DESC {
D3DRESOURCETYPE Type; D3DRESOURCETYPE Type;
DWORD Usage; DWORD Usage;
D3DPOOL Pool; D3DPOOL Pool;
UINT Size;
D3DMULTISAMPLE_TYPE MultiSampleType; D3DMULTISAMPLE_TYPE MultiSampleType;
DWORD MultiSampleQuality; DWORD MultiSampleQuality;
UINT Width; UINT Width;
......
...@@ -96,17 +96,27 @@ typedef struct _WINED3DVOLUME_DESC ...@@ -96,17 +96,27 @@ typedef struct _WINED3DVOLUME_DESC
UINT *Depth; UINT *Depth;
} WINED3DVOLUME_DESC; } WINED3DVOLUME_DESC;
/* The following have differing names, but actually are the same layout */ /* The following have differing names, but actually are the same layout. */
/* Also, D3DCAPS8 is a subset of D3DCAPS9 so can be typecase as long as
none of the 9 fields are accessed when the device is d3d8 */
#if defined( __WINE_D3D8_H ) #if defined( __WINE_D3D8_H )
/* Identical: */
#define WINED3DLIGHT D3DLIGHT8 #define WINED3DLIGHT D3DLIGHT8
#define WINED3DCLIPSTATUS D3DCLIPSTATUS8 #define WINED3DCLIPSTATUS D3DCLIPSTATUS8
#define WINED3DMATERIAL D3DMATERIAL8 #define WINED3DMATERIAL D3DMATERIAL8
#define WINED3DVIEWPORT D3DVIEWPORT8 #define WINED3DVIEWPORT D3DVIEWPORT8
/* Subset: */
#define WINED3DCAPS D3DCAPS8
#else #else
/* Identical: */
#define WINED3DLIGHT D3DLIGHT9 #define WINED3DLIGHT D3DLIGHT9
#define WINED3DCLIPSTATUS D3DCLIPSTATUS9 #define WINED3DCLIPSTATUS D3DCLIPSTATUS9
#define WINED3DMATERIAL D3DMATERIAL9 #define WINED3DMATERIAL D3DMATERIAL9
#define WINED3DVIEWPORT D3DVIEWPORT9 #define WINED3DVIEWPORT D3DVIEWPORT9
/* Subsets: */
#define WINED3DCAPS D3DCAPS9
#endif #endif
typedef struct IWineD3D IWineD3D; typedef struct IWineD3D IWineD3D;
...@@ -178,7 +188,7 @@ DECLARE_INTERFACE_(IWineD3D,IUnknown) ...@@ -178,7 +188,7 @@ DECLARE_INTERFACE_(IWineD3D,IUnknown)
STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat, D3DFORMAT BackBufferFormat, BOOL Windowed) PURE; STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat, D3DFORMAT BackBufferFormat, BOOL Windowed) PURE;
STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) PURE; STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) PURE;
STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat) PURE; STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat) PURE;
STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, void * pCaps) PURE; STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, WINED3DCAPS* pCaps) PURE;
STDMETHOD(CreateDevice)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType,HWND hFocusWindow, DWORD BehaviorFlags, WINED3DPRESENT_PARAMETERS * pPresentationParameters, IWineD3DDevice ** ppReturnedDeviceInterface, IUnknown *parent, D3DCB_CREATERENDERTARGETFN pFn) PURE; STDMETHOD(CreateDevice)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType,HWND hFocusWindow, DWORD BehaviorFlags, WINED3DPRESENT_PARAMETERS * pPresentationParameters, IWineD3DDevice ** ppReturnedDeviceInterface, IUnknown *parent, D3DCB_CREATERENDERTARGETFN pFn) PURE;
}; };
#undef INTERFACE #undef INTERFACE
...@@ -255,6 +265,11 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown) ...@@ -255,6 +265,11 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD * pValue) PURE; STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD * pValue) PURE;
STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE; STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE;
STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD * pValue) PURE; STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD * pValue) PURE;
STDMETHOD(SetTexture)(THIS_ DWORD Stage, IWineD3DBaseTexture* pTexture) PURE;
STDMETHOD(GetTexture)(THIS_ DWORD Stage, IWineD3DBaseTexture** ppTexture) PURE;
STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IWineD3DSurface** ppBackBuffer) PURE;
STDMETHOD(GetDeviceCaps)(THIS_ WINED3DCAPS* pCaps) PURE;
STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain, D3DDISPLAYMODE* pMode) PURE;
STDMETHOD(BeginScene)(THIS) PURE; STDMETHOD(BeginScene)(THIS) PURE;
STDMETHOD(EndScene)(THIS) PURE; STDMETHOD(EndScene)(THIS) PURE;
STDMETHOD(Present)(THIS_ CONST RECT * pSourceRect,CONST RECT * pDestRect,HWND hDestWindowOverride,CONST RGNDATA * pDirtyRegion) PURE; STDMETHOD(Present)(THIS_ CONST RECT * pSourceRect,CONST RECT * pDestRect,HWND hDestWindowOverride,CONST RGNDATA * pDirtyRegion) PURE;
...@@ -311,6 +326,11 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown) ...@@ -311,6 +326,11 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
#define IWineD3DDevice_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) #define IWineD3DDevice_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b)
#define IWineD3DDevice_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) #define IWineD3DDevice_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c)
#define IWineD3DDevice_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) #define IWineD3DDevice_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c)
#define IWineD3DDevice_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b)
#define IWineD3DDevice_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b)
#define IWineD3DDevice_GetBackBuffer(p,a,b,c,d) (p)->lpVtbl->GetBackBuffer(p,a,b,c,d)
#define IWineD3DDevice_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a)
#define IWineD3DDevice_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b)
#define IWineD3DDevice_BeginScene(p) (p)->lpVtbl->BeginScene(p) #define IWineD3DDevice_BeginScene(p) (p)->lpVtbl->BeginScene(p)
#define IWineD3DDevice_EndScene(p) (p)->lpVtbl->EndScene(p) #define IWineD3DDevice_EndScene(p) (p)->lpVtbl->EndScene(p)
#define IWineD3DDevice_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) #define IWineD3DDevice_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d)
......
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