[PATCH 1/4] wined3d: Get rid of IWineD3DCubeTexture.

Henri Verbeet hverbeet at codeweavers.com
Thu Mar 17 17:15:09 CDT 2011


---
 dlls/d3d8/cubetexture.c        |   46 +++++++++++++++---------------
 dlls/d3d8/d3d8_private.h       |    8 +----
 dlls/d3d9/cubetexture.c        |   52 +++++++++++++++++-----------------
 dlls/d3d9/d3d9_private.h       |    9 +----
 dlls/ddraw/ddraw.c             |    3 +-
 dlls/wined3d/cubetexture.c     |   60 +++++++++++++++++----------------------
 dlls/wined3d/device.c          |    8 ++--
 dlls/wined3d/wined3d_private.h |    6 +---
 include/wine/wined3d.idl       |   11 +------
 9 files changed, 86 insertions(+), 117 deletions(-)

diff --git a/dlls/d3d8/cubetexture.c b/dlls/d3d8/cubetexture.c
index 0c7295a..2da348f 100644
--- a/dlls/d3d8/cubetexture.c
+++ b/dlls/d3d8/cubetexture.c
@@ -60,7 +60,7 @@ static ULONG WINAPI IDirect3DCubeTexture8Impl_AddRef(IDirect3DCubeTexture8 *ifac
     {
         IUnknown_AddRef(This->parentDevice);
         wined3d_mutex_lock();
-        IWineD3DCubeTexture_AddRef(This->wineD3DCubeTexture);
+        IWineD3DBaseTexture_AddRef(This->wined3d_texture);
         wined3d_mutex_unlock();
     }
 
@@ -77,10 +77,10 @@ static ULONG WINAPI IDirect3DCubeTexture8Impl_Release(IDirect3DCubeTexture8 *ifa
     if (ref == 0) {
         IDirect3DDevice8 *parentDevice = This->parentDevice;
 
-        TRACE("Releasing child %p\n", This->wineD3DCubeTexture);
+        TRACE("Releasing child %p.\n", This->wined3d_texture);
 
         wined3d_mutex_lock();
-        IWineD3DCubeTexture_Release(This->wineD3DCubeTexture);
+        IWineD3DBaseTexture_Release(This->wined3d_texture);
         wined3d_mutex_unlock();
 
         /* Release the device last, as it may cause the device to be destroyed. */
@@ -115,7 +115,7 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_SetPrivateData(IDirect3DCubeText
             iface, debugstr_guid(refguid), pData, SizeOfData, Flags);
 
     wined3d_mutex_lock();
-    hr = IWineD3DCubeTexture_SetPrivateData(This->wineD3DCubeTexture,refguid,pData,SizeOfData,Flags);
+    hr = IWineD3DBaseTexture_SetPrivateData(This->wined3d_texture, refguid, pData, SizeOfData, Flags);
     wined3d_mutex_unlock();
 
     return hr;
@@ -131,7 +131,7 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetPrivateData(IDirect3DCubeText
             iface, debugstr_guid(refguid), pData, pSizeOfData);
 
     wined3d_mutex_lock();
-    hr = IWineD3DCubeTexture_GetPrivateData(This->wineD3DCubeTexture,refguid,pData,pSizeOfData);
+    hr = IWineD3DBaseTexture_GetPrivateData(This->wined3d_texture, refguid, pData, pSizeOfData);
     wined3d_mutex_unlock();
 
     return hr;
@@ -146,7 +146,7 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_FreePrivateData(IDirect3DCubeTex
     TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid));
 
     wined3d_mutex_lock();
-    hr = IWineD3DCubeTexture_FreePrivateData(This->wineD3DCubeTexture,refguid);
+    hr = IWineD3DBaseTexture_FreePrivateData(This->wined3d_texture, refguid);
     wined3d_mutex_unlock();
 
     return hr;
@@ -161,7 +161,7 @@ static DWORD WINAPI IDirect3DCubeTexture8Impl_SetPriority(IDirect3DCubeTexture8
     TRACE("iface %p, priority %u.\n", iface, PriorityNew);
 
     wined3d_mutex_lock();
-    ret = IWineD3DCubeTexture_SetPriority(This->wineD3DCubeTexture, PriorityNew);
+    ret = IWineD3DBaseTexture_SetPriority(This->wined3d_texture, PriorityNew);
     wined3d_mutex_unlock();
 
     return ret;
@@ -175,7 +175,7 @@ static DWORD WINAPI IDirect3DCubeTexture8Impl_GetPriority(IDirect3DCubeTexture8
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    ret =  IWineD3DCubeTexture_GetPriority(This->wineD3DCubeTexture);
+    ret =  IWineD3DBaseTexture_GetPriority(This->wined3d_texture);
     wined3d_mutex_unlock();
 
     return ret;
@@ -188,7 +188,7 @@ static void WINAPI IDirect3DCubeTexture8Impl_PreLoad(IDirect3DCubeTexture8 *ifac
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    IWineD3DCubeTexture_PreLoad(This->wineD3DCubeTexture);
+    IWineD3DBaseTexture_PreLoad(This->wined3d_texture);
     wined3d_mutex_unlock();
 }
 
@@ -200,7 +200,7 @@ static D3DRESOURCETYPE WINAPI IDirect3DCubeTexture8Impl_GetType(IDirect3DCubeTex
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    type = IWineD3DCubeTexture_GetType(This->wineD3DCubeTexture);
+    type = IWineD3DBaseTexture_GetType(This->wined3d_texture);
     wined3d_mutex_unlock();
 
     return type;
@@ -215,7 +215,7 @@ static DWORD WINAPI IDirect3DCubeTexture8Impl_SetLOD(IDirect3DCubeTexture8 *ifac
     TRACE("iface %p, lod %u.\n", iface, LODNew);
 
     wined3d_mutex_lock();
-    lod = IWineD3DCubeTexture_SetLOD(This->wineD3DCubeTexture, LODNew);
+    lod = IWineD3DBaseTexture_SetLOD(This->wined3d_texture, LODNew);
     wined3d_mutex_unlock();
 
     return lod;
@@ -229,7 +229,7 @@ static DWORD WINAPI IDirect3DCubeTexture8Impl_GetLOD(IDirect3DCubeTexture8 *ifac
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    lod = IWineD3DCubeTexture_GetLOD(This->wineD3DCubeTexture);
+    lod = IWineD3DBaseTexture_GetLOD(This->wined3d_texture);
     wined3d_mutex_unlock();
 
     return lod;
@@ -243,7 +243,7 @@ static DWORD WINAPI IDirect3DCubeTexture8Impl_GetLevelCount(IDirect3DCubeTexture
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    cnt = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture);
+    cnt = IWineD3DBaseTexture_GetLevelCount(This->wined3d_texture);
     wined3d_mutex_unlock();
 
     return cnt;
@@ -260,7 +260,7 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetLevelDesc(IDirect3DCubeTextur
     TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
 
     wined3d_mutex_lock();
-    if (!(sub_resource = IWineD3DCubeTexture_GetSubResource(texture->wineD3DCubeTexture, level)))
+    if (!(sub_resource = IWineD3DBaseTexture_GetSubResource(texture->wined3d_texture, level)))
         hr = D3DERR_INVALIDCALL;
     else
     {
@@ -291,8 +291,8 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(IDirect3DCubeT
     TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, face, level, surface);
 
     wined3d_mutex_lock();
-    sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(texture->wineD3DCubeTexture) * face + level;
-    if (!(sub_resource = IWineD3DCubeTexture_GetSubResource(texture->wineD3DCubeTexture, sub_resource_idx)))
+    sub_resource_idx = IWineD3DBaseTexture_GetLevelCount(texture->wined3d_texture) * face + level;
+    if (!(sub_resource = IWineD3DBaseTexture_GetSubResource(texture->wined3d_texture, sub_resource_idx)))
     {
         wined3d_mutex_unlock();
         return D3DERR_INVALIDCALL;
@@ -318,8 +318,8 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(IDirect3DCubeTexture8 *
             iface, face, level, locked_rect, rect, flags);
 
     wined3d_mutex_lock();
-    sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(texture->wineD3DCubeTexture) * face + level;
-    if (!(sub_resource = IWineD3DCubeTexture_GetSubResource(texture->wineD3DCubeTexture, sub_resource_idx)))
+    sub_resource_idx = IWineD3DBaseTexture_GetLevelCount(texture->wined3d_texture) * face + level;
+    if (!(sub_resource = IWineD3DBaseTexture_GetSubResource(texture->wined3d_texture, sub_resource_idx)))
         hr = D3DERR_INVALIDCALL;
     else
         hr = IDirect3DSurface8_LockRect((IDirect3DSurface8 *)wined3d_resource_get_parent(sub_resource),
@@ -340,8 +340,8 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_UnlockRect(IDirect3DCubeTexture8
     TRACE("iface %p, face %#x, level %u.\n", iface, face, level);
 
     wined3d_mutex_lock();
-    sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(texture->wineD3DCubeTexture) * face + level;
-    if (!(sub_resource = IWineD3DCubeTexture_GetSubResource(texture->wineD3DCubeTexture, sub_resource_idx)))
+    sub_resource_idx = IWineD3DBaseTexture_GetLevelCount(texture->wined3d_texture) * face + level;
+    if (!(sub_resource = IWineD3DBaseTexture_GetSubResource(texture->wined3d_texture, sub_resource_idx)))
         hr = D3DERR_INVALIDCALL;
     else
         hr = IDirect3DSurface8_UnlockRect((IDirect3DSurface8 *)wined3d_resource_get_parent(sub_resource));
@@ -361,7 +361,7 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_AddDirtyRect(IDirect3DCubeTextur
 
     wined3d_mutex_lock();
     if (!dirty_rect)
-        hr = IWineD3DCubeTexture_AddDirtyRegion(texture->wineD3DCubeTexture, face, NULL);
+        hr = IWineD3DBaseTexture_AddDirtyRegion(texture->wined3d_texture, face, NULL);
     else
     {
         WINED3DBOX dirty_region;
@@ -372,7 +372,7 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_AddDirtyRect(IDirect3DCubeTextur
         dirty_region.Bottom = dirty_rect->bottom;
         dirty_region.Front = 0;
         dirty_region.Back = 1;
-        hr = IWineD3DCubeTexture_AddDirtyRegion(texture->wineD3DCubeTexture, face, &dirty_region);
+        hr = IWineD3DBaseTexture_AddDirtyRegion(texture->wined3d_texture, face, &dirty_region);
     }
     wined3d_mutex_unlock();
 
@@ -427,7 +427,7 @@ HRESULT cubetexture_init(IDirect3DCubeTexture8Impl *texture, IDirect3DDevice8Imp
     wined3d_mutex_lock();
     hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length, levels,
             usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, texture,
-            &d3d8_cubetexture_wined3d_parent_ops, &texture->wineD3DCubeTexture);
+            &d3d8_cubetexture_wined3d_parent_ops, &texture->wined3d_texture);
     wined3d_mutex_unlock();
     if (FAILED(hr))
     {
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h
index c7a5c77..a6591fd 100644
--- a/dlls/d3d8/d3d8_private.h
+++ b/dlls/d3d8/d3d8_private.h
@@ -340,12 +340,8 @@ struct IDirect3DCubeTexture8Impl
 {
     IDirect3DCubeTexture8   IDirect3DCubeTexture8_iface;
     LONG                    ref;
-
-    /* IDirect3DResource8 fields */
-    IWineD3DCubeTexture    *wineD3DCubeTexture;
-
-    /* Parent reference */
-    IDirect3DDevice8       *parentDevice;
+    IWineD3DBaseTexture *wined3d_texture;
+    IDirect3DDevice8 *parentDevice;
 };
 
 HRESULT cubetexture_init(IDirect3DCubeTexture8Impl *texture, IDirect3DDevice8Impl *device,
diff --git a/dlls/d3d9/cubetexture.c b/dlls/d3d9/cubetexture.c
index fb52e37..6540f04 100644
--- a/dlls/d3d9/cubetexture.c
+++ b/dlls/d3d9/cubetexture.c
@@ -56,7 +56,7 @@ static ULONG WINAPI IDirect3DCubeTexture9Impl_AddRef(LPDIRECT3DCUBETEXTURE9 ifac
     {
         IDirect3DDevice9Ex_AddRef(This->parentDevice);
         wined3d_mutex_lock();
-        IWineD3DCubeTexture_AddRef(This->wineD3DCubeTexture);
+        IWineD3DBaseTexture_AddRef(This->wined3d_texture);
         wined3d_mutex_unlock();
     }
 
@@ -72,10 +72,10 @@ static ULONG WINAPI IDirect3DCubeTexture9Impl_Release(LPDIRECT3DCUBETEXTURE9 ifa
     if (ref == 0) {
         IDirect3DDevice9Ex *parentDevice = This->parentDevice;
 
-        TRACE("Releasing child %p\n", This->wineD3DCubeTexture);
+        TRACE("Releasing child %p.\n", This->wined3d_texture);
 
         wined3d_mutex_lock();
-        IWineD3DCubeTexture_Release(This->wineD3DCubeTexture);
+        IWineD3DBaseTexture_Release(This->wined3d_texture);
         wined3d_mutex_unlock();
 
         /* Release the device last, as it may cause the device to be destroyed. */
@@ -107,7 +107,7 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_SetPrivateData(LPDIRECT3DCUBETEX
             iface, debugstr_guid(refguid), pData, SizeOfData, Flags);
 
     wined3d_mutex_lock();
-    hr = IWineD3DCubeTexture_SetPrivateData(This->wineD3DCubeTexture,refguid,pData,SizeOfData,Flags);
+    hr = IWineD3DBaseTexture_SetPrivateData(This->wined3d_texture, refguid, pData, SizeOfData, Flags);
     wined3d_mutex_unlock();
 
     return hr;
@@ -121,7 +121,7 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetPrivateData(LPDIRECT3DCUBETEX
             iface, debugstr_guid(refguid), pData, pSizeOfData);
 
     wined3d_mutex_lock();
-    hr = IWineD3DCubeTexture_GetPrivateData(This->wineD3DCubeTexture,refguid,pData,pSizeOfData);
+    hr = IWineD3DBaseTexture_GetPrivateData(This->wined3d_texture, refguid, pData, pSizeOfData);
     wined3d_mutex_unlock();
 
     return hr;
@@ -134,7 +134,7 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_FreePrivateData(LPDIRECT3DCUBETE
     TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid));
 
     wined3d_mutex_lock();
-    hr = IWineD3DCubeTexture_FreePrivateData(This->wineD3DCubeTexture,refguid);
+    hr = IWineD3DBaseTexture_FreePrivateData(This->wined3d_texture, refguid);
     wined3d_mutex_unlock();
 
     return hr;
@@ -147,7 +147,7 @@ static DWORD WINAPI IDirect3DCubeTexture9Impl_SetPriority(LPDIRECT3DCUBETEXTURE9
     TRACE("iface %p, priority %u.\n", iface, PriorityNew);
 
     wined3d_mutex_lock();
-    ret = IWineD3DCubeTexture_SetPriority(This->wineD3DCubeTexture, PriorityNew);
+    ret = IWineD3DBaseTexture_SetPriority(This->wined3d_texture, PriorityNew);
     wined3d_mutex_unlock();
 
     return ret;
@@ -160,7 +160,7 @@ static DWORD WINAPI IDirect3DCubeTexture9Impl_GetPriority(LPDIRECT3DCUBETEXTURE9
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    ret = IWineD3DCubeTexture_GetPriority(This->wineD3DCubeTexture);
+    ret = IWineD3DBaseTexture_GetPriority(This->wined3d_texture);
     wined3d_mutex_unlock();
 
     return ret;
@@ -172,7 +172,7 @@ static void WINAPI IDirect3DCubeTexture9Impl_PreLoad(LPDIRECT3DCUBETEXTURE9 ifac
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    IWineD3DCubeTexture_PreLoad(This->wineD3DCubeTexture);
+    IWineD3DBaseTexture_PreLoad(This->wined3d_texture);
     wined3d_mutex_unlock();
 }
 
@@ -183,7 +183,7 @@ static D3DRESOURCETYPE WINAPI IDirect3DCubeTexture9Impl_GetType(LPDIRECT3DCUBETE
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    ret = IWineD3DCubeTexture_GetType(This->wineD3DCubeTexture);
+    ret = IWineD3DBaseTexture_GetType(This->wined3d_texture);
     wined3d_mutex_unlock();
 
     return ret;
@@ -197,7 +197,7 @@ static DWORD WINAPI IDirect3DCubeTexture9Impl_SetLOD(LPDIRECT3DCUBETEXTURE9 ifac
     TRACE("iface %p, lod %u.\n", iface, LODNew);
 
     wined3d_mutex_lock();
-    ret = IWineD3DCubeTexture_SetLOD(This->wineD3DCubeTexture, LODNew);
+    ret = IWineD3DBaseTexture_SetLOD(This->wined3d_texture, LODNew);
     wined3d_mutex_unlock();
 
     return ret;
@@ -210,7 +210,7 @@ static DWORD WINAPI IDirect3DCubeTexture9Impl_GetLOD(LPDIRECT3DCUBETEXTURE9 ifac
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    ret = IWineD3DCubeTexture_GetLOD(This->wineD3DCubeTexture);
+    ret = IWineD3DBaseTexture_GetLOD(This->wined3d_texture);
     wined3d_mutex_unlock();
 
     return ret;
@@ -223,7 +223,7 @@ static DWORD WINAPI IDirect3DCubeTexture9Impl_GetLevelCount(LPDIRECT3DCUBETEXTUR
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    ret = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture);
+    ret = IWineD3DBaseTexture_GetLevelCount(This->wined3d_texture);
     wined3d_mutex_unlock();
 
     return ret;
@@ -236,7 +236,7 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_SetAutoGenFilterType(LPDIRECT3DC
     TRACE("iface %p, filter_type %#x.\n", iface, FilterType);
 
     wined3d_mutex_lock();
-    hr = IWineD3DCubeTexture_SetAutoGenFilterType(This->wineD3DCubeTexture, (WINED3DTEXTUREFILTERTYPE) FilterType);
+    hr = IWineD3DBaseTexture_SetAutoGenFilterType(This->wined3d_texture, (WINED3DTEXTUREFILTERTYPE)FilterType);
     wined3d_mutex_unlock();
 
     return hr;
@@ -249,7 +249,7 @@ static D3DTEXTUREFILTERTYPE WINAPI IDirect3DCubeTexture9Impl_GetAutoGenFilterTyp
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    ret = (D3DTEXTUREFILTERTYPE) IWineD3DCubeTexture_GetAutoGenFilterType(This->wineD3DCubeTexture);
+    ret = (D3DTEXTUREFILTERTYPE)IWineD3DBaseTexture_GetAutoGenFilterType(This->wined3d_texture);
     wined3d_mutex_unlock();
 
     return ret;
@@ -261,7 +261,7 @@ static void WINAPI IDirect3DCubeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DCUBE
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    IWineD3DCubeTexture_GenerateMipSubLevels(This->wineD3DCubeTexture);
+    IWineD3DBaseTexture_GenerateMipSubLevels(This->wined3d_texture);
     wined3d_mutex_unlock();
 }
 
@@ -276,7 +276,7 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(IDirect3DCubeTextur
     TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
 
     wined3d_mutex_lock();
-    if (!(sub_resource = IWineD3DCubeTexture_GetSubResource(texture->wineD3DCubeTexture, level)))
+    if (!(sub_resource = IWineD3DBaseTexture_GetSubResource(texture->wined3d_texture, level)))
         hr = D3DERR_INVALIDCALL;
     else
     {
@@ -307,8 +307,8 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(IDirect3DCubeT
     TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, face, level, surface);
 
     wined3d_mutex_lock();
-    sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(texture->wineD3DCubeTexture) * face + level;
-    if (!(sub_resource = IWineD3DCubeTexture_GetSubResource(texture->wineD3DCubeTexture, sub_resource_idx)))
+    sub_resource_idx = IWineD3DBaseTexture_GetLevelCount(texture->wined3d_texture) * face + level;
+    if (!(sub_resource = IWineD3DBaseTexture_GetSubResource(texture->wined3d_texture, sub_resource_idx)))
     {
         wined3d_mutex_unlock();
         return D3DERR_INVALIDCALL;
@@ -333,8 +333,8 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(IDirect3DCubeTexture9 *
             iface, face, level, locked_rect, rect, flags);
 
     wined3d_mutex_lock();
-    sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(texture->wineD3DCubeTexture) * face + level;
-    if (!(sub_resource = IWineD3DCubeTexture_GetSubResource(texture->wineD3DCubeTexture, sub_resource_idx)))
+    sub_resource_idx = IWineD3DBaseTexture_GetLevelCount(texture->wined3d_texture) * face + level;
+    if (!(sub_resource = IWineD3DBaseTexture_GetSubResource(texture->wined3d_texture, sub_resource_idx)))
         hr = D3DERR_INVALIDCALL;
     else
         hr = IDirect3DSurface9_LockRect((IDirect3DSurface9 *)wined3d_resource_get_parent(sub_resource),
@@ -355,8 +355,8 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_UnlockRect(IDirect3DCubeTexture9
     TRACE("iface %p, face %#x, level %u.\n", iface, face, level);
 
     wined3d_mutex_lock();
-    sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(texture->wineD3DCubeTexture) * face + level;
-    if (!(sub_resource = IWineD3DCubeTexture_GetSubResource(texture->wineD3DCubeTexture, sub_resource_idx)))
+    sub_resource_idx = IWineD3DBaseTexture_GetLevelCount(texture->wined3d_texture) * face + level;
+    if (!(sub_resource = IWineD3DBaseTexture_GetSubResource(texture->wined3d_texture, sub_resource_idx)))
         hr = D3DERR_INVALIDCALL;
     else
         hr = IDirect3DSurface9_UnlockRect((IDirect3DSurface9 *)wined3d_resource_get_parent(sub_resource));
@@ -376,7 +376,7 @@ static HRESULT  WINAPI IDirect3DCubeTexture9Impl_AddDirtyRect(IDirect3DCubeTextu
 
     wined3d_mutex_lock();
     if (!dirty_rect)
-        hr = IWineD3DCubeTexture_AddDirtyRegion(texture->wineD3DCubeTexture, face, NULL);
+        hr = IWineD3DBaseTexture_AddDirtyRegion(texture->wined3d_texture, face, NULL);
     else
     {
         WINED3DBOX dirty_region;
@@ -387,7 +387,7 @@ static HRESULT  WINAPI IDirect3DCubeTexture9Impl_AddDirtyRect(IDirect3DCubeTextu
         dirty_region.Bottom = dirty_rect->bottom;
         dirty_region.Front = 0;
         dirty_region.Back = 1;
-        hr = IWineD3DCubeTexture_AddDirtyRegion(texture->wineD3DCubeTexture, face, &dirty_region);
+        hr = IWineD3DBaseTexture_AddDirtyRegion(texture->wined3d_texture, face, &dirty_region);
     }
     wined3d_mutex_unlock();
 
@@ -444,7 +444,7 @@ HRESULT cubetexture_init(IDirect3DCubeTexture9Impl *texture, IDirect3DDevice9Imp
     wined3d_mutex_lock();
     hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length,
             levels, usage, wined3dformat_from_d3dformat(format), pool, texture,
-            &d3d9_cubetexture_wined3d_parent_ops, &texture->wineD3DCubeTexture);
+            &d3d9_cubetexture_wined3d_parent_ops, &texture->wined3d_texture);
     wined3d_mutex_unlock();
     if (FAILED(hr))
     {
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h
index e02e8bb..734f9fb 100644
--- a/dlls/d3d9/d3d9_private.h
+++ b/dlls/d3d9/d3d9_private.h
@@ -330,15 +330,10 @@ typedef struct IDirect3DBaseTexture9Impl
  */
 typedef struct IDirect3DCubeTexture9Impl
 {
-    /* IUnknown fields */
     const IDirect3DCubeTexture9Vtbl *lpVtbl;
     LONG                    ref;
-
-    /* IDirect3DResource9 fields */
-    IWineD3DCubeTexture    *wineD3DCubeTexture;
-
-    /* Parent reference */
-    LPDIRECT3DDEVICE9EX       parentDevice;
+    IWineD3DBaseTexture *wined3d_texture;
+    IDirect3DDevice9Ex *parentDevice;
 }  IDirect3DCubeTexture9Impl;
 
 HRESULT cubetexture_init(IDirect3DCubeTexture9Impl *texture, IDirect3DDevice9Impl *device,
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index df1c566..f6c6c6f 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -3438,8 +3438,7 @@ static HRESULT CreateSurface(IDirectDrawImpl *ddraw, DDSURFACEDESC2 *DDSD,
         if(desc2.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
         {
             hr = IWineD3DDevice_CreateCubeTexture(ddraw->wineD3DDevice, DDSD->dwWidth, levels, 0,
-                    Format, Pool, object, &ddraw_null_wined3d_parent_ops,
-                    (IWineD3DCubeTexture **)&object->wineD3DTexture);
+                    Format, Pool, object, &ddraw_null_wined3d_parent_ops, &object->wineD3DTexture);
         }
         else
         {
diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c
index aed3674..4be1fee 100644
--- a/dlls/wined3d/cubetexture.c
+++ b/dlls/wined3d/cubetexture.c
@@ -1,6 +1,4 @@
 /*
- * IWineD3DCubeTexture implementation
- *
  * Copyright 2002-2005 Jason Edmeades
  * Copyright 2002-2005 Raphael Junqueira
  * Copyright 2005 Oliver Stieber
@@ -197,19 +195,15 @@ static void cubetexture_cleanup(IWineD3DCubeTextureImpl *This)
     basetexture_cleanup((IWineD3DBaseTextureImpl *)This);
 }
 
-/* *******************************************
-   IWineD3DCubeTexture IUnknown parts follow
-   ******************************************* */
-
-static HRESULT WINAPI IWineD3DCubeTextureImpl_QueryInterface(IWineD3DCubeTexture *iface, REFIID riid, LPVOID *ppobj)
+static HRESULT WINAPI IWineD3DCubeTextureImpl_QueryInterface(IWineD3DBaseTexture *iface, REFIID riid, LPVOID *ppobj)
 {
     IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
     TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
     if (IsEqualGUID(riid, &IID_IUnknown)
         || IsEqualGUID(riid, &IID_IWineD3DBase)
         || IsEqualGUID(riid, &IID_IWineD3DResource)
-        || IsEqualGUID(riid, &IID_IWineD3DBaseTexture)
-        || IsEqualGUID(riid, &IID_IWineD3DCubeTexture)) {
+        || IsEqualGUID(riid, &IID_IWineD3DBaseTexture))
+    {
         IUnknown_AddRef(iface);
         *ppobj = This;
         return S_OK;
@@ -218,14 +212,16 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_QueryInterface(IWineD3DCubeTexture
     return E_NOINTERFACE;
 }
 
-static ULONG WINAPI IWineD3DCubeTextureImpl_AddRef(IWineD3DCubeTexture *iface) {
+static ULONG WINAPI IWineD3DCubeTextureImpl_AddRef(IWineD3DBaseTexture *iface)
+{
     IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
     TRACE("(%p) : AddRef increasing from %d\n", This, This->resource.ref);
     return InterlockedIncrement(&This->resource.ref);
 }
 
 /* Do not call while under the GL lock. */
-static ULONG WINAPI IWineD3DCubeTextureImpl_Release(IWineD3DCubeTexture *iface) {
+static ULONG WINAPI IWineD3DCubeTextureImpl_Release(IWineD3DBaseTexture *iface)
+{
     IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
     ULONG ref;
     TRACE("(%p) : Releasing from %d\n", This, This->resource.ref);
@@ -239,87 +235,83 @@ static ULONG WINAPI IWineD3DCubeTextureImpl_Release(IWineD3DCubeTexture *iface)
     return ref;
 }
 
-/* ****************************************************
-   IWineD3DCubeTexture IWineD3DResource parts follow
-   **************************************************** */
-static HRESULT WINAPI IWineD3DCubeTextureImpl_SetPrivateData(IWineD3DCubeTexture *iface,
+static HRESULT WINAPI IWineD3DCubeTextureImpl_SetPrivateData(IWineD3DBaseTexture *iface,
         REFGUID riid, const void *data, DWORD data_size, DWORD flags)
 {
     return resource_set_private_data(&((IWineD3DCubeTextureImpl *)iface)->resource, riid, data, data_size, flags);
 }
 
-static HRESULT WINAPI IWineD3DCubeTextureImpl_GetPrivateData(IWineD3DCubeTexture *iface,
+static HRESULT WINAPI IWineD3DCubeTextureImpl_GetPrivateData(IWineD3DBaseTexture *iface,
         REFGUID guid, void *data, DWORD *data_size)
 {
     return resource_get_private_data(&((IWineD3DCubeTextureImpl *)iface)->resource, guid, data, data_size);
 }
 
-static HRESULT WINAPI IWineD3DCubeTextureImpl_FreePrivateData(IWineD3DCubeTexture *iface, REFGUID refguid)
+static HRESULT WINAPI IWineD3DCubeTextureImpl_FreePrivateData(IWineD3DBaseTexture *iface, REFGUID refguid)
 {
     return resource_free_private_data(&((IWineD3DCubeTextureImpl *)iface)->resource, refguid);
 }
 
-static DWORD WINAPI IWineD3DCubeTextureImpl_SetPriority(IWineD3DCubeTexture *iface, DWORD priority)
+static DWORD WINAPI IWineD3DCubeTextureImpl_SetPriority(IWineD3DBaseTexture *iface, DWORD priority)
 {
     return resource_set_priority(&((IWineD3DCubeTextureImpl *)iface)->resource, priority);
 }
 
-static DWORD WINAPI IWineD3DCubeTextureImpl_GetPriority(IWineD3DCubeTexture *iface)
+static DWORD WINAPI IWineD3DCubeTextureImpl_GetPriority(IWineD3DBaseTexture *iface)
 {
     return resource_get_priority(&((IWineD3DCubeTextureImpl *)iface)->resource);
 }
 
 /* Do not call while under the GL lock. */
-static void WINAPI IWineD3DCubeTextureImpl_PreLoad(IWineD3DCubeTexture *iface)
+static void WINAPI IWineD3DCubeTextureImpl_PreLoad(IWineD3DBaseTexture *iface)
 {
     cubetexture_preload((IWineD3DBaseTextureImpl *)iface, SRGB_ANY);
 }
 
-static WINED3DRESOURCETYPE WINAPI IWineD3DCubeTextureImpl_GetType(IWineD3DCubeTexture *iface)
+static WINED3DRESOURCETYPE WINAPI IWineD3DCubeTextureImpl_GetType(IWineD3DBaseTexture *iface)
 {
     return resource_get_type(&((IWineD3DCubeTextureImpl *)iface)->resource);
 }
 
-static void * WINAPI IWineD3DCubeTextureImpl_GetParent(IWineD3DCubeTexture *iface)
+static void * WINAPI IWineD3DCubeTextureImpl_GetParent(IWineD3DBaseTexture *iface)
 {
     TRACE("iface %p.\n", iface);
 
     return ((IWineD3DCubeTextureImpl *)iface)->resource.parent;
 }
 
-/* ******************************************************
-   IWineD3DCubeTexture IWineD3DBaseTexture parts follow
-   ****************************************************** */
-static DWORD WINAPI IWineD3DCubeTextureImpl_SetLOD(IWineD3DCubeTexture *iface, DWORD LODNew) {
+static DWORD WINAPI IWineD3DCubeTextureImpl_SetLOD(IWineD3DBaseTexture *iface, DWORD LODNew)
+{
     return basetexture_set_lod((IWineD3DBaseTextureImpl *)iface, LODNew);
 }
 
-static DWORD WINAPI IWineD3DCubeTextureImpl_GetLOD(IWineD3DCubeTexture *iface) {
+static DWORD WINAPI IWineD3DCubeTextureImpl_GetLOD(IWineD3DBaseTexture *iface)
+{
     return basetexture_get_lod((IWineD3DBaseTextureImpl *)iface);
 }
 
-static DWORD WINAPI IWineD3DCubeTextureImpl_GetLevelCount(IWineD3DCubeTexture *iface)
+static DWORD WINAPI IWineD3DCubeTextureImpl_GetLevelCount(IWineD3DBaseTexture *iface)
 {
     return basetexture_get_level_count((IWineD3DBaseTextureImpl *)iface);
 }
 
-static HRESULT WINAPI IWineD3DCubeTextureImpl_SetAutoGenFilterType(IWineD3DCubeTexture *iface,
+static HRESULT WINAPI IWineD3DCubeTextureImpl_SetAutoGenFilterType(IWineD3DBaseTexture *iface,
         WINED3DTEXTUREFILTERTYPE FilterType)
 {
   return basetexture_set_autogen_filter_type((IWineD3DBaseTextureImpl *)iface, FilterType);
 }
 
-static WINED3DTEXTUREFILTERTYPE WINAPI IWineD3DCubeTextureImpl_GetAutoGenFilterType(IWineD3DCubeTexture *iface)
+static WINED3DTEXTUREFILTERTYPE WINAPI IWineD3DCubeTextureImpl_GetAutoGenFilterType(IWineD3DBaseTexture *iface)
 {
   return basetexture_get_autogen_filter_type((IWineD3DBaseTextureImpl *)iface);
 }
 
-static void WINAPI IWineD3DCubeTextureImpl_GenerateMipSubLevels(IWineD3DCubeTexture *iface)
+static void WINAPI IWineD3DCubeTextureImpl_GenerateMipSubLevels(IWineD3DBaseTexture *iface)
 {
     basetexture_generate_mipmaps((IWineD3DBaseTextureImpl *)iface);
 }
 
-static struct wined3d_resource * WINAPI IWineD3DCubeTextureImpl_GetSubResource(IWineD3DCubeTexture *iface,
+static struct wined3d_resource * WINAPI IWineD3DCubeTextureImpl_GetSubResource(IWineD3DBaseTexture *iface,
         UINT sub_resource_idx)
 {
     IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
@@ -329,7 +321,7 @@ static struct wined3d_resource * WINAPI IWineD3DCubeTextureImpl_GetSubResource(I
     return basetexture_get_sub_resource(texture, sub_resource_idx);
 }
 
-static HRESULT WINAPI IWineD3DCubeTextureImpl_AddDirtyRegion(IWineD3DCubeTexture *iface,
+static HRESULT WINAPI IWineD3DCubeTextureImpl_AddDirtyRegion(IWineD3DBaseTexture *iface,
         UINT layer, const WINED3DBOX *dirty_region)
 {
     IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
@@ -349,7 +341,7 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_AddDirtyRegion(IWineD3DCubeTexture
     return WINED3D_OK;
 }
 
-static const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl =
+static const IWineD3DBaseTextureVtbl IWineD3DCubeTexture_Vtbl =
 {
     /* IUnknown */
     IWineD3DCubeTextureImpl_QueryInterface,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 199aba9..fa3cf2f 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1204,7 +1204,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface, UIN
 
 static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface, UINT EdgeLength, UINT Levels,
         DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool, void *parent,
-        const struct wined3d_parent_ops *parent_ops, IWineD3DCubeTexture **ppCubeTexture)
+        const struct wined3d_parent_ops *parent_ops, IWineD3DBaseTexture **texture)
 {
     IWineD3DDeviceImpl      *This = (IWineD3DDeviceImpl *)iface;
     IWineD3DCubeTextureImpl *object; /** NOTE: impl ref allowed since this is a create function **/
@@ -1214,7 +1214,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
     if (!object)
     {
         ERR("Out of memory\n");
-        *ppCubeTexture = NULL;
+        *texture = NULL;
         return WINED3DERR_OUTOFVIDEOMEMORY;
     }
 
@@ -1223,12 +1223,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
     {
         WARN("Failed to initialize cubetexture, returning %#x\n", hr);
         HeapFree(GetProcessHeap(), 0, object);
-        *ppCubeTexture = NULL;
+        *texture = NULL;
         return hr;
     }
 
     TRACE("(%p) : Created Cube Texture %p\n", This, object);
-    *ppCubeTexture = (IWineD3DCubeTexture *)object;
+    *texture = (IWineD3DBaseTexture *)object;
 
     return WINED3D_OK;
 }
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ca113d1..71897ce 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1962,13 +1962,9 @@ HRESULT volumetexture_init(IWineD3DBaseTextureImpl *texture, UINT width, UINT he
         UINT depth, UINT levels, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id,
         WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
 
-/*****************************************************************************
- * IWineD3DCubeTexture implementation structure (extends IWineD3DBaseTextureImpl)
- */
 typedef struct IWineD3DCubeTextureImpl
 {
-    /* IUnknown & WineD3DResource/WineD3DBaseTexture Information     */
-    const IWineD3DCubeTextureVtbl *lpVtbl;
+    const IWineD3DBaseTextureVtbl *lpVtbl;
     struct wined3d_resource resource;
     IWineD3DBaseTextureClass  baseTexture;
 } IWineD3DCubeTextureImpl;
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index 50eba07..cc27d6a 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -2368,15 +2368,6 @@ interface IWineD3DBaseTexture : IWineD3DResource
 [
     object,
     local,
-    uuid(41752900-6f30-11d9-c687-00046142c14f)
-]
-interface IWineD3DCubeTexture : IWineD3DBaseTexture
-{
-}
-
-[
-    object,
-    local,
     uuid(34d01b10-6f30-11d9-c687-00046142c14f)
 ]
 interface IWineD3DSwapChain : IWineD3DBase
@@ -2564,7 +2555,7 @@ interface IWineD3DDevice : IUnknown
         [in] WINED3DPOOL pool,
         [in] void *parent,
         [in] const struct wined3d_parent_ops *parent_ops,
-        [out] IWineD3DCubeTexture **texture
+        [out] IWineD3DBaseTexture **texture
     );
     HRESULT CreateQuery(
         [in] WINED3DQUERYTYPE type,
-- 
1.7.3.4




More information about the wine-patches mailing list