From 44d2bd70d8a01baef0e7f00b2303667366e4cfa4 Mon Sep 17 00:00:00 2001 From: Kamil Hornicek Date: Sun, 18 Jan 2009 21:11:53 +0000 Subject: [PATCH] - sync d3d9 with wine HEAD svn path=/trunk/; revision=38916 --- reactos/dll/directx/wine/d3d9/cubetexture.c | 7 +- reactos/dll/directx/wine/d3d9/d3d9_private.h | 27 +- reactos/dll/directx/wine/d3d9/device.c | 337 ++++++++++++++++-- reactos/dll/directx/wine/d3d9/directx.c | 107 +----- reactos/dll/directx/wine/d3d9/pixelshader.c | 20 +- reactos/dll/directx/wine/d3d9/query.c | 4 +- reactos/dll/directx/wine/d3d9/stateblock.c | 4 +- reactos/dll/directx/wine/d3d9/surface.c | 11 +- reactos/dll/directx/wine/d3d9/swapchain.c | 4 +- reactos/dll/directx/wine/d3d9/texture.c | 7 +- .../dll/directx/wine/d3d9/vertexdeclaration.c | 4 + reactos/dll/directx/wine/d3d9/vertexshader.c | 18 +- reactos/dll/directx/wine/d3d9/volume.c | 38 +- reactos/dll/directx/wine/d3d9/volumetexture.c | 11 +- 14 files changed, 367 insertions(+), 232 deletions(-) diff --git a/reactos/dll/directx/wine/d3d9/cubetexture.c b/reactos/dll/directx/wine/d3d9/cubetexture.c index bf889954424..533770fa529 100644 --- a/reactos/dll/directx/wine/d3d9/cubetexture.c +++ b/reactos/dll/directx/wine/d3d9/cubetexture.c @@ -348,21 +348,20 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9EX ifac object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (NULL == object) { - FIXME("(%p) allocation of CubeTexture failed\n", This); + ERR("(%p) allocation of CubeTexture failed\n", This); return D3DERR_OUTOFVIDEOMEMORY; } object->lpVtbl = &Direct3DCubeTexture9_Vtbl; object->ref = 1; EnterCriticalSection(&d3d9_cs); hr = IWineD3DDevice_CreateCubeTexture(This->WineD3DDevice, EdgeLength, Levels, Usage, - (WINED3DFORMAT)Format, (WINED3DPOOL) Pool, &object->wineD3DCubeTexture, pSharedHandle, (IUnknown*)object, - D3D9CB_CreateSurface); + Format, Pool, &object->wineD3DCubeTexture, pSharedHandle, (IUnknown*)object); LeaveCriticalSection(&d3d9_cs); if (hr != D3D_OK){ /* free up object */ - FIXME("(%p) call to IWineD3DDevice_CreateCubeTexture failed\n", This); + WARN("(%p) call to IWineD3DDevice_CreateCubeTexture failed\n", This); HeapFree(GetProcessHeap(), 0, object); } else { IDirect3DDevice9Ex_AddRef(iface); diff --git a/reactos/dll/directx/wine/d3d9/d3d9_private.h b/reactos/dll/directx/wine/d3d9/d3d9_private.h index d6d6ee9b9b4..b78f09a1c5e 100644 --- a/reactos/dll/directx/wine/d3d9/d3d9_private.h +++ b/reactos/dll/directx/wine/d3d9/d3d9_private.h @@ -167,6 +167,7 @@ void filter_caps(D3DCAPS9* pCaps); * Predeclare the interface implementation structures */ extern const IDirect3DDevice9ExVtbl Direct3DDevice9_Vtbl; +extern const IWineD3DDeviceParentVtbl d3d9_wined3d_device_parent_vtbl; /***************************************************************************** * IDirect3DDevice9 implementation structure @@ -175,6 +176,7 @@ typedef struct IDirect3DDevice9Impl { /* IUnknown fields */ const IDirect3DDevice9ExVtbl *lpVtbl; + const IWineD3DDeviceParentVtbl *device_parent_vtbl; LONG ref; /* IDirect3DDevice9 fields */ @@ -233,6 +235,7 @@ extern HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9EX ifa /***************************************************************************** * IDirect3DVolume9 implementation structure */ +extern const IDirect3DVolume9Vtbl Direct3DVolume9_Vtbl; typedef struct IDirect3DVolume9Impl { /* IUnknown fields */ @@ -551,34 +554,10 @@ typedef struct IDirect3DQuery9Impl { /* Callbacks */ -extern HRESULT WINAPI D3D9CB_CreateSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height, - WINED3DFORMAT Format, DWORD Usage, WINED3DPOOL Pool, UINT Level, - WINED3DCUBEMAP_FACES Face, IWineD3DSurface** ppSurface, - HANDLE* pSharedHandle); - -extern HRESULT WINAPI D3D9CB_CreateVolume(IUnknown *pDevice, IUnknown *pSuperior, UINT Width, UINT Height, UINT Depth, - WINED3DFORMAT Format, WINED3DPOOL Pool, DWORD Usage, - IWineD3DVolume **ppVolume, - HANDLE * pSharedHandle); - -extern HRESULT WINAPI D3D9CB_CreateDepthStencilSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height, - WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample, - DWORD MultisampleQuality, BOOL Discard, - IWineD3DSurface** ppSurface, HANDLE* pSharedHandle); - -extern HRESULT WINAPI D3D9CB_CreateRenderTarget(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height, - WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample, - DWORD MultisampleQuality, BOOL Lockable, - IWineD3DSurface** ppSurface, HANDLE* pSharedHandle); - extern ULONG WINAPI D3D9CB_DestroySwapChain (IWineD3DSwapChain *pSwapChain); - extern ULONG WINAPI D3D9CB_DestroyDepthStencilSurface (IWineD3DSurface *pSurface); - extern ULONG WINAPI D3D9CB_DestroyRenderTarget (IWineD3DSurface *pSurface); - extern ULONG WINAPI D3D9CB_DestroySurface(IWineD3DSurface *pSurface); - extern ULONG WINAPI D3D9CB_DestroyVolume(IWineD3DVolume *pVolume); #endif /* __WINE_D3D9_PRIVATE_H */ diff --git a/reactos/dll/directx/wine/d3d9/device.c b/reactos/dll/directx/wine/d3d9/device.c index 3bdd8ae8a94..768bf9d1053 100644 --- a/reactos/dll/directx/wine/d3d9/device.c +++ b/reactos/dll/directx/wine/d3d9/device.c @@ -59,6 +59,13 @@ static HRESULT WINAPI IDirect3DDevice9Impl_QueryInterface(LPDIRECT3DDEVICE9EX if } } + if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent)) + { + IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl); + *ppobj = &This->device_parent_vtbl; + return S_OK; + } + WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); *ppobj = NULL; return E_NOINTERFACE; @@ -1008,13 +1015,50 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetTexture(LPDIRECT3DDEVICE9EX ifac return hr; } +static const WINED3DTEXTURESTAGESTATETYPE tss_lookup[] = +{ + WINED3DTSS_FORCE_DWORD, /* 0, unused */ + WINED3DTSS_COLOROP, /* 1, D3DTSS_COLOROP */ + WINED3DTSS_COLORARG1, /* 2, D3DTSS_COLORARG1 */ + WINED3DTSS_COLORARG2, /* 3, D3DTSS_COLORARG2 */ + WINED3DTSS_ALPHAOP, /* 4, D3DTSS_ALPHAOP */ + WINED3DTSS_ALPHAARG1, /* 5, D3DTSS_ALPHAARG1 */ + WINED3DTSS_ALPHAARG2, /* 6, D3DTSS_ALPHAARG2 */ + WINED3DTSS_BUMPENVMAT00, /* 7, D3DTSS_BUMPENVMAT00 */ + WINED3DTSS_BUMPENVMAT01, /* 8, D3DTSS_BUMPENVMAT01 */ + WINED3DTSS_BUMPENVMAT10, /* 9, D3DTSS_BUMPENVMAT10 */ + WINED3DTSS_BUMPENVMAT11, /* 10, D3DTSS_BUMPENVMAT11 */ + WINED3DTSS_TEXCOORDINDEX, /* 11, D3DTSS_TEXCOORDINDEX */ + WINED3DTSS_FORCE_DWORD, /* 12, unused */ + WINED3DTSS_FORCE_DWORD, /* 13, unused */ + WINED3DTSS_FORCE_DWORD, /* 14, unused */ + WINED3DTSS_FORCE_DWORD, /* 15, unused */ + WINED3DTSS_FORCE_DWORD, /* 16, unused */ + WINED3DTSS_FORCE_DWORD, /* 17, unused */ + WINED3DTSS_FORCE_DWORD, /* 18, unused */ + WINED3DTSS_FORCE_DWORD, /* 19, unused */ + WINED3DTSS_FORCE_DWORD, /* 20, unused */ + WINED3DTSS_FORCE_DWORD, /* 21, unused */ + WINED3DTSS_BUMPENVLSCALE, /* 22, D3DTSS_BUMPENVLSCALE */ + WINED3DTSS_BUMPENVLOFFSET, /* 23, D3DTSS_BUMPENVLOFFSET */ + WINED3DTSS_TEXTURETRANSFORMFLAGS, /* 24, D3DTSS_TEXTURETRANSFORMFLAGS */ + WINED3DTSS_FORCE_DWORD, /* 25, unused */ + WINED3DTSS_COLORARG0, /* 26, D3DTSS_COLORARG0 */ + WINED3DTSS_ALPHAARG0, /* 27, D3DTSS_ALPHAARG0 */ + WINED3DTSS_RESULTARG, /* 28, D3DTSS_RESULTARG */ + WINED3DTSS_FORCE_DWORD, /* 29, unused */ + WINED3DTSS_FORCE_DWORD, /* 30, unused */ + WINED3DTSS_FORCE_DWORD, /* 31, unused */ + WINED3DTSS_CONSTANT, /* 32, D3DTSS_CONSTANT */ +}; + static HRESULT WINAPI IDirect3DDevice9Impl_GetTextureStageState(LPDIRECT3DDEVICE9EX iface, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hr; TRACE("(%p) Relay\n" , This); EnterCriticalSection(&d3d9_cs); - hr = IWineD3DDevice_GetTextureStageState(This->WineD3DDevice, Stage, Type, pValue); + hr = IWineD3DDevice_GetTextureStageState(This->WineD3DDevice, Stage, tss_lookup[Type], pValue); LeaveCriticalSection(&d3d9_cs); return hr; } @@ -1025,7 +1069,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetTextureStageState(LPDIRECT3DDEVI TRACE("(%p) Relay\n" , This); EnterCriticalSection(&d3d9_cs); - hr = IWineD3DDevice_SetTextureStageState(This->WineD3DDevice, Stage, Type, Value); + hr = IWineD3DDevice_SetTextureStageState(This->WineD3DDevice, Stage, tss_lookup[Type], Value); LeaveCriticalSection(&d3d9_cs); return hr; } @@ -1314,7 +1358,6 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9EX iface, DWO return hr; } } - hr = IWineD3DDevice_SetFVF(This->WineD3DDevice, FVF); LeaveCriticalSection(&d3d9_cs); return hr; @@ -1322,12 +1365,30 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9EX iface, DWO static HRESULT WINAPI IDirect3DDevice9Impl_GetFVF(LPDIRECT3DDEVICE9EX iface, DWORD* pFVF) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DVertexDeclaration9 *decl; HRESULT hr; TRACE("(%p) Relay\n" , This); - EnterCriticalSection(&d3d9_cs); - hr = IWineD3DDevice_GetFVF(This->WineD3DDevice, pFVF); - LeaveCriticalSection(&d3d9_cs); + hr = IDirect3DDevice9_GetVertexDeclaration(iface, &decl); + if (FAILED(hr)) + { + WARN("Failed to get vertex declaration, %#x\n", hr); + *pFVF = 0; + return hr; + } + + if (decl) + { + *pFVF = ((IDirect3DVertexDeclaration9Impl *)decl)->convFVF; + IDirect3DVertexDeclaration9_Release(decl); + } + else + { + *pFVF = 0; + } + + TRACE("Returning FVF %#x\n", *pFVF); + return hr; } @@ -1694,37 +1755,6 @@ const IDirect3DDevice9ExVtbl Direct3DDevice9_Vtbl = IDirect3DDevice9ExImpl_GetDisplayModeEx }; - -/* Internal function called back during the CreateDevice to create a render target */ -HRESULT WINAPI D3D9CB_CreateSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height, - WINED3DFORMAT Format, DWORD Usage, WINED3DPOOL Pool, UINT Level, - WINED3DCUBEMAP_FACES Face,IWineD3DSurface** ppSurface, - HANDLE* pSharedHandle) { - - HRESULT res = D3D_OK; - IDirect3DSurface9Impl *d3dSurface = NULL; - BOOL Lockable = TRUE; - - if((Pool == D3DPOOL_DEFAULT && Usage != D3DUSAGE_DYNAMIC)) - Lockable = FALSE; - - TRACE("relay\n"); - res = IDirect3DDevice9Impl_CreateSurface((IDirect3DDevice9Ex *)device, Width, Height, (D3DFORMAT)Format, - Lockable, FALSE/*Discard*/, Level, (IDirect3DSurface9 **)&d3dSurface, D3DRTYPE_SURFACE, - Usage, (D3DPOOL) Pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */, pSharedHandle); - - if (SUCCEEDED(res)) { - *ppSurface = d3dSurface->wineD3DSurface; - d3dSurface->container = pSuperior; - IDirect3DDevice9Ex_Release(d3dSurface->parentDevice); - d3dSurface->parentDevice = NULL; - d3dSurface->forwardReference = pSuperior; - } else { - FIXME("(%p) IDirect3DDevice9_CreateSurface failed\n", device); - } - return res; -} - ULONG WINAPI D3D9CB_DestroySurface(IWineD3DSurface *pSurface) { IDirect3DSurface9Impl* surfaceParent; TRACE("(%p) call back\n", pSurface); @@ -1735,3 +1765,236 @@ ULONG WINAPI D3D9CB_DestroySurface(IWineD3DSurface *pSurface) { surfaceParent->forwardReference = NULL; return IDirect3DSurface9_Release((IDirect3DSurface9*) surfaceParent); } + +/* IWineD3DDeviceParent IUnknown methods */ + +static inline struct IDirect3DDevice9Impl *device_from_device_parent(IWineD3DDeviceParent *iface) +{ + return (struct IDirect3DDevice9Impl *)((char*)iface + - FIELD_OFFSET(struct IDirect3DDevice9Impl, device_parent_vtbl)); +} + +static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object) +{ + struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); + return IDirect3DDevice9Impl_QueryInterface((IDirect3DDevice9Ex *)This, riid, object); +} + +static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface) +{ + struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); + return IDirect3DDevice9Impl_AddRef((IDirect3DDevice9Ex *)This); +} + +static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface) +{ + struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); + return IDirect3DDevice9Impl_Release((IDirect3DDevice9Ex *)This); +} + +/* IWineD3DDeviceParent methods */ + +static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface, + IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage, + WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface) +{ + struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); + IDirect3DSurface9Impl *d3d_surface; + BOOL lockable = TRUE; + HRESULT hr; + + TRACE("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n" + "\tpool %#x, level %u, face %u, surface %p\n", + iface, superior, width, height, format, usage, pool, level, face, surface); + + if (pool == D3DPOOL_DEFAULT && !(usage & D3DUSAGE_DYNAMIC)) lockable = FALSE; + + hr = IDirect3DDevice9Impl_CreateSurface((IDirect3DDevice9Ex *)This, width, height, + format, lockable, FALSE /* Discard */, level, (IDirect3DSurface9 **)&d3d_surface, + D3DRTYPE_SURFACE, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */, NULL); + if (FAILED(hr)) + { + ERR("(%p) CreateSurface failed, returning %#x\n", iface, hr); + return hr; + } + + *surface = d3d_surface->wineD3DSurface; + d3d_surface->container = superior; + IDirect3DDevice9Ex_Release(d3d_surface->parentDevice); + d3d_surface->parentDevice = NULL; + d3d_surface->forwardReference = superior; + + return hr; +} + +static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface, + IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type, + DWORD multisample_quality, BOOL lockable, IWineD3DSurface **surface) +{ + struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); + IDirect3DSurface9Impl *d3d_surface; + HRESULT hr; + + TRACE("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n" + "\tmultisample_quality %u, lockable %u, surface %p\n", + iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface); + + hr = IDirect3DDevice9Impl_CreateRenderTarget((IDirect3DDevice9Ex *)This, width, height, format, + multisample_type, multisample_quality, lockable, (IDirect3DSurface9 **)&d3d_surface, NULL); + if (FAILED(hr)) + { + ERR("(%p) CreateRenderTarget failed, returning %#x\n", iface, hr); + return hr; + } + + *surface = d3d_surface->wineD3DSurface; + d3d_surface->container = superior; + d3d_surface->isImplicit = TRUE; + /* Implicit surfaces are created with an refcount of 0 */ + IDirect3DSurface9_Release((IDirect3DSurface9 *)d3d_surface); + + return hr; +} + +static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface, + IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type, + DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface) +{ + struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); + IDirect3DSurface9Impl *d3d_surface; + HRESULT hr; + + TRACE("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n" + "\tmultisample_quality %u, discard %u, surface %p\n", + iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface); + + hr = IDirect3DDevice9Impl_CreateDepthStencilSurface((IDirect3DDevice9Ex *)This, width, height, format, + multisample_type, multisample_quality, discard, (IDirect3DSurface9 **)&d3d_surface, NULL); + if (FAILED(hr)) + { + ERR("(%p) CreateDepthStencilSurface failed, returning %#x\n", iface, hr); + return hr; + } + + *surface = d3d_surface->wineD3DSurface; + d3d_surface->container = (IUnknown *)This; + d3d_surface->isImplicit = TRUE; + /* Implicit surfaces are created with an refcount of 0 */ + IDirect3DSurface9_Release((IDirect3DSurface9 *)d3d_surface); + + return hr; +} + +static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface, + IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format, + WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume) +{ + struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); + IDirect3DVolume9Impl *object; + HRESULT hr; + + TRACE("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p\n", + iface, superior, width, height, depth, format, pool, usage, volume); + + /* Allocate the storage for the device */ + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + FIXME("Allocation of memory failed\n"); + *volume = NULL; + return D3DERR_OUTOFVIDEOMEMORY; + } + + object->lpVtbl = &Direct3DVolume9_Vtbl; + object->ref = 1; + hr = IWineD3DDevice_CreateVolume(This->WineD3DDevice, width, height, depth, usage & WINED3DUSAGE_MASK, + format, pool, &object->wineD3DVolume, NULL, (IUnknown *)object); + if (FAILED(hr)) + { + ERR("(%p) CreateVolume failed, returning %#x\n", iface, hr); + HeapFree(GetProcessHeap(), 0, object); + *volume = NULL; + return hr; + } + + *volume = object->wineD3DVolume; + object->container = superior; + object->forwardReference = superior; + + TRACE("(%p) Created volume %p\n", iface, *volume); + + return hr; +} + +static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface, + WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain) +{ + struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); + IDirect3DSwapChain9Impl *d3d_swapchain; + D3DPRESENT_PARAMETERS local_parameters; + HRESULT hr; + + TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain); + + /* Copy the presentation parameters */ + local_parameters.BackBufferWidth = present_parameters->BackBufferWidth; + local_parameters.BackBufferHeight = present_parameters->BackBufferHeight; + local_parameters.BackBufferFormat = present_parameters->BackBufferFormat; + local_parameters.BackBufferCount = present_parameters->BackBufferCount; + local_parameters.MultiSampleType = present_parameters->MultiSampleType; + local_parameters.MultiSampleQuality = present_parameters->MultiSampleQuality; + local_parameters.SwapEffect = present_parameters->SwapEffect; + local_parameters.hDeviceWindow = present_parameters->hDeviceWindow; + local_parameters.Windowed = present_parameters->Windowed; + local_parameters.EnableAutoDepthStencil = present_parameters->EnableAutoDepthStencil; + local_parameters.AutoDepthStencilFormat = present_parameters->AutoDepthStencilFormat; + local_parameters.Flags = present_parameters->Flags; + local_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz; + local_parameters.PresentationInterval = present_parameters->PresentationInterval; + + hr = IDirect3DDevice9Impl_CreateAdditionalSwapChain((IDirect3DDevice9Ex *)This, + &local_parameters, (IDirect3DSwapChain9 **)&d3d_swapchain); + if (FAILED(hr)) + { + ERR("(%p) CreateAdditionalSwapChain failed, returning %#x\n", iface, hr); + *swapchain = NULL; + return hr; + } + + *swapchain = d3d_swapchain->wineD3DSwapChain; + d3d_swapchain->isImplicit = TRUE; + /* Implicit swap chains are created with an refcount of 0 */ + IDirect3DSwapChain9_Release((IDirect3DSwapChain9 *)d3d_swapchain); + + /* Copy back the presentation parameters */ + present_parameters->BackBufferWidth = local_parameters.BackBufferWidth; + present_parameters->BackBufferHeight = local_parameters.BackBufferHeight; + present_parameters->BackBufferFormat = local_parameters.BackBufferFormat; + present_parameters->BackBufferCount = local_parameters.BackBufferCount; + present_parameters->MultiSampleType = local_parameters.MultiSampleType; + present_parameters->MultiSampleQuality = local_parameters.MultiSampleQuality; + present_parameters->SwapEffect = local_parameters.SwapEffect; + present_parameters->hDeviceWindow = local_parameters.hDeviceWindow; + present_parameters->Windowed = local_parameters.Windowed; + present_parameters->EnableAutoDepthStencil = local_parameters.EnableAutoDepthStencil; + present_parameters->AutoDepthStencilFormat = local_parameters.AutoDepthStencilFormat; + present_parameters->Flags = local_parameters.Flags; + present_parameters->FullScreen_RefreshRateInHz = local_parameters.FullScreen_RefreshRateInHz; + present_parameters->PresentationInterval = local_parameters.PresentationInterval; + + return hr; +} + +const IWineD3DDeviceParentVtbl d3d9_wined3d_device_parent_vtbl = +{ + /* IUnknown methods */ + device_parent_QueryInterface, + device_parent_AddRef, + device_parent_Release, + /* IWineD3DDeviceParent methods */ + device_parent_CreateSurface, + device_parent_CreateRenderTarget, + device_parent_CreateDepthStencilSurface, + device_parent_CreateVolume, + device_parent_CreateSwapChain, +}; diff --git a/reactos/dll/directx/wine/d3d9/directx.c b/reactos/dll/directx/wine/d3d9/directx.c index cb04b1fb144..36db33b21de 100644 --- a/reactos/dll/directx/wine/d3d9/directx.c +++ b/reactos/dll/directx/wine/d3d9/directx.c @@ -329,30 +329,6 @@ static HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9EX iface, UIN return ret; } -/* Internal function called back during the CreateDevice to create a render target */ -HRESULT WINAPI D3D9CB_CreateRenderTarget(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height, - WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample, - DWORD MultisampleQuality, BOOL Lockable, - IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) { - HRESULT res = D3D_OK; - IDirect3DSurface9Impl *d3dSurface = NULL; - TRACE("(%p) call back\n", device); - res = IDirect3DDevice9_CreateRenderTarget((IDirect3DDevice9 *)device, Width, Height, - (D3DFORMAT)Format, MultiSample, MultisampleQuality, Lockable, - (IDirect3DSurface9 **)&d3dSurface, pSharedHandle); - - if (SUCCEEDED(res)) { - *ppSurface = d3dSurface->wineD3DSurface; - d3dSurface->container = pSuperior; - d3dSurface->isImplicit = TRUE; - /* Implicit surfaces are created with an refcount of 0 */ - IDirect3DSurface9_Release((IDirect3DSurface9 *)d3dSurface); - } else { - *ppSurface = NULL; - } - return res; -} - ULONG WINAPI D3D9CB_DestroyRenderTarget(IWineD3DSurface *pSurface) { IDirect3DSurface9Impl* surfaceParent; TRACE("(%p) call back\n", pSurface); @@ -363,60 +339,6 @@ ULONG WINAPI D3D9CB_DestroyRenderTarget(IWineD3DSurface *pSurface) { return IDirect3DSurface9_Release((IDirect3DSurface9*) surfaceParent); } -static HRESULT WINAPI D3D9CB_CreateAdditionalSwapChain(IUnknown *device, - WINED3DPRESENT_PARAMETERS* pPresentationParameters, - IWineD3DSwapChain ** ppSwapChain) { - HRESULT res = D3D_OK; - IDirect3DSwapChain9Impl *d3dSwapChain = NULL; - D3DPRESENT_PARAMETERS localParameters; - TRACE("(%p) call back\n", device); - - /* Copy the presentation parameters */ - localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth; - localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight; - localParameters.BackBufferFormat = pPresentationParameters->BackBufferFormat; - localParameters.BackBufferCount = pPresentationParameters->BackBufferCount; - localParameters.MultiSampleType = pPresentationParameters->MultiSampleType; - localParameters.MultiSampleQuality = pPresentationParameters->MultiSampleQuality; - localParameters.SwapEffect = pPresentationParameters->SwapEffect; - localParameters.hDeviceWindow = pPresentationParameters->hDeviceWindow; - localParameters.Windowed = pPresentationParameters->Windowed; - localParameters.EnableAutoDepthStencil = pPresentationParameters->EnableAutoDepthStencil; - localParameters.AutoDepthStencilFormat = pPresentationParameters->AutoDepthStencilFormat; - localParameters.Flags = pPresentationParameters->Flags; - localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz; - localParameters.PresentationInterval = pPresentationParameters->PresentationInterval; - - res = IDirect3DDevice9_CreateAdditionalSwapChain((IDirect3DDevice9 *)device, &localParameters, (IDirect3DSwapChain9 **)&d3dSwapChain); - - if (SUCCEEDED(res)) { - *ppSwapChain = d3dSwapChain->wineD3DSwapChain; - d3dSwapChain->isImplicit = TRUE; - /* Implicit swap chains are created with an refcount of 0 */ - IDirect3DSwapChain9_Release((IDirect3DSwapChain9 *)d3dSwapChain); - } else { - *ppSwapChain = NULL; - } - - /* Copy back the presentation parameters */ - pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth; - pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight; - pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat; - pPresentationParameters->BackBufferCount = localParameters.BackBufferCount; - pPresentationParameters->MultiSampleType = localParameters.MultiSampleType; - pPresentationParameters->MultiSampleQuality = localParameters.MultiSampleQuality; - pPresentationParameters->SwapEffect = localParameters.SwapEffect; - pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow; - pPresentationParameters->Windowed = localParameters.Windowed; - pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil; - pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat; - pPresentationParameters->Flags = localParameters.Flags; - pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz; - pPresentationParameters->PresentationInterval = localParameters.PresentationInterval; - - return res; -} - ULONG WINAPI D3D9CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) { IDirect3DSwapChain9Impl* swapChainParent; TRACE("(%p) call back\n", pSwapChain); @@ -427,28 +349,6 @@ ULONG WINAPI D3D9CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) { return IDirect3DSwapChain9_Release((IDirect3DSwapChain9*) swapChainParent); } -/* Internal function called back during the CreateDevice to create a render target */ -HRESULT WINAPI D3D9CB_CreateDepthStencilSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height, - WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample, - DWORD MultisampleQuality, BOOL Discard, - IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) { - HRESULT res = D3D_OK; - IDirect3DSurface9Impl *d3dSurface = NULL; - TRACE("(%p) call back\n", device); - - res = IDirect3DDevice9_CreateDepthStencilSurface((IDirect3DDevice9 *)device, Width, Height, - (D3DFORMAT)Format, MultiSample, MultisampleQuality, Discard, - (IDirect3DSurface9 **)&d3dSurface, pSharedHandle); - if (SUCCEEDED(res)) { - *ppSurface = d3dSurface->wineD3DSurface; - d3dSurface->container = device; - d3dSurface->isImplicit = TRUE; - /* Implicit surfaces are created with an refcount of 0 */ - IDirect3DSurface9_Release((IDirect3DSurface9 *)d3dSurface); - } - return res; -} - ULONG WINAPI D3D9CB_DestroyDepthStencilSurface(IWineD3DSurface *pSurface) { IDirect3DSurface9Impl* surfaceParent; TRACE("(%p) call back\n", pSurface); @@ -485,13 +385,14 @@ static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9EX iface, UINT Adap } object->lpVtbl = &Direct3DDevice9_Vtbl; + object->device_parent_vtbl = &d3d9_wined3d_device_parent_vtbl; object->ref = 1; *ppReturnedDeviceInterface = (IDirect3DDevice9 *)object; /* Allocate an associated WineD3DDevice object */ EnterCriticalSection(&d3d9_cs); - hr =IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &object->WineD3DDevice, (IUnknown *)object); - + hr = IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, + (IUnknown *)object, (IWineD3DDeviceParent *)&object->device_parent_vtbl, &object->WineD3DDevice); if (hr != D3D_OK) { HeapFree(GetProcessHeap(), 0, object); *ppReturnedDeviceInterface = NULL; @@ -521,7 +422,7 @@ static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9EX iface, UINT Adap IWineD3DDevice_SetMultithreaded(object->WineD3DDevice); } - hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters, D3D9CB_CreateAdditionalSwapChain); + hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters); pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth; pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight; diff --git a/reactos/dll/directx/wine/d3d9/pixelshader.c b/reactos/dll/directx/wine/d3d9/pixelshader.c index 059116aa808..dddda28e76a 100644 --- a/reactos/dll/directx/wine/d3d9/pixelshader.c +++ b/reactos/dll/directx/wine/d3d9/pixelshader.c @@ -170,11 +170,21 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, ID EnterCriticalSection(&d3d9_cs); hrc = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object); - if (hrc == D3D_OK && object != NULL) { - hrc = IWineD3DPixelShader_GetParent(object, (IUnknown **)ppShader); - IWineD3DPixelShader_Release(object); - } else { - *ppShader = NULL; + if (SUCCEEDED(hrc)) + { + if (object) + { + hrc = IWineD3DPixelShader_GetParent(object, (IUnknown **)ppShader); + IWineD3DPixelShader_Release(object); + } + else + { + *ppShader = NULL; + } + } + else + { + WARN("(%p) : Call to IWineD3DDevice_GetPixelShader failed %u (device %p)\n", This, hrc, This->WineD3DDevice); } LeaveCriticalSection(&d3d9_cs); diff --git a/reactos/dll/directx/wine/d3d9/query.c b/reactos/dll/directx/wine/d3d9/query.c index 9a15164af17..6e4b20a41eb 100644 --- a/reactos/dll/directx/wine/d3d9/query.c +++ b/reactos/dll/directx/wine/d3d9/query.c @@ -163,7 +163,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9EX iface, D3DQU /* Allocate the storage for the device */ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DQuery9Impl)); if (NULL == object) { - FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n"); + ERR("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n"); return D3DERR_OUTOFVIDEOMEMORY; } @@ -176,7 +176,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9EX iface, D3DQU if (FAILED(hr)) { /* free up object */ - FIXME("(%p) call to IWineD3DDevice_CreateQuery failed\n", This); + WARN("(%p) call to IWineD3DDevice_CreateQuery failed\n", This); HeapFree(GetProcessHeap(), 0, object); } else { IDirect3DDevice9Ex_AddRef(iface); diff --git a/reactos/dll/directx/wine/d3d9/stateblock.c b/reactos/dll/directx/wine/d3d9/stateblock.c index 22e1926026e..bf3f59800c5 100644 --- a/reactos/dll/directx/wine/d3d9/stateblock.c +++ b/reactos/dll/directx/wine/d3d9/stateblock.c @@ -175,7 +175,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(LPDIRECT3DDEVICE9EX iface, I hr=IWineD3DDevice_EndStateBlock(This->WineD3DDevice,&wineD3DStateBlock); LeaveCriticalSection(&d3d9_cs); if(hr!= D3D_OK){ - FIXME("IWineD3DDevice_EndStateBlock returned an error\n"); + WARN("IWineD3DDevice_EndStateBlock returned an error\n"); return hr; } /* allocate a new IDirectD3DStateBlock */ @@ -188,6 +188,6 @@ HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(LPDIRECT3DDEVICE9EX iface, I IDirect3DDevice9Ex_AddRef(iface); object->parentDevice = iface; *ppSB=(IDirect3DStateBlock9*)object; - TRACE("(%p)Returning %p %p\n", This, *ppSB, wineD3DStateBlock); + TRACE("(%p) Returning *ppSB %p, wineD3DStateBlock %p\n", This, *ppSB, wineD3DStateBlock); return D3D_OK; } diff --git a/reactos/dll/directx/wine/d3d9/surface.c b/reactos/dll/directx/wine/d3d9/surface.c index bdede777c9b..a626049df53 100644 --- a/reactos/dll/directx/wine/d3d9/surface.c +++ b/reactos/dll/directx/wine/d3d9/surface.c @@ -241,7 +241,11 @@ static HRESULT WINAPI IDirect3DSurface9Impl_UnlockRect(LPDIRECT3DSURFACE9 iface) EnterCriticalSection(&d3d9_cs); hr = IWineD3DSurface_UnlockRect(This->wineD3DSurface); LeaveCriticalSection(&d3d9_cs); - return hr; + switch(hr) + { + case WINEDDERR_NOTLOCKED: return D3DERR_INVALIDCALL; + default: return hr; + } } static HRESULT WINAPI IDirect3DSurface9Impl_GetDC(LPDIRECT3DSURFACE9 iface, HDC* phdc) { @@ -263,7 +267,10 @@ static HRESULT WINAPI IDirect3DSurface9Impl_ReleaseDC(LPDIRECT3DSURFACE9 iface, EnterCriticalSection(&d3d9_cs); hr = IWineD3DSurface_ReleaseDC(This->wineD3DSurface, hdc); LeaveCriticalSection(&d3d9_cs); - return hr; + switch(hr) { + case WINEDDERR_NODC: return WINED3DERR_INVALIDCALL; + default: return hr; + } } diff --git a/reactos/dll/directx/wine/d3d9/swapchain.c b/reactos/dll/directx/wine/d3d9/swapchain.c index eabe366aa07..c14cc6d1156 100644 --- a/reactos/dll/directx/wine/d3d9/swapchain.c +++ b/reactos/dll/directx/wine/d3d9/swapchain.c @@ -227,9 +227,11 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE localParameters.Flags = pPresentationParameters->Flags; localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz; localParameters.PresentationInterval = pPresentationParameters->PresentationInterval; + localParameters.AutoRestoreDisplayMode = TRUE; EnterCriticalSection(&d3d9_cs); - hrc = IWineD3DDevice_CreateSwapChain(This->WineD3DDevice, &localParameters, &object->wineD3DSwapChain, (IUnknown*)object, D3D9CB_CreateRenderTarget, D3D9CB_CreateDepthStencilSurface, SURFACE_OPENGL); + hrc = IWineD3DDevice_CreateSwapChain(This->WineD3DDevice, &localParameters, + &object->wineD3DSwapChain, (IUnknown*)object, SURFACE_OPENGL); LeaveCriticalSection(&d3d9_cs); pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth; diff --git a/reactos/dll/directx/wine/d3d9/texture.c b/reactos/dll/directx/wine/d3d9/texture.c index 71e1be3ebad..21f6cf1af09 100644 --- a/reactos/dll/directx/wine/d3d9/texture.c +++ b/reactos/dll/directx/wine/d3d9/texture.c @@ -339,7 +339,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9EX iface, U object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DTexture9Impl)); if (NULL == object) { - FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n"); + ERR("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n"); return D3DERR_OUTOFVIDEOMEMORY; } @@ -347,13 +347,12 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9EX iface, U object->ref = 1; EnterCriticalSection(&d3d9_cs); hrc = IWineD3DDevice_CreateTexture(This->WineD3DDevice, Width, Height, Levels, Usage & WINED3DUSAGE_MASK, - (WINED3DFORMAT)Format, (WINED3DPOOL) Pool, &object->wineD3DTexture, pSharedHandle, (IUnknown *)object, D3D9CB_CreateSurface); + Format, Pool, &object->wineD3DTexture, pSharedHandle, (IUnknown *)object); LeaveCriticalSection(&d3d9_cs); - if (FAILED(hrc)) { /* free up object */ - FIXME("(%p) call to IWineD3DDevice_CreateTexture failed\n", This); + WARN("(%p) call to IWineD3DDevice_CreateTexture failed\n", This); HeapFree(GetProcessHeap(), 0, object); } else { IDirect3DDevice9Ex_AddRef(iface); diff --git a/reactos/dll/directx/wine/d3d9/vertexdeclaration.c b/reactos/dll/directx/wine/d3d9/vertexdeclaration.c index 4631248a0f1..86403fd9fc3 100644 --- a/reactos/dll/directx/wine/d3d9/vertexdeclaration.c +++ b/reactos/dll/directx/wine/d3d9/vertexdeclaration.c @@ -96,6 +96,10 @@ HRESULT vdecl_convert_fvf( elements[idx].Type = D3DDECLTYPE_FLOAT4; elements[idx].Usage = D3DDECLUSAGE_POSITIONT; } + else if (!has_blend && (fvf & D3DFVF_XYZW) == D3DFVF_XYZW) { + elements[idx].Type = D3DDECLTYPE_FLOAT4; + elements[idx].Usage = D3DDECLUSAGE_POSITION; + } else { elements[idx].Type = D3DDECLTYPE_FLOAT3; elements[idx].Usage = D3DDECLUSAGE_POSITION; diff --git a/reactos/dll/directx/wine/d3d9/vertexshader.c b/reactos/dll/directx/wine/d3d9/vertexshader.c index 66ce2862f92..6478b68656f 100644 --- a/reactos/dll/directx/wine/d3d9/vertexshader.c +++ b/reactos/dll/directx/wine/d3d9/vertexshader.c @@ -166,10 +166,20 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, I TRACE("(%p) : Relay device@%p\n", This, This->WineD3DDevice); EnterCriticalSection(&d3d9_cs); hrc = IWineD3DDevice_GetVertexShader(This->WineD3DDevice, &pShader); - if(hrc == D3D_OK && pShader != NULL){ - hrc = IWineD3DVertexShader_GetParent(pShader, (IUnknown **)ppShader); - IWineD3DVertexShader_Release(pShader); - } else { + if (SUCCEEDED(hrc)) + { + if (pShader) + { + hrc = IWineD3DVertexShader_GetParent(pShader, (IUnknown **)ppShader); + IWineD3DVertexShader_Release(pShader); + } + else + { + *ppShader = NULL; + } + } + else + { WARN("(%p) : Call to IWineD3DDevice_GetVertexShader failed %u (device %p)\n", This, hrc, This->WineD3DDevice); } LeaveCriticalSection(&d3d9_cs); diff --git a/reactos/dll/directx/wine/d3d9/volume.c b/reactos/dll/directx/wine/d3d9/volume.c index 80146f9b980..fbdddb1aecc 100644 --- a/reactos/dll/directx/wine/d3d9/volume.c +++ b/reactos/dll/directx/wine/d3d9/volume.c @@ -160,7 +160,7 @@ static HRESULT WINAPI IDirect3DVolume9Impl_UnlockBox(LPDIRECT3DVOLUME9 iface) { return IWineD3DVolume_UnlockBox(This->wineD3DVolume); } -static const IDirect3DVolume9Vtbl Direct3DVolume9_Vtbl = +const IDirect3DVolume9Vtbl Direct3DVolume9_Vtbl = { /* IUnknown */ IDirect3DVolume9Impl_QueryInterface, @@ -177,42 +177,6 @@ static const IDirect3DVolume9Vtbl Direct3DVolume9_Vtbl = IDirect3DVolume9Impl_UnlockBox }; - -/* Internal function called back during the CreateVolumeTexture */ -HRESULT WINAPI D3D9CB_CreateVolume(IUnknown *pDevice, IUnknown *pSuperior, UINT Width, UINT Height, UINT Depth, - WINED3DFORMAT Format, WINED3DPOOL Pool, DWORD Usage, - IWineD3DVolume **ppVolume, - HANDLE * pSharedHandle) { - IDirect3DVolume9Impl *object; - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)pDevice; - HRESULT hrc = D3D_OK; - - /* Allocate the storage for the device */ - 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->ref = 1; - hrc = IWineD3DDevice_CreateVolume(This->WineD3DDevice, Width, Height, Depth, Usage & WINED3DUSAGE_MASK, Format, - Pool, &object->wineD3DVolume, 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 = object->wineD3DVolume; - object->container = pSuperior; - object->forwardReference = pSuperior; - } - TRACE("(%p) Created volume %p\n", This, *ppVolume); - return hrc; -} - ULONG WINAPI D3D9CB_DestroyVolume(IWineD3DVolume *pVolume) { IDirect3DVolume9Impl* volumeParent; diff --git a/reactos/dll/directx/wine/d3d9/volumetexture.c b/reactos/dll/directx/wine/d3d9/volumetexture.c index 3069771f7fd..df1f6e29a27 100644 --- a/reactos/dll/directx/wine/d3d9/volumetexture.c +++ b/reactos/dll/directx/wine/d3d9/volumetexture.c @@ -252,21 +252,18 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9EX if /* Allocate the storage for the device */ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVolumeTexture9Impl)); if (NULL == object) { - FIXME("(%p) allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n", This); + ERR("(%p) allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n", This); return D3DERR_OUTOFVIDEOMEMORY; } object->lpVtbl = &Direct3DVolumeTexture9_Vtbl; object->ref = 1; - hrc = IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels, Usage & WINED3DUSAGE_MASK, - (WINED3DFORMAT)Format, (WINED3DPOOL) Pool, &object->wineD3DVolumeTexture, pSharedHandle, - (IUnknown *)object, D3D9CB_CreateVolume); - - + hrc = IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels, + Usage & WINED3DUSAGE_MASK, Format, Pool, &object->wineD3DVolumeTexture, pSharedHandle, (IUnknown *)object); if (hrc != D3D_OK) { /* free up object */ - FIXME("(%p) call to IWineD3DDevice_CreateVolumeTexture failed\n", This); + WARN("(%p) call to IWineD3DDevice_CreateVolumeTexture failed\n", This); HeapFree(GetProcessHeap(), 0, object); } else { IDirect3DDevice9Ex_AddRef(iface);