d3d9/tests: Use a separate device for maxmip_test().

This commit is contained in:
Henri Verbeet 2014-04-10 10:05:42 +02:00 committed by Alexandre Julliard
parent 4cb68d2322
commit f329a2b586
1 changed files with 38 additions and 24 deletions

View File

@ -3472,12 +3472,18 @@ out:
}
}
static void maxmip_test(IDirect3DDevice9 *device)
static void maxmip_test(void)
{
IDirect3DTexture9 *texture = NULL;
IDirect3DSurface9 *surface = NULL;
IDirect3DTexture9 *texture;
IDirect3DSurface9 *surface;
IDirect3DDevice9 *device;
IDirect3D9 *d3d;
D3DCOLOR color;
ULONG refcount;
D3DCAPS9 caps;
HWND window;
HRESULT hr;
DWORD color;
static const struct
{
struct
@ -3515,15 +3521,29 @@ static void maxmip_test(IDirect3DDevice9 *device)
}},
};
hr = IDirect3DDevice9_CreateTexture(device, 128, 128, 3, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
&texture, NULL);
ok(hr == D3D_OK, "IDirect3DDevice9_CreateTexture failed with %08x\n", hr);
if(!texture)
window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
{
skip("Failed to create test texture\n");
return;
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
}
hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
if (!(caps.TextureCaps & D3DPTEXTURECAPS_MIPMAP))
{
skip("No mipmap support, skipping tests.\n");
IDirect3DDevice9_Release(device);
goto done;
}
hr = IDirect3DDevice9_CreateTexture(device, 128, 128, 3, 0,
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &texture, NULL);
ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
hr = IDirect3DTexture9_GetSurfaceLevel(texture, 0, &surface);
ok(SUCCEEDED(hr), "IDirect3DTexture9_GetSurfaceLevel returned %#x.\n", hr);
fill_surface(surface, 0xffff0000, 0);
@ -3542,6 +3562,8 @@ static void maxmip_test(IDirect3DDevice9 *device)
hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_TEX1);
ok(hr == D3D_OK, "IDirect3DDevice9_SetFVF failed with %08x\n", hr);
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE);
ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr);
hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
@ -3696,13 +3718,12 @@ static void maxmip_test(IDirect3DDevice9 *device)
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
ok(SUCCEEDED(hr), "Present failed (0x%08x)\n", hr);
hr = IDirect3DDevice9_SetTexture(device, 0, NULL);
ok(hr == D3D_OK, "IDirect3DDevice9_SetTexture failed with %08x\n", hr);
hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAXMIPLEVEL, 0);
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
IDirect3DTexture9_Release(texture);
refcount = IDirect3DDevice9_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
done:
IDirect3D9_Release(d3d);
DestroyWindow(window);
}
static void release_buffer_test(void)
@ -16660,18 +16681,11 @@ START_TEST(visual)
skip("No cube texture support\n");
}
z_range_test(device_ptr);
if(caps.TextureCaps & D3DPTEXTURECAPS_MIPMAP)
{
maxmip_test(device_ptr);
}
else
{
skip("No mipmap support\n");
}
cleanup_device(device_ptr);
device_ptr = NULL;
maxmip_test();
offscreen_test();
ds_size_test();
alpha_test();