diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index 391f91e9f0e..58969e3a449 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -239,6 +239,9 @@ typedef struct IDirect3DVolume9Impl /* IDirect3DVolume9 fields */ IWineD3DVolume *wineD3DVolume; + /* The volume container */ + IUnknown *container; + /* If set forward refcounting to this object */ IUnknown *forwardReference; } IDirect3DVolume9Impl; diff --git a/dlls/d3d9/volume.c b/dlls/d3d9/volume.c index f9ce7fc021c..1a6f32daa78 100644 --- a/dlls/d3d9/volume.c +++ b/dlls/d3d9/volume.c @@ -111,35 +111,17 @@ static HRESULT WINAPI IDirect3DVolume9Impl_FreePrivateData(LPDIRECT3DVOLUME9 ifa static HRESULT WINAPI IDirect3DVolume9Impl_GetContainer(LPDIRECT3DVOLUME9 iface, REFIID riid, void** ppContainer) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; - IWineD3DBase *wineD3DContainer = NULL; - IUnknown *wineD3DContainerParent = NULL; HRESULT res; TRACE("(This %p, riid %s, ppContainer %p)\n", This, debugstr_guid(riid), ppContainer); + if (!This->container) return E_NOINTERFACE; + if (!ppContainer) { ERR("Called without a valid ppContainer.\n"); } - /* Get the WineD3D container. */ - res = IWineD3DVolume_GetContainer(This->wineD3DVolume, &IID_IWineD3DBase, (void **)&wineD3DContainer); - if (res != D3D_OK) return res; - - if (!wineD3DContainer) { - ERR("IWineD3DSurface_GetContainer should never return NULL\n"); - } - - /* Get the parent */ - IWineD3DBase_GetParent(wineD3DContainer, &wineD3DContainerParent); - IUnknown_Release(wineD3DContainer); - - if (!wineD3DContainerParent) { - ERR("IWineD3DBase_GetParent should never return NULL\n"); - } - - /* Now, query the interface of the parent for the riid */ - res = IUnknown_QueryInterface(wineD3DContainerParent, riid, ppContainer); - IUnknown_Release(wineD3DContainerParent); + res = IUnknown_QueryInterface(This->container, riid, ppContainer); TRACE("Returning ppContainer %p, *ppContainer %p\n", ppContainer, *ppContainer); @@ -224,6 +206,7 @@ HRESULT WINAPI D3D9CB_CreateVolume(IUnknown *pDevice, IUnknown *pSuperior, UINT *ppVolume = NULL; } else { *ppVolume = (IWineD3DVolume *)object->wineD3DVolume; + object->container = pSuperior; object->forwardReference = pSuperior; } TRACE("(%p) Created volume %p\n", This, *ppVolume);