[PATCH resend 5/5] d3d9/tests: Add a test for Reset() with bound DEFAULT resources.

Matteo Bruni mbruni at codeweavers.com
Mon Feb 25 12:00:45 CST 2019


Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
I'm resending this patch unchanged since I can't reproduce the test
failure and I don't feel comfortable with blindly changing the code.

 dlls/d3d9/tests/device.c | 37 +++++++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 7d8b4fdfcd4..bf64ddf1633 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -1836,6 +1836,7 @@ static void test_reset(void)
     IDirect3DIndexBuffer9 *ib;
     DEVMODEW devmode;
     IDirect3D9 *d3d;
+    ULONG refcount;
     D3DCAPS9 caps;
     DWORD value;
     HWND hwnd;
@@ -2187,6 +2188,38 @@ static void test_reset(void)
         skip("Volume textures not supported.\n");
     }
 
+    /* Test with DEFAULT pool resources bound but otherwise not referenced. */
+    hr = IDirect3DDevice9_CreateVertexBuffer(device1, 16, 0,
+            D3DFVF_XYZ, D3DPOOL_DEFAULT, &vb, NULL);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    hr = IDirect3DDevice9_SetStreamSource(device1, 0, vb, 0, 16);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    refcount = IDirect3DVertexBuffer9_Release(vb);
+    ok(!refcount, "Unexpected refcount %u.\n", refcount);
+    hr = IDirect3DDevice9_CreateIndexBuffer(device1, 16, 0,
+            D3DFMT_INDEX16, D3DPOOL_DEFAULT, &ib, NULL);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    hr = IDirect3DDevice9_SetIndices(device1, ib);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    refcount = IDirect3DIndexBuffer9_Release(ib);
+    ok(!refcount, "Unexpected refcount %u.\n", refcount);
+    hr = IDirect3DDevice9_CreateTexture(device1, 16, 16, 0, 0,
+            D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &texture, NULL);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    hr = IDirect3DDevice9_SetTexture(device1, i, (IDirect3DBaseTexture9 *)texture);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+
+    hr = IDirect3DDevice9_Reset(device1, &d3dpp);
+    ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+
+    hr = IDirect3DDevice9_GetIndices(device1, &ib);
+    todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+    refcount = IDirect3DTexture9_Release(texture);
+    ok(!refcount, "Unexpected refcount %u.\n", refcount);
+
+    hr = IDirect3DDevice9_Reset(device1, &d3dpp);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+
     /* Scratch, sysmem and managed pools are fine */
     hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device1, 16, 16, D3DFMT_R5G6B5, D3DPOOL_SCRATCH, &surface, NULL);
     ok(hr == D3D_OK, "IDirect3DDevice9_CreateOffscreenPlainSurface returned %08x\n", hr);
@@ -2368,12 +2401,12 @@ cleanup:
     HeapFree(GetProcessHeap(), 0, modes);
     if (device2)
     {
-        UINT refcount = IDirect3DDevice9_Release(device2);
+        refcount = IDirect3DDevice9_Release(device2);
         ok(!refcount, "Device has %u references left.\n", refcount);
     }
     if (device1)
     {
-        UINT refcount = IDirect3DDevice9_Release(device1);
+        refcount = IDirect3DDevice9_Release(device1);
         ok(!refcount, "Device has %u references left.\n", refcount);
     }
     IDirect3D9_Release(d3d);
-- 
2.19.2




More information about the wine-devel mailing list