Commit ff923245 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d8: Add a separate function for volume initialization.

parent 8ffca99f
...@@ -218,7 +218,6 @@ struct IDirect3DDevice8Impl ...@@ -218,7 +218,6 @@ struct IDirect3DDevice8Impl
/***************************************************************************** /*****************************************************************************
* IDirect3DVolume8 implementation structure * IDirect3DVolume8 implementation structure
*/ */
extern const IDirect3DVolume8Vtbl Direct3DVolume8_Vtbl;
struct IDirect3DVolume8Impl struct IDirect3DVolume8Impl
{ {
/* IUnknown fields */ /* IUnknown fields */
...@@ -235,6 +234,9 @@ struct IDirect3DVolume8Impl ...@@ -235,6 +234,9 @@ struct IDirect3DVolume8Impl
IUnknown *forwardReference; IUnknown *forwardReference;
}; };
HRESULT volume_init(IDirect3DVolume8Impl *volume, IDirect3DDevice8Impl *device, UINT width, UINT height,
UINT depth, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool);
/* ------------------- */ /* ------------------- */
/* IDirect3DSwapChain8 */ /* IDirect3DSwapChain8 */
/* ------------------- */ /* ------------------- */
......
...@@ -2753,15 +2753,11 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent ...@@ -2753,15 +2753,11 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
return D3DERR_OUTOFVIDEOMEMORY; return D3DERR_OUTOFVIDEOMEMORY;
} }
object->lpVtbl = &Direct3DVolume8_Vtbl; hr = volume_init(object, This, width, height, depth, usage, format, pool);
object->ref = 1;
hr = IWineD3DDevice_CreateVolume(This->WineD3DDevice, width, height, depth, usage,
format, pool, &object->wineD3DVolume, (IUnknown *)object);
if (FAILED(hr)) if (FAILED(hr))
{ {
ERR("(%p) CreateVolume failed, returning %#x\n", iface, hr); WARN("Failed to initialize volume, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); HeapFree(GetProcessHeap(), 0, object);
*volume = NULL;
return hr; return hr;
} }
...@@ -2769,7 +2765,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent ...@@ -2769,7 +2765,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
object->container = superior; object->container = superior;
object->forwardReference = superior; object->forwardReference = superior;
TRACE("(%p) Created volume %p\n", iface, *volume); TRACE("(%p) Created volume %p\n", iface, object);
return hr; return hr;
} }
......
...@@ -202,7 +202,7 @@ static HRESULT WINAPI IDirect3DVolume8Impl_UnlockBox(LPDIRECT3DVOLUME8 iface) { ...@@ -202,7 +202,7 @@ static HRESULT WINAPI IDirect3DVolume8Impl_UnlockBox(LPDIRECT3DVOLUME8 iface) {
return hr; return hr;
} }
const IDirect3DVolume8Vtbl Direct3DVolume8_Vtbl = static const IDirect3DVolume8Vtbl Direct3DVolume8_Vtbl =
{ {
/* IUnknown */ /* IUnknown */
IDirect3DVolume8Impl_QueryInterface, IDirect3DVolume8Impl_QueryInterface,
...@@ -228,3 +228,22 @@ ULONG WINAPI D3D8CB_DestroyVolume(IWineD3DVolume *pVolume) { ...@@ -228,3 +228,22 @@ ULONG WINAPI D3D8CB_DestroyVolume(IWineD3DVolume *pVolume) {
volumeParent->forwardReference = NULL; volumeParent->forwardReference = NULL;
return IDirect3DVolume8_Release((IDirect3DVolume8*) volumeParent); return IDirect3DVolume8_Release((IDirect3DVolume8*) volumeParent);
} }
HRESULT volume_init(IDirect3DVolume8Impl *volume, IDirect3DDevice8Impl *device, UINT width, UINT height,
UINT depth, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool)
{
HRESULT hr;
volume->lpVtbl = &Direct3DVolume8_Vtbl;
volume->ref = 1;
hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage,
format, pool, &volume->wineD3DVolume, (IUnknown *)volume);
if (FAILED(hr))
{
WARN("Failed to create wined3d volume, hr %#x.\n", hr);
return hr;
}
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