=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: d3d11: Implement d3d{10, 11}_input_layout_GetDevice().

Alexandre Julliard julliard at winehq.org
Mon Apr 24 16:11:23 CDT 2017


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Mon Apr 24 12:02:28 2017 +0200

d3d11: Implement d3d{10, 11}_input_layout_GetDevice().

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d10core/tests/device.c |  2 +-
 dlls/d3d11/d3d11_private.h    |  1 +
 dlls/d3d11/inputlayout.c      | 18 ++++++++++++++++--
 dlls/d3d11/tests/d3d11.c      |  2 +-
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c
index f6621e8..e4ab7a4 100644
--- a/dlls/d3d10core/tests/device.c
+++ b/dlls/d3d10core/tests/device.c
@@ -9325,7 +9325,7 @@ static void test_create_input_layout(void)
         ok(SUCCEEDED(hr), "Failed to create input layout for format %#x, hr %#x.\n",
                 vertex_formats[i], hr);
         refcount = get_refcount(device);
-        todo_wine ok(refcount >= expected_refcount, "Got refcount %u, expected >= %u.\n",
+        ok(refcount >= expected_refcount, "Got refcount %u, expected >= %u.\n",
                 refcount, expected_refcount);
         ID3D10InputLayout_Release(input_layout);
     }
diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h
index 193a07f..3a9729b 100644
--- a/dlls/d3d11/d3d11_private.h
+++ b/dlls/d3d11/d3d11_private.h
@@ -254,6 +254,7 @@ struct d3d_input_layout
 
     struct wined3d_private_store private_store;
     struct wined3d_vertex_declaration *wined3d_decl;
+    ID3D11Device *device;
 };
 
 HRESULT d3d_input_layout_create(struct d3d_device *device,
diff --git a/dlls/d3d11/inputlayout.c b/dlls/d3d11/inputlayout.c
index e9c3094..37b6993 100644
--- a/dlls/d3d11/inputlayout.c
+++ b/dlls/d3d11/inputlayout.c
@@ -151,9 +151,13 @@ static ULONG STDMETHODCALLTYPE d3d11_input_layout_Release(ID3D11InputLayout *ifa
 
     if (!refcount)
     {
+        ID3D11Device *device = layout->device;
+
         wined3d_mutex_lock();
         wined3d_vertex_declaration_decref(layout->wined3d_decl);
         wined3d_mutex_unlock();
+
+        ID3D11Device_Release(device);
     }
 
     return refcount;
@@ -162,7 +166,11 @@ static ULONG STDMETHODCALLTYPE d3d11_input_layout_Release(ID3D11InputLayout *ifa
 static void STDMETHODCALLTYPE d3d11_input_layout_GetDevice(ID3D11InputLayout *iface,
         ID3D11Device **device)
 {
-    FIXME("iface %p, device %p stub!\n", iface, device);
+    struct d3d_input_layout *layout = impl_from_ID3D11InputLayout(iface);
+
+    TRACE("iface %p, device %p.\n", iface, device);
+
+    ID3D11Device_AddRef(*device = layout->device);
 }
 
 static HRESULT STDMETHODCALLTYPE d3d11_input_layout_GetPrivateData(ID3D11InputLayout *iface,
@@ -249,7 +257,11 @@ static ULONG STDMETHODCALLTYPE d3d10_input_layout_Release(ID3D10InputLayout *ifa
 
 static void STDMETHODCALLTYPE d3d10_input_layout_GetDevice(ID3D10InputLayout *iface, ID3D10Device **device)
 {
-    FIXME("iface %p, device %p stub!\n", iface, device);
+    struct d3d_input_layout *layout = impl_from_ID3D10InputLayout(iface);
+
+    TRACE("iface %p, device %p.\n", iface, device);
+
+    ID3D11Device_QueryInterface(layout->device, &IID_ID3D10Device, (void **)device);
 }
 
 static HRESULT STDMETHODCALLTYPE d3d10_input_layout_GetPrivateData(ID3D10InputLayout *iface,
@@ -344,6 +356,8 @@ static HRESULT d3d_input_layout_init(struct d3d_input_layout *layout, struct d3d
     }
     wined3d_mutex_unlock();
 
+    ID3D11Device_AddRef(layout->device = &device->ID3D11Device_iface);
+
     return S_OK;
 }
 
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index d4a34c6..dfe50c6 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -10321,7 +10321,7 @@ static void test_create_input_layout(void)
         ok(SUCCEEDED(hr), "Failed to create input layout for format %#x, hr %#x.\n",
                 vertex_formats[i], hr);
         refcount = get_refcount(device);
-        todo_wine ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n",
+        ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n",
                 refcount, expected_refcount);
         ID3D11InputLayout_Release(input_layout);
     }




More information about the wine-cvs mailing list