Henri Verbeet : d3d9/tests: Use a separate device for intz_test().
Alexandre Julliard
julliard at winehq.org
Tue Mar 18 14:15:06 CDT 2014
Module: wine
Branch: master
Commit: 424e069edc3b3a1ca902c25f8dac6f5b4ceb10e6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=424e069edc3b3a1ca902c25f8dac6f5b4ceb10e6
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Tue Mar 18 09:37:51 2014 +0100
d3d9/tests: Use a separate device for intz_test().
---
dlls/d3d9/tests/visual.c | 61 ++++++++++++++++++++++++----------------------
1 file changed, 32 insertions(+), 29 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 13d363b..f970c34 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -12099,7 +12099,7 @@ static void depth_blit_test(IDirect3DDevice9 *device)
IDirect3DSurface9_Release(ds1);
}
-static void intz_test(IDirect3DDevice9 *device)
+static void intz_test(void)
{
static const DWORD ps_code[] =
{
@@ -12158,45 +12158,51 @@ static void intz_test(IDirect3DDevice9 *device)
{560, 450, D3DCOLOR_ARGB(0x00, 0xdf, 0xbf, 0x00)},
};
- IDirect3DSurface9 *original_ds, *original_rt, *rt;
+ IDirect3DSurface9 *original_rt, *rt;
IDirect3DTexture9 *texture;
IDirect3DPixelShader9 *ps;
+ IDirect3DDevice9 *device;
IDirect3DSurface9 *ds;
- IDirect3D9 *d3d9;
+ IDirect3D9 *d3d;
+ ULONG refcount;
D3DCAPS9 caps;
+ HWND window;
HRESULT hr;
UINT i;
+ 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 (FAILED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ D3DFMT_X8R8G8B8, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, MAKEFOURCC('I','N','T','Z'))))
+ {
+ skip("No INTZ support, skipping INTZ test.\n");
+ goto done;
+ }
+ if (!(device = create_device(d3d, window, window, TRUE)))
+ {
+ skip("Failed to create a D3D device, skipping tests.\n");
+ goto done;
+ }
+
hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
ok(SUCCEEDED(hr), "GetDeviceCaps failed, hr %#x.\n", hr);
if (caps.PixelShaderVersion < D3DPS_VERSION(2, 0))
{
skip("No pixel shader 2.0 support, skipping INTZ test.\n");
- return;
+ IDirect3DDevice9_Release(device);
+ goto done;
}
if (caps.TextureCaps & D3DPTEXTURECAPS_POW2)
{
skip("No unconditional NP2 texture support, skipping INTZ test.\n");
- return;
- }
-
- hr = IDirect3DDevice9_GetDirect3D(device, &d3d9);
- ok(SUCCEEDED(hr), "GetDirect3D failed, hr %#x.\n", hr);
-
- hr = IDirect3D9_CheckDeviceFormat(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8,
- D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, MAKEFOURCC('I','N','T','Z'));
- if (FAILED(hr))
- {
- skip("No INTZ support, skipping INTZ test.\n");
- return;
+ IDirect3DDevice9_Release(device);
+ goto done;
}
- IDirect3D9_Release(d3d9);
-
hr = IDirect3DDevice9_GetRenderTarget(device, 0, &original_rt);
ok(SUCCEEDED(hr), "GetRenderTarget failed, hr %#x.\n", hr);
- hr = IDirect3DDevice9_GetDepthStencilSurface(device, &original_ds);
- ok(SUCCEEDED(hr), "GetDepthStencilSurface failed, hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateTexture(device, 640, 480, 1,
D3DUSAGE_DEPTHSTENCIL, MAKEFOURCC('I','N','T','Z'), D3DPOOL_DEFAULT, &texture, NULL);
@@ -12396,18 +12402,15 @@ static void intz_test(IDirect3DDevice9 *device)
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
ok(SUCCEEDED(hr), "Present failed, hr %#x.\n", hr);
- hr = IDirect3DDevice9_SetDepthStencilSurface(device, original_ds);
- ok(SUCCEEDED(hr), "SetDepthStencilSurface failed, hr %#x.\n", hr);
- IDirect3DSurface9_Release(original_ds);
- hr = IDirect3DDevice9_SetTexture(device, 0, NULL);
- ok(SUCCEEDED(hr), "SetTexture failed, hr %#x.\n", hr);
IDirect3DTexture9_Release(texture);
- hr = IDirect3DDevice9_SetPixelShader(device, NULL);
- ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#x.\n", hr);
IDirect3DPixelShader9_Release(ps);
-
IDirect3DSurface9_Release(original_rt);
IDirect3DSurface9_Release(rt);
+ refcount = IDirect3DDevice9_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+done:
+ IDirect3D9_Release(d3d);
+ DestroyWindow(window);
}
static void shadow_test(void)
@@ -15631,11 +15634,11 @@ START_TEST(visual)
depth_buffer_test(device_ptr);
depth_buffer2_test(device_ptr);
depth_blit_test(device_ptr);
- intz_test(device_ptr);
cleanup_device(device_ptr);
device_ptr = NULL;
+ intz_test();
shadow_test();
fp_special_test();
depth_bounds_test();
More information about the wine-cvs
mailing list