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

Matteo Bruni mbruni at codeweavers.com
Wed Feb 20 11:41:10 CST 2019


Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
 dlls/d3d8/tests/device.c | 41 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 39a2359be41..4dbe1687d89 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -1327,6 +1327,7 @@ static void test_reset(void)
     IDirect3D8 *d3d8;
     RECT winrect, client_rect;
     D3DVIEWPORT8 vp;
+    ULONG refcount;
     D3DCAPS8 caps;
     DWORD shader;
     DWORD value;
@@ -1695,6 +1696,46 @@ static void test_reset(void)
         skip("Volume textures not supported.\n");
     }
 
+    /* Test with DEFAULT pool resources bound but otherwise not referenced. */
+    hr = IDirect3DDevice8_CreateVertexBuffer(device1, 16, 0,
+            D3DFVF_XYZ, D3DPOOL_DEFAULT, &vb);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    hr = IDirect3DDevice8_SetStreamSource(device1, 0, vb, 16);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    refcount = IDirect3DVertexBuffer8_Release(vb);
+    ok(!refcount, "Unexpected refcount %u.\n", refcount);
+    hr = IDirect3DDevice8_CreateIndexBuffer(device1, 16, 0,
+            D3DFMT_INDEX16, D3DPOOL_DEFAULT, &ib);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    hr = IDirect3DDevice8_SetIndices(device1, ib, 0);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    refcount = IDirect3DIndexBuffer8_Release(ib);
+    ok(!refcount, "Unexpected refcount %u.\n", refcount);
+    hr = IDirect3DDevice8_CreateTexture(device1, 16, 16, 0, 0,
+            D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &texture);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    hr = IDirect3DDevice8_SetTexture(device1, i, (IDirect3DBaseTexture8 *)texture);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+
+    hr = IDirect3DDevice8_Reset(device1, &d3dpp);
+    ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr);
+    hr = IDirect3DDevice8_TestCooperativeLevel(device1);
+    ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr);
+
+    /* Crashes on Windows. */
+    if (0)
+    {
+        hr = IDirect3DDevice8_GetIndices(device1, &ib, &i);
+        todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+    }
+    refcount = IDirect3DTexture8_Release(texture);
+    ok(!refcount, "Unexpected refcount %u.\n", refcount);
+
+    hr = IDirect3DDevice8_Reset(device1, &d3dpp);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    hr = IDirect3DDevice8_TestCooperativeLevel(device1);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+
     /* Scratch, sysmem and managed pool resources are fine. */
     hr = IDirect3DDevice8_CreateTexture(device1, 16, 16, 1, 0, D3DFMT_R5G6B5, D3DPOOL_SCRATCH, &texture);
     ok(SUCCEEDED(hr), "CreateTexture failed, hr %#x.\n", hr);
-- 
2.19.2




More information about the wine-devel mailing list