From e2ffbf2e483889d4429bd2405c79875245a0a8b7 Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Wed, 20 Feb 2019 18:41:10 +0100 Subject: [PATCH] d3d8/tests: Add a test for Reset() with bound DEFAULT resources. Signed-off-by: Matteo Bruni Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- 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);