d3d8/tests: Add a test for Reset() with bound DEFAULT resources.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Matteo Bruni 2019-02-20 18:41:10 +01:00 committed by Alexandre Julliard
parent 812d03129d
commit e2ffbf2e48
1 changed files with 41 additions and 0 deletions

View File

@ -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);