From 19f57326948eede76cfebd72ad1ab0d6c66c1cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Mon, 24 Apr 2017 12:02:28 +0200 Subject: [PATCH] d3d11: Implement d3d{10, 11}_input_layout_GetDevice(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- 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 f6621e8de76..e4ab7a4dfba 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 193a07fe230..3a9729b9ff0 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 e9c30941a08..37b699375eb 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 d4a34c663d2..dfe50c62878 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); }