ddraw/tests: Test adding a number of lights to viewport in ddraw4.

Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2019-06-11 13:06:21 +03:00 committed by Alexandre Julliard
parent 1eb6d8c58d
commit d729c0362c
1 changed files with 21 additions and 1 deletions

View File

@ -4556,6 +4556,7 @@ static void test_specular_lighting(void)
{&point_far, TRUE, 0.0f, expected_zero, ARRAY_SIZE(expected_zero)}, {&point_far, TRUE, 0.0f, expected_zero, ARRAY_SIZE(expected_zero)},
}; };
IDirect3DLight *light, *dummy_lights[64];
IDirect3DVertexBuffer *src_vb, *dst_vb; IDirect3DVertexBuffer *src_vb, *dst_vb;
struct vertex *quad, *src_data; struct vertex *quad, *src_data;
D3DVERTEXBUFFERDESC vb_desc; D3DVERTEXBUFFERDESC vb_desc;
@ -4564,7 +4565,7 @@ static void test_specular_lighting(void)
IDirect3DMaterial3 *material; IDirect3DMaterial3 *material;
IDirect3DDevice3 *device; IDirect3DDevice3 *device;
IDirectDrawSurface4 *rt; IDirectDrawSurface4 *rt;
IDirect3DLight *light; D3DLIGHT2 light_desc;
IDirect3D3 *d3d; IDirect3D3 *d3d;
D3DCOLOR color; D3DCOLOR color;
ULONG refcount; ULONG refcount;
@ -4635,6 +4636,22 @@ static void test_specular_lighting(void)
hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_FOGENABLE, FALSE); hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_FOGENABLE, FALSE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
memset(&light_desc, 0, sizeof(light_desc));
light_desc.dwSize = sizeof(light_desc);
light_desc.dltType = D3DLIGHT_DIRECTIONAL;
light_desc.dwFlags = D3DLIGHT_ACTIVE;
U3(light_desc.dvDirection).z = 1.0f;
for (i = 0; i < ARRAY_SIZE(dummy_lights); ++i)
{
hr = IDirect3D3_CreateLight(d3d, &dummy_lights[i], NULL);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DViewport3_AddLight(viewport, dummy_lights[i]);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DLight_SetLight(dummy_lights[i], (D3DLIGHT *)&light_desc);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
}
hr = IDirect3D3_CreateLight(d3d, &light, NULL); hr = IDirect3D3_CreateLight(d3d, &light, NULL);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DViewport3_AddLight(viewport, light); hr = IDirect3DViewport3_AddLight(viewport, light);
@ -4721,6 +4738,9 @@ static void test_specular_lighting(void)
destroy_material(material); destroy_material(material);
} }
for (i = 0; i < ARRAY_SIZE(dummy_lights); ++i)
IDirect3DLight_Release(dummy_lights[i]);
IDirect3DVertexBuffer_Release(dst_vb); IDirect3DVertexBuffer_Release(dst_vb);
IDirect3DVertexBuffer_Release(src_vb); IDirect3DVertexBuffer_Release(src_vb);