=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: d3d11: Implement d3d11_texture2d_GetDevice.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Aug 26 09:57:11 CDT 2015


Module: wine
Branch: master
Commit: c917a987dc3ae94c4c42047599fee79e64afcc97
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c917a987dc3ae94c4c42047599fee79e64afcc97

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Wed Aug 26 00:56:06 2015 +0200

d3d11: Implement d3d11_texture2d_GetDevice.

---

 dlls/d3d11/d3d11_private.h |  2 +-
 dlls/d3d11/texture.c       | 20 ++++++++++++--------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h
index 93a957c..ebbbec9 100644
--- a/dlls/d3d11/d3d11_private.h
+++ b/dlls/d3d11/d3d11_private.h
@@ -95,7 +95,7 @@ struct d3d10_texture2d
     IUnknown *dxgi_surface;
     struct wined3d_texture *wined3d_texture;
     D3D10_TEXTURE2D_DESC desc;
-    ID3D10Device1 *device;
+    ID3D11Device *device;
 };
 
 static inline struct d3d10_texture2d *impl_from_ID3D10Texture2D(ID3D10Texture2D *iface)
diff --git a/dlls/d3d11/texture.c b/dlls/d3d11/texture.c
index 940567a..2fe0c50 100644
--- a/dlls/d3d11/texture.c
+++ b/dlls/d3d11/texture.c
@@ -76,7 +76,7 @@ static ULONG STDMETHODCALLTYPE d3d11_texture2d_AddRef(ID3D11Texture2D *iface)
 
     if (refcount == 1)
     {
-        ID3D10Device1_AddRef(texture->device);
+        ID3D11Device_AddRef(texture->device);
         wined3d_mutex_lock();
         wined3d_texture_incref(texture->wined3d_texture);
         wined3d_mutex_unlock();
@@ -94,14 +94,14 @@ static ULONG STDMETHODCALLTYPE d3d11_texture2d_Release(ID3D11Texture2D *iface)
 
     if (!refcount)
     {
-        ID3D10Device1 *device = texture->device;
+        ID3D11Device *device = texture->device;
 
         wined3d_mutex_lock();
         wined3d_texture_decref(texture->wined3d_texture);
         wined3d_mutex_unlock();
         /* Release the device last, it may cause the wined3d device to be
          * destroyed. */
-        ID3D10Device1_Release(device);
+        ID3D11Device_Release(device);
     }
 
     return refcount;
@@ -109,7 +109,12 @@ static ULONG STDMETHODCALLTYPE d3d11_texture2d_Release(ID3D11Texture2D *iface)
 
 static void STDMETHODCALLTYPE d3d11_texture2d_GetDevice(ID3D11Texture2D *iface, ID3D11Device **device)
 {
-    FIXME("iface %p, device %p stub!\n", iface, device);
+    struct d3d10_texture2d *texture = impl_from_ID3D11Texture2D(iface);
+
+    TRACE("iface %p, device %p.\n", iface, device);
+
+    *device = texture->device;
+    ID3D11Device_AddRef(*device);
 }
 
 static HRESULT STDMETHODCALLTYPE d3d11_texture2d_GetPrivateData(ID3D11Texture2D *iface,
@@ -262,8 +267,7 @@ static void STDMETHODCALLTYPE d3d10_texture2d_GetDevice(ID3D10Texture2D *iface,
 
     TRACE("iface %p, device %p.\n", iface, device);
 
-    *device = (ID3D10Device *)texture->device;
-    ID3D10Device_AddRef(*device);
+    ID3D11Device_QueryInterface(texture->device, &IID_ID3D10Device, (void **)device);
 }
 
 static HRESULT STDMETHODCALLTYPE d3d10_texture2d_GetPrivateData(ID3D10Texture2D *iface,
@@ -494,8 +498,8 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d_device
     }
     wined3d_mutex_unlock();
 
-    texture->device = &device->ID3D10Device1_iface;
-    ID3D10Device1_AddRef(texture->device);
+    texture->device = &device->ID3D11Device_iface;
+    ID3D11Device_AddRef(texture->device);
 
     return S_OK;
 }




More information about the wine-cvs mailing list