d3d9: Add a separate function for volume initialization.
This commit is contained in:
parent
2b2d3de025
commit
8ffca99fb0
|
@ -236,7 +236,6 @@ extern HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9EX ifa
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* IDirect3DVolume9 implementation structure
|
* IDirect3DVolume9 implementation structure
|
||||||
*/
|
*/
|
||||||
extern const IDirect3DVolume9Vtbl Direct3DVolume9_Vtbl;
|
|
||||||
typedef struct IDirect3DVolume9Impl
|
typedef struct IDirect3DVolume9Impl
|
||||||
{
|
{
|
||||||
/* IUnknown fields */
|
/* IUnknown fields */
|
||||||
|
@ -253,6 +252,9 @@ typedef struct IDirect3DVolume9Impl
|
||||||
IUnknown *forwardReference;
|
IUnknown *forwardReference;
|
||||||
} IDirect3DVolume9Impl;
|
} IDirect3DVolume9Impl;
|
||||||
|
|
||||||
|
HRESULT volume_init(IDirect3DVolume9Impl *volume, IDirect3DDevice9Impl *device, UINT width, UINT height,
|
||||||
|
UINT depth, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool);
|
||||||
|
|
||||||
/* ------------------- */
|
/* ------------------- */
|
||||||
/* IDirect3DSwapChain9 */
|
/* IDirect3DSwapChain9 */
|
||||||
/* ------------------- */
|
/* ------------------- */
|
||||||
|
|
|
@ -2149,15 +2149,11 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
|
||||||
return D3DERR_OUTOFVIDEOMEMORY;
|
return D3DERR_OUTOFVIDEOMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
object->lpVtbl = &Direct3DVolume9_Vtbl;
|
hr = volume_init(object, This, width, height, depth, usage, format, pool);
|
||||||
object->ref = 1;
|
|
||||||
hr = IWineD3DDevice_CreateVolume(This->WineD3DDevice, width, height, depth, usage & WINED3DUSAGE_MASK,
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2165,7 +2161,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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,7 +223,7 @@ static HRESULT WINAPI IDirect3DVolume9Impl_UnlockBox(LPDIRECT3DVOLUME9 iface) {
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const IDirect3DVolume9Vtbl Direct3DVolume9_Vtbl =
|
static const IDirect3DVolume9Vtbl Direct3DVolume9_Vtbl =
|
||||||
{
|
{
|
||||||
/* IUnknown */
|
/* IUnknown */
|
||||||
IDirect3DVolume9Impl_QueryInterface,
|
IDirect3DVolume9Impl_QueryInterface,
|
||||||
|
@ -249,3 +249,22 @@ ULONG WINAPI D3D9CB_DestroyVolume(IWineD3DVolume *pVolume) {
|
||||||
volumeParent->forwardReference = NULL;
|
volumeParent->forwardReference = NULL;
|
||||||
return IDirect3DVolume9_Release((IDirect3DVolume9*) volumeParent);
|
return IDirect3DVolume9_Release((IDirect3DVolume9*) volumeParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT volume_init(IDirect3DVolume9Impl *volume, IDirect3DDevice9Impl *device, UINT width, UINT height,
|
||||||
|
UINT depth, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
volume->lpVtbl = &Direct3DVolume9_Vtbl;
|
||||||
|
volume->ref = 1;
|
||||||
|
|
||||||
|
hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage & WINED3DUSAGE_MASK,
|
||||||
|
format, pool, &volume->wineD3DVolume, (IUnknown *)volume);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
WARN("Failed to create wined3d volume, hr %#x.\n", hr);
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return D3D_OK;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue