Commit 25d2de7b authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d8/tests: Use a separate device for depth_clamp_test().

parent f1706b03
......@@ -2606,44 +2606,53 @@ done:
* clipped when D3DPMISCCAPS_CLIPTLVERTS is set, clamped when it isn't.
* - The viewport's MinZ/MaxZ is irrelevant for this.
*/
static void depth_clamp_test(IDirect3DDevice8 *device)
static void depth_clamp_test(void)
{
const struct tvertex quad1[] =
IDirect3DDevice8 *device;
D3DVIEWPORT8 vp;
IDirect3D8 *d3d;
D3DCOLOR color;
ULONG refcount;
D3DCAPS8 caps;
HWND window;
HRESULT hr;
static const struct tvertex quad1[] =
{
{ 0.0f, 0.0f, 5.0f, 1.0f, 0xff002b7f},
{640.0f, 0.0f, 5.0f, 1.0f, 0xff002b7f},
{ 0.0f, 480.0f, 5.0f, 1.0f, 0xff002b7f},
{640.0f, 480.0f, 5.0f, 1.0f, 0xff002b7f},
};
const struct tvertex quad2[] =
static const struct tvertex quad2[] =
{
{ 0.0f, 300.0f, 10.0f, 1.0f, 0xfff9e814},
{640.0f, 300.0f, 10.0f, 1.0f, 0xfff9e814},
{ 0.0f, 360.0f, 10.0f, 1.0f, 0xfff9e814},
{640.0f, 360.0f, 10.0f, 1.0f, 0xfff9e814},
};
const struct tvertex quad3[] =
static const struct tvertex quad3[] =
{
{112.0f, 108.0f, 5.0f, 1.0f, 0xffffffff},
{208.0f, 108.0f, 5.0f, 1.0f, 0xffffffff},
{112.0f, 204.0f, 5.0f, 1.0f, 0xffffffff},
{208.0f, 204.0f, 5.0f, 1.0f, 0xffffffff},
};
const struct tvertex quad4[] =
static const struct tvertex quad4[] =
{
{ 42.0f, 41.0f, 10.0f, 1.0f, 0xffffffff},
{112.0f, 41.0f, 10.0f, 1.0f, 0xffffffff},
{ 42.0f, 108.0f, 10.0f, 1.0f, 0xffffffff},
{112.0f, 108.0f, 10.0f, 1.0f, 0xffffffff},
};
const struct vertex quad5[] =
static const struct vertex quad5[] =
{
{ -0.5f, 0.5f, 10.0f, 0xff14f914},
{ 0.5f, 0.5f, 10.0f, 0xff14f914},
{ -0.5f, -0.5f, 10.0f, 0xff14f914},
{ 0.5f, -0.5f, 10.0f, 0xff14f914},
};
const struct vertex quad6[] =
static const struct vertex quad6[] =
{
{ -1.0f, 0.5f, 10.0f, 0xfff91414},
{ 1.0f, 0.5f, 10.0f, 0xfff91414},
......@@ -2651,10 +2660,18 @@ static void depth_clamp_test(IDirect3DDevice8 *device)
{ 1.0f, 0.25f, 10.0f, 0xfff91414},
};
D3DVIEWPORT8 vp;
D3DCOLOR color;
D3DCAPS8 caps;
HRESULT hr;
window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate8(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 = IDirect3DDevice8_GetDeviceCaps(device, &caps);
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
vp.X = 0;
vp.Y = 0;
......@@ -2663,9 +2680,6 @@ static void depth_clamp_test(IDirect3DDevice8 *device)
vp.MinZ = 0.0;
vp.MaxZ = 7.5;
hr = IDirect3DDevice8_GetDeviceCaps(device, &caps);
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
hr = IDirect3DDevice8_SetViewport(device, &vp);
ok(SUCCEEDED(hr), "SetViewport failed, hr %#x.\n", hr);
......@@ -2747,10 +2761,11 @@ static void depth_clamp_test(IDirect3DDevice8 *device)
hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
ok(SUCCEEDED(hr), "Present failed (0x%08x)\n", hr);
vp.MinZ = 0.0;
vp.MaxZ = 1.0;
hr = IDirect3DDevice8_SetViewport(device, &vp);
ok(SUCCEEDED(hr), "SetViewport failed, hr %#x.\n", hr);
refcount = IDirect3DDevice8_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
done:
IDirect3D8_Release(d3d);
DestroyWindow(window);
}
static void depth_buffer_test(void)
......@@ -5014,7 +5029,6 @@ START_TEST(visual)
}
test_sanity(device_ptr);
depth_clamp_test(device_ptr);
refcount = IDirect3DDevice8_Release(device_ptr);
ok(!refcount, "Device has %u references left.\n", refcount);
......@@ -5022,6 +5036,7 @@ cleanup:
IDirect3D8_Release(d3d);
DestroyWindow(window);
depth_clamp_test();
lighting_test();
clear_test();
fog_test();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment