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

This commit is contained in:
Henri Verbeet 2014-03-20 09:19:27 +01:00 committed by Alexandre Julliard
parent f1d4d8c49d
commit 07c42c9eda
1 changed files with 43 additions and 20 deletions

View File

@ -6225,8 +6225,18 @@ static void cnd_test(IDirect3DDevice9 *device)
IDirect3DPixelShader9_Release(shader_11);
}
static void nested_loop_test(IDirect3DDevice9 *device)
static void nested_loop_test(void)
{
IDirect3DVertexShader9 *vshader;
IDirect3DPixelShader9 *shader;
IDirect3DDevice9 *device;
IDirect3D9 *d3d;
ULONG refcount;
D3DCAPS9 caps;
DWORD color;
HWND window;
HRESULT hr;
static const DWORD shader_code[] =
{
0xffff0300, /* ps_3_0 */
@ -6250,17 +6260,33 @@ static void nested_loop_test(IDirect3DDevice9 *device)
0x02000001, 0xe00f0000, 0x90e40000, /* mov o0, v0 */
0x0000ffff /* end */
};
IDirect3DPixelShader9 *shader;
IDirect3DVertexShader9 *vshader;
HRESULT hr;
DWORD color;
const float quad[] = {
-1.0, -1.0, 0.1,
1.0, -1.0, 0.1,
-1.0, 1.0, 0.1,
1.0, 1.0, 0.1
static const float quad[] =
{
-1.0f, -1.0f, 0.1f,
-1.0f, 1.0f, 0.1f,
1.0f, -1.0f, 0.1f,
1.0f, 1.0f, 0.1f,
};
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 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.PixelShaderVersion < D3DPS_VERSION(3, 0) || caps.VertexShaderVersion < D3DVS_VERSION(3, 0))
{
skip("No shader model 3 support, skipping tests.\n");
IDirect3DDevice9_Release(device);
goto done;
}
hr = IDirect3DDevice9_CreatePixelShader(device, shader_code, &shader);
ok(hr == D3D_OK, "IDirect3DDevice9_CreatePixelShader failed with %08x\n", hr);
hr = IDirect3DDevice9_SetPixelShader(device, shader);
@ -6271,7 +6297,7 @@ static void nested_loop_test(IDirect3DDevice9 *device)
ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader failed with %08x\n", hr);
hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ);
ok(hr == D3D_OK, "IDirect3DDevice9_SetFVF failed with %08x\n", hr);
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x0000ff00, 0.0, 0);
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x0000ff00, 1.0f, 0);
ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr);
hr = IDirect3DDevice9_BeginScene(device);
@ -6291,12 +6317,13 @@ static void nested_loop_test(IDirect3DDevice9 *device)
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr);
hr = IDirect3DDevice9_SetPixelShader(device, NULL);
ok(hr == D3D_OK, "IDirect3DDevice9_SetPixelShader failed with %08x\n", hr);
hr = IDirect3DDevice9_SetVertexShader(device, NULL);
ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader failed with %08x\n", hr);
IDirect3DPixelShader9_Release(shader);
IDirect3DVertexShader9_Release(vshader);
refcount = IDirect3DDevice9_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
done:
IDirect3D9_Release(d3d);
DestroyWindow(window);
}
static void pretransformed_varying_test(void)
@ -15870,11 +15897,6 @@ START_TEST(visual)
if (caps.PixelShaderVersion >= D3DPS_VERSION(2, 0)) {
dp2add_ps_test(device_ptr);
unbound_sampler_test(device_ptr);
if (caps.PixelShaderVersion >= D3DPS_VERSION(3, 0) && caps.VertexShaderVersion >= D3DVS_VERSION(3, 0)) {
nested_loop_test(device_ptr);
} else {
skip("No ps_3_0 or vs_3_0 support\n");
}
} else {
skip("No ps_2_0 support\n");
}
@ -15885,6 +15907,7 @@ START_TEST(visual)
cleanup_device(device_ptr);
device_ptr = NULL;
nested_loop_test();
pretransformed_varying_test();
vface_register_test();
vpos_register_test();