ddraw/tests: Rewrite LimitTest().
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d146940be9
commit
4767991851
|
@ -482,35 +482,6 @@ static void SceneTest(void)
|
||||||
/* TODO: Verify that blitting works in the same way as in d3d9 */
|
/* TODO: Verify that blitting works in the same way as in d3d9 */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LimitTest(void)
|
|
||||||
{
|
|
||||||
IDirectDrawSurface7 *pTexture = NULL;
|
|
||||||
HRESULT hr;
|
|
||||||
int i;
|
|
||||||
DDSURFACEDESC2 ddsd;
|
|
||||||
|
|
||||||
memset(&ddsd, 0, sizeof(ddsd));
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
|
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
|
|
||||||
ddsd.dwWidth = 16;
|
|
||||||
ddsd.dwHeight = 16;
|
|
||||||
hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &pTexture, NULL);
|
|
||||||
ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
|
|
||||||
if(!pTexture) return;
|
|
||||||
|
|
||||||
for(i = 0; i < 8; i++) {
|
|
||||||
hr = IDirect3DDevice7_SetTexture(lpD3DDevice, i, pTexture);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_SetTexture for sampler %d failed with %08x\n", i, hr);
|
|
||||||
hr = IDirect3DDevice7_SetTexture(lpD3DDevice, i, NULL);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_SetTexture for sampler %d failed with %08x\n", i, hr);
|
|
||||||
hr = IDirect3DDevice7_SetTextureStageState(lpD3DDevice, i, D3DTSS_COLOROP, D3DTOP_ADD);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice8_SetTextureStageState for texture %d failed with %08x\n", i, hr);
|
|
||||||
}
|
|
||||||
|
|
||||||
IDirectDrawSurface7_Release(pTexture);
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI enumDevicesCallback(GUID *Guid, char *DeviceDescription,
|
static HRESULT WINAPI enumDevicesCallback(GUID *Guid, char *DeviceDescription,
|
||||||
char *DeviceName, D3DDEVICEDESC *hal, D3DDEVICEDESC *hel, void *ctx)
|
char *DeviceName, D3DDEVICEDESC *hal, D3DDEVICEDESC *hel, void *ctx)
|
||||||
{
|
{
|
||||||
|
@ -3475,7 +3446,6 @@ START_TEST(d3d)
|
||||||
LightTest();
|
LightTest();
|
||||||
StateTest();
|
StateTest();
|
||||||
SceneTest();
|
SceneTest();
|
||||||
LimitTest();
|
|
||||||
D3D7EnumTest();
|
D3D7EnumTest();
|
||||||
D3D7EnumLifetimeTest();
|
D3D7EnumLifetimeTest();
|
||||||
SetMaterialTest();
|
SetMaterialTest();
|
||||||
|
|
|
@ -14022,6 +14022,61 @@ static void test_compute_sphere_visibility(void)
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_texture_stages_limits(void)
|
||||||
|
{
|
||||||
|
IDirectDrawSurface4 *surface;
|
||||||
|
DDSURFACEDESC2 surface_desc;
|
||||||
|
IDirect3DTexture2 *texture;
|
||||||
|
IDirect3DDevice3 *device;
|
||||||
|
IDirectDraw4 *ddraw;
|
||||||
|
IDirect3D3 *d3d;
|
||||||
|
unsigned int i;
|
||||||
|
ULONG refcount;
|
||||||
|
HWND window;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
window = create_window();
|
||||||
|
if (!(device = create_device(window, DDSCL_NORMAL)))
|
||||||
|
{
|
||||||
|
skip("Failed to create 3D device.\n");
|
||||||
|
DestroyWindow(window);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hr = IDirect3DDevice3_GetDirect3D(device, &d3d);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to get Direct3D interface, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3D3_QueryInterface(d3d, &IID_IDirectDraw4, (void **)&ddraw);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to get DirectDraw interface, hr %#x.\n", hr);
|
||||||
|
IDirect3D3_Release(d3d);
|
||||||
|
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
|
||||||
|
surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
|
||||||
|
surface_desc.dwWidth = 16;
|
||||||
|
surface_desc.dwHeight = 16;
|
||||||
|
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||||
|
ok(hr == DD_OK, "Failed to create surface, hr %#x.\n", hr);
|
||||||
|
hr = IDirectDrawSurface4_QueryInterface(surface, &IID_IDirect3DTexture2, (void **)&texture);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to get texture interface, hr %#x.\n", hr);
|
||||||
|
IDirectDrawSurface4_Release(surface);
|
||||||
|
|
||||||
|
for (i = 0; i < 8; ++i)
|
||||||
|
{
|
||||||
|
hr = IDirect3DDevice3_SetTexture(device, i, texture);
|
||||||
|
ok(hr == D3D_OK, "Failed to set texture %u, hr %#x.\n", i, hr);
|
||||||
|
hr = IDirect3DDevice3_SetTexture(device, i, NULL);
|
||||||
|
ok(hr == D3D_OK, "Failed to set texture %u, hr %#x.\n", i, hr);
|
||||||
|
hr = IDirect3DDevice3_SetTextureStageState(device, i, D3DTSS_COLOROP, D3DTOP_ADD);
|
||||||
|
ok(hr == D3D_OK, "Failed to set texture stage state %u, hr %#x.\n", i, hr);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDirectDraw4_Release(ddraw);
|
||||||
|
IDirect3DTexture2_Release(texture);
|
||||||
|
refcount = IDirect3DDevice3_Release(device);
|
||||||
|
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||||
|
DestroyWindow(window);
|
||||||
|
}
|
||||||
|
|
||||||
static void test_map_synchronisation(void)
|
static void test_map_synchronisation(void)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER frequency, diff, ts[3];
|
LARGE_INTEGER frequency, diff, ts[3];
|
||||||
|
@ -14763,6 +14818,7 @@ START_TEST(ddraw4)
|
||||||
test_ck_operation();
|
test_ck_operation();
|
||||||
test_vb_refcount();
|
test_vb_refcount();
|
||||||
test_compute_sphere_visibility();
|
test_compute_sphere_visibility();
|
||||||
|
test_texture_stages_limits();
|
||||||
test_map_synchronisation();
|
test_map_synchronisation();
|
||||||
test_depth_readback();
|
test_depth_readback();
|
||||||
test_clear();
|
test_clear();
|
||||||
|
|
|
@ -13398,6 +13398,57 @@ static void test_clip_planes_limits(void)
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_texture_stages_limits(void)
|
||||||
|
{
|
||||||
|
IDirectDrawSurface7 *texture;
|
||||||
|
DDSURFACEDESC2 surface_desc;
|
||||||
|
IDirect3DDevice7 *device;
|
||||||
|
IDirectDraw7 *ddraw;
|
||||||
|
IDirect3D7 *d3d;
|
||||||
|
unsigned int i;
|
||||||
|
ULONG refcount;
|
||||||
|
HWND window;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
window = create_window();
|
||||||
|
if (!(device = create_device(window, DDSCL_NORMAL)))
|
||||||
|
{
|
||||||
|
skip("Failed to create 3D device.\n");
|
||||||
|
DestroyWindow(window);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hr = IDirect3DDevice7_GetDirect3D(device, &d3d);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to get Direct3D interface, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3D7_QueryInterface(d3d, &IID_IDirectDraw7, (void **)&ddraw);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to get DirectDraw interface, hr %#x.\n", hr);
|
||||||
|
IDirect3D7_Release(d3d);
|
||||||
|
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
|
||||||
|
surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
|
||||||
|
surface_desc.dwWidth = 16;
|
||||||
|
surface_desc.dwHeight = 16;
|
||||||
|
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &texture, NULL);
|
||||||
|
ok(hr == DD_OK, "Failed to create surface, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
for (i = 0; i < 8; ++i)
|
||||||
|
{
|
||||||
|
hr = IDirect3DDevice7_SetTexture(device, i, texture);
|
||||||
|
ok(hr == D3D_OK, "Failed to set texture %u, hr %#x.\n", i, hr);
|
||||||
|
hr = IDirect3DDevice7_SetTexture(device, i, NULL);
|
||||||
|
ok(hr == D3D_OK, "Failed to set texture %u, hr %#x.\n", i, hr);
|
||||||
|
hr = IDirect3DDevice7_SetTextureStageState(device, i, D3DTSS_COLOROP, D3DTOP_ADD);
|
||||||
|
ok(hr == D3D_OK, "Failed to set texture stage state %u, hr %#x.\n", i, hr);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDirectDrawSurface7_Release(texture);
|
||||||
|
IDirectDraw7_Release(ddraw);
|
||||||
|
refcount = IDirect3DDevice7_Release(device);
|
||||||
|
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||||
|
DestroyWindow(window);
|
||||||
|
}
|
||||||
|
|
||||||
static void test_map_synchronisation(void)
|
static void test_map_synchronisation(void)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER frequency, diff, ts[3];
|
LARGE_INTEGER frequency, diff, ts[3];
|
||||||
|
@ -14105,6 +14156,7 @@ START_TEST(ddraw7)
|
||||||
test_vb_refcount();
|
test_vb_refcount();
|
||||||
test_compute_sphere_visibility();
|
test_compute_sphere_visibility();
|
||||||
test_clip_planes_limits();
|
test_clip_planes_limits();
|
||||||
|
test_texture_stages_limits();
|
||||||
test_map_synchronisation();
|
test_map_synchronisation();
|
||||||
test_depth_readback();
|
test_depth_readback();
|
||||||
test_clear();
|
test_clear();
|
||||||
|
|
Loading…
Reference in New Issue