=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: d3d11/tests: Add tests showing that views do not keep resource reference.

Alexandre Julliard julliard at winehq.org
Thu Apr 20 12:35:10 CDT 2017


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Thu Feb  2 12:43:35 2017 +0100

d3d11/tests: Add tests showing that views do not keep resource reference.

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>
(cherry picked from commit 0ce7d71c4657d7537b9e571d89eb1122d953448d)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/d3d11/tests/d3d11.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 52619ab..a524f58 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -2727,8 +2727,11 @@ static void test_create_depthstencil_view(void)
             get_dsv_desc(current_desc, &tests[i].dsv_desc);
         }
 
+        expected_refcount = get_refcount((IUnknown *)texture);
         hr = ID3D11Device_CreateDepthStencilView(device, (ID3D11Resource *)texture, current_desc, &dsview);
         ok(SUCCEEDED(hr), "Test %u: Failed to create depth stencil view, hr %#x.\n", i, hr);
+        refcount = get_refcount((IUnknown *)texture);
+        todo_wine ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount);
 
         hr = ID3D11DepthStencilView_QueryInterface(dsview, &IID_ID3D10DepthStencilView, (void **)&iface);
         ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
@@ -3088,8 +3091,11 @@ static void test_create_rendertarget_view(void)
             get_rtv_desc(current_desc, &tests[i].rtv_desc);
         }
 
+        expected_refcount = get_refcount((IUnknown *)texture);
         hr = ID3D11Device_CreateRenderTargetView(device, texture, current_desc, &rtview);
         ok(SUCCEEDED(hr), "Test %u: Failed to create render target view, hr %#x.\n", i, hr);
+        refcount = get_refcount((IUnknown *)texture);
+        todo_wine ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount);
 
         hr = ID3D11RenderTargetView_QueryInterface(rtview, &IID_ID3D10RenderTargetView, (void **)&iface);
         ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
@@ -3444,8 +3450,11 @@ static void test_create_shader_resource_view(void)
             get_srv_desc(current_desc, &tests[i].srv_desc);
         }
 
+        expected_refcount = get_refcount((IUnknown *)texture);
         hr = ID3D11Device_CreateShaderResourceView(device, texture, current_desc, &srview);
         ok(SUCCEEDED(hr), "Test %u: Failed to create a shader resource view, hr %#x.\n", i, hr);
+        refcount = get_refcount((IUnknown *)texture);
+        todo_wine ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount);
 
         hr = ID3D11ShaderResourceView_QueryInterface(srview, &IID_ID3D10ShaderResourceView, (void **)&iface);
         ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
@@ -8111,6 +8120,7 @@ static void test_swapchain_views(void)
     ID3D11DeviceContext *context;
     ID3D11RenderTargetView *rtv;
     ID3D11Device *device;
+    ULONG refcount;
     HRESULT hr;
 
     static const struct vec4 color = {0.2f, 0.3f, 0.5f, 1.0f};
@@ -8121,6 +8131,9 @@ static void test_swapchain_views(void)
     device = test_context.device;
     context = test_context.immediate_context;
 
+    refcount = get_refcount((IUnknown *)test_context.backbuffer);
+    todo_wine ok(refcount == 1, "Got unexpected refcount %u.\n", refcount);
+
     draw_color_quad(&test_context, &color);
     check_texture_color(test_context.backbuffer, 0xff7f4c33, 1);
 
@@ -8131,6 +8144,9 @@ static void test_swapchain_views(void)
     ok(SUCCEEDED(hr), "Failed to create render target view, hr %#x.\n", hr);
     ID3D11DeviceContext_OMSetRenderTargets(context, 1, &rtv, NULL);
 
+    refcount = get_refcount((IUnknown *)test_context.backbuffer);
+    todo_wine ok(refcount == 1, "Got unexpected refcount %u.\n", refcount);
+
     draw_color_quad(&test_context, &color);
     todo_wine check_texture_color(test_context.backbuffer, 0xffbc957c, 1);
 
@@ -10345,8 +10361,11 @@ static void test_create_unordered_access_view(void)
             get_uav_desc(current_desc, &tests[i].uav_desc);
         }
 
+        expected_refcount = get_refcount((IUnknown *)texture);
         hr = ID3D11Device_CreateUnorderedAccessView(device, texture, current_desc, &uav);
         ok(SUCCEEDED(hr), "Test %u: Failed to create unordered access view, hr %#x.\n", i, hr);
+        refcount = get_refcount((IUnknown *)texture);
+        todo_wine ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount);
 
         memset(&uav_desc, 0, sizeof(uav_desc));
         ID3D11UnorderedAccessView_GetDesc(uav, &uav_desc);




More information about the wine-cvs mailing list