- Merge from trunk up to r45543
[reactos.git] / dll / directx / wine / d3d9 / volume.c
index 9dbb313..baa286b 100644 (file)
@@ -28,6 +28,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
 static HRESULT WINAPI IDirect3DVolume9Impl_QueryInterface(LPDIRECT3DVOLUME9 iface, REFIID riid, LPVOID* ppobj) {
     IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
 
+    TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj);
+
     if (IsEqualGUID(riid, &IID_IUnknown)
         || IsEqualGUID(riid, &IID_IDirect3DVolume9)) {
         IDirect3DVolume9_AddRef(iface);
@@ -43,7 +45,7 @@ static HRESULT WINAPI IDirect3DVolume9Impl_QueryInterface(LPDIRECT3DVOLUME9 ifac
 static ULONG WINAPI IDirect3DVolume9Impl_AddRef(LPDIRECT3DVOLUME9 iface) {
     IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
 
-    TRACE("(%p)\n", This);
+    TRACE("iface %p.\n", iface);
 
     if (This->forwardReference) {
         /* Forward refcounting */
@@ -52,7 +54,8 @@ static ULONG WINAPI IDirect3DVolume9Impl_AddRef(LPDIRECT3DVOLUME9 iface) {
     } else {
         /* No container, handle our own refcounting */
         ULONG ref = InterlockedIncrement(&This->ref);
-        TRACE("(%p) : AddRef from %d\n", This, ref - 1);
+
+        TRACE("%p increasing refcount to %u.\n", iface, ref);
 
         if (ref == 1)
         {
@@ -68,7 +71,7 @@ static ULONG WINAPI IDirect3DVolume9Impl_AddRef(LPDIRECT3DVOLUME9 iface) {
 static ULONG WINAPI IDirect3DVolume9Impl_Release(LPDIRECT3DVOLUME9 iface) {
     IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
 
-    TRACE("(%p)\n", This);
+    TRACE("iface %p.\n", iface);
 
     if (This->forwardReference) {
         /* Forward refcounting */
@@ -77,7 +80,8 @@ static ULONG WINAPI IDirect3DVolume9Impl_Release(LPDIRECT3DVOLUME9 iface) {
     } else {
         /* No container, handle our own refcounting */
         ULONG ref = InterlockedDecrement(&This->ref);
-        TRACE("(%p) : ReleaseRef to %d\n", This, ref);
+
+        TRACE("%p decreasing refcount to %u.\n", iface, ref);
 
         if (ref == 0) {
             wined3d_mutex_lock();
@@ -90,28 +94,32 @@ static ULONG WINAPI IDirect3DVolume9Impl_Release(LPDIRECT3DVOLUME9 iface) {
 }
 
 /* IDirect3DVolume9 Interface follow: */
-static HRESULT WINAPI IDirect3DVolume9Impl_GetDevice(LPDIRECT3DVOLUME9 iface, IDirect3DDevice9** ppDevice) {
+static HRESULT WINAPI IDirect3DVolume9Impl_GetDevice(IDirect3DVolume9 *iface, IDirect3DDevice9 **device)
+{
     IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
-    IWineD3DDevice       *myDevice = NULL;
-
-    TRACE("iface %p, ppDevice %p\n", iface, ppDevice);
+    IDirect3DResource9 *resource;
+    HRESULT hr;
 
-    wined3d_mutex_lock();
+    TRACE("iface %p, device %p.\n", iface, device);
 
-    IWineD3DVolume_GetDevice(This->wineD3DVolume, &myDevice);
-    IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice);
-    IWineD3DDevice_Release(myDevice);
+    hr = IUnknown_QueryInterface(This->forwardReference, &IID_IDirect3DResource9, (void **)&resource);
+    if (SUCCEEDED(hr))
+    {
+        hr = IDirect3DResource9_GetDevice(resource, device);
+        IDirect3DResource9_Release(resource);
 
-    wined3d_mutex_unlock();
+        TRACE("Returning device %p.\n", *device);
+    }
 
-    return D3D_OK;
+    return hr;
 }
 
 static HRESULT WINAPI IDirect3DVolume9Impl_SetPrivateData(LPDIRECT3DVOLUME9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
     IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
     HRESULT hr;
 
-    TRACE("(%p) Relay\n", This);
+    TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
+            iface, debugstr_guid(refguid), pData, SizeOfData, Flags);
 
     wined3d_mutex_lock();
 
@@ -126,7 +134,8 @@ static HRESULT WINAPI IDirect3DVolume9Impl_GetPrivateData(LPDIRECT3DVOLUME9 ifac
     IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
     HRESULT hr;
 
-    TRACE("(%p) Relay\n", This);
+    TRACE("iface %p, guid %s, data %p, data_size %p.\n",
+            iface, debugstr_guid(refguid), pData, pSizeOfData);
 
     wined3d_mutex_lock();
 
@@ -141,7 +150,7 @@ static HRESULT WINAPI IDirect3DVolume9Impl_FreePrivateData(LPDIRECT3DVOLUME9 ifa
     IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
     HRESULT hr;
 
-    TRACE("(%p) Relay\n", This);
+    TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid));
 
     wined3d_mutex_lock();
 
@@ -156,7 +165,7 @@ static HRESULT WINAPI IDirect3DVolume9Impl_GetContainer(LPDIRECT3DVOLUME9 iface,
     IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
     HRESULT res;
 
-    TRACE("(This %p, riid %s, ppContainer %p)\n", This, debugstr_guid(riid), ppContainer);
+    TRACE("iface %p, riid %s, container %p.\n", iface, debugstr_guid(riid), ppContainer);
 
     if (!This->container) return E_NOINTERFACE;
 
@@ -176,7 +185,7 @@ static HRESULT WINAPI IDirect3DVolume9Impl_GetDesc(LPDIRECT3DVOLUME9 iface, D3DV
     WINED3DVOLUME_DESC     wined3ddesc;
     HRESULT hr;
 
-    TRACE("(%p) Relay\n", This);
+    TRACE("iface %p, desc %p.\n", iface, pDesc);
 
     wined3d_mutex_lock();
 
@@ -202,7 +211,8 @@ static HRESULT WINAPI IDirect3DVolume9Impl_LockBox(LPDIRECT3DVOLUME9 iface, D3DL
     IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
     HRESULT hr;
 
-    TRACE("(%p) relay %p %p %p %d\n", This, This->wineD3DVolume, pLockedVolume, pBox, Flags);
+    TRACE("iface %p, locked_box %p, box %p, flags %#x.\n",
+            iface, pLockedVolume, pBox, Flags);
 
     wined3d_mutex_lock();
 
@@ -218,7 +228,7 @@ static HRESULT WINAPI IDirect3DVolume9Impl_UnlockBox(LPDIRECT3DVOLUME9 iface) {
     IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
     HRESULT hr;
 
-    TRACE("(%p) relay %p\n", This, This->wineD3DVolume);
+    TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();