mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
ddraw/tests: Merge MipMapCreationTest() with test_mipmap_lock().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e53567f72a
commit
cac1242a63
5 changed files with 275 additions and 264 deletions
|
@ -1,4 +1,5 @@
|
||||||
/*
|
/*
|
||||||
|
* Copyright 2005 Antoine Chavasse (a.chavasse@gmail.com)
|
||||||
* Copyright 2011-2014 Henri Verbeet for CodeWeavers
|
* Copyright 2011-2014 Henri Verbeet for CodeWeavers
|
||||||
* Copyright 2012-2013 Stefan Dösinger for CodeWeavers
|
* Copyright 2012-2013 Stefan Dösinger for CodeWeavers
|
||||||
*
|
*
|
||||||
|
@ -4975,17 +4976,37 @@ static void test_create_surface_pitch(void)
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_mipmap_lock(void)
|
static void test_mipmap(void)
|
||||||
{
|
{
|
||||||
IDirectDrawSurface *surface, *surface2;
|
IDirectDrawSurface *surface, *surface2;
|
||||||
DDSURFACEDESC surface_desc;
|
DDSURFACEDESC surface_desc;
|
||||||
IDirectDraw *ddraw;
|
IDirectDraw *ddraw;
|
||||||
|
unsigned int i;
|
||||||
ULONG refcount;
|
ULONG refcount;
|
||||||
HWND window;
|
HWND window;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
DDSCAPS caps = {DDSCAPS_COMPLEX};
|
DDSCAPS caps = {DDSCAPS_COMPLEX};
|
||||||
DDCAPS hal_caps;
|
DDCAPS hal_caps;
|
||||||
|
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
DWORD flags;
|
||||||
|
DWORD caps;
|
||||||
|
DWORD width;
|
||||||
|
DWORD height;
|
||||||
|
DWORD mipmap_count_in;
|
||||||
|
HRESULT hr;
|
||||||
|
DWORD mipmap_count_out;
|
||||||
|
}
|
||||||
|
tests[] =
|
||||||
|
{
|
||||||
|
{DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 3, DD_OK, 3},
|
||||||
|
{DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDPARAMS, 0},
|
||||||
|
{0, DDSCAPS_TEXTURE | DDSCAPS_MIPMAP, 128, 32, 0, DD_OK, 1},
|
||||||
|
{0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DD_OK, 6},
|
||||||
|
{0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 32, 64, 0, DD_OK, 6},
|
||||||
|
};
|
||||||
|
|
||||||
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
||||||
0, 0, 640, 480, 0, 0, 0, 0);
|
0, 0, 640, 480, 0, 0, 0, 0);
|
||||||
ddraw = create_ddraw();
|
ddraw = create_ddraw();
|
||||||
|
@ -4999,38 +5020,58 @@ static void test_mipmap_lock(void)
|
||||||
ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
|
||||||
if ((hal_caps.ddsCaps.dwCaps & (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)) != (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP))
|
if ((hal_caps.ddsCaps.dwCaps & (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)) != (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP))
|
||||||
{
|
{
|
||||||
skip("Mipmapped textures not supported, skipping mipmap lock test.\n");
|
skip("Mipmapped textures not supported, skipping tests.\n");
|
||||||
IDirectDraw_Release(ddraw);
|
IDirectDraw_Release(ddraw);
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
|
||||||
surface_desc.dwSize = sizeof(surface_desc);
|
{
|
||||||
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_MIPMAPCOUNT;
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
surface_desc.dwWidth = 4;
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
surface_desc.dwHeight = 4;
|
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | tests[i].flags;
|
||||||
U2(surface_desc).dwMipMapCount = 2;
|
surface_desc.ddsCaps.dwCaps = tests[i].caps;
|
||||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP
|
surface_desc.dwWidth = tests[i].width;
|
||||||
| DDSCAPS_SYSTEMMEMORY;
|
surface_desc.dwHeight = tests[i].height;
|
||||||
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
if (tests[i].flags & DDSD_MIPMAPCOUNT)
|
||||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
U2(surface_desc).dwMipMapCount = tests[i].mipmap_count_in;
|
||||||
hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &surface2);
|
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||||
ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr);
|
ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#x.\n", i, hr);
|
||||||
|
if (FAILED(hr))
|
||||||
|
continue;
|
||||||
|
|
||||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
surface_desc.dwSize = sizeof(surface_desc);
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
hr = IDirectDrawSurface_Lock(surface, NULL, &surface_desc, 0, NULL);
|
hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc);
|
||||||
ok(SUCCEEDED(hr), "Failed to lock surface, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
|
||||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
ok(surface_desc.dwFlags & DDSD_MIPMAPCOUNT,
|
||||||
surface_desc.dwSize = sizeof(surface_desc);
|
"Test %u: Got unexpected flags %#x.\n", i, surface_desc.dwFlags);
|
||||||
hr = IDirectDrawSurface_Lock(surface2, NULL, &surface_desc, 0, NULL);
|
ok(U2(surface_desc).dwMipMapCount == tests[i].mipmap_count_out,
|
||||||
ok(SUCCEEDED(hr), "Failed to lock surface, hr %#x.\n", hr);
|
"Test %u: Got unexpected mipmap count %u.\n", i, U2(surface_desc).dwMipMapCount);
|
||||||
IDirectDrawSurface_Unlock(surface2, NULL);
|
|
||||||
IDirectDrawSurface_Unlock(surface, NULL);
|
if (U2(surface_desc).dwMipMapCount > 1)
|
||||||
|
{
|
||||||
|
hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &surface2);
|
||||||
|
ok(SUCCEEDED(hr), "Test %u: Failed to get attached surface, hr %#x.\n", i, hr);
|
||||||
|
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
hr = IDirectDrawSurface_Lock(surface, NULL, &surface_desc, 0, NULL);
|
||||||
|
ok(SUCCEEDED(hr), "Test %u: Failed to lock surface, hr %#x.\n", i, hr);
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
hr = IDirectDrawSurface_Lock(surface2, NULL, &surface_desc, 0, NULL);
|
||||||
|
ok(SUCCEEDED(hr), "Test %u: Failed to lock surface, hr %#x.\n", i, hr);
|
||||||
|
IDirectDrawSurface_Unlock(surface2, NULL);
|
||||||
|
IDirectDrawSurface_Unlock(surface, NULL);
|
||||||
|
|
||||||
|
IDirectDrawSurface_Release(surface2);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDirectDrawSurface_Release(surface);
|
||||||
|
}
|
||||||
|
|
||||||
IDirectDrawSurface_Release(surface2);
|
|
||||||
IDirectDrawSurface_Release(surface);
|
|
||||||
refcount = IDirectDraw_Release(ddraw);
|
refcount = IDirectDraw_Release(ddraw);
|
||||||
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
|
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
|
@ -8025,7 +8066,7 @@ START_TEST(ddraw1)
|
||||||
test_surface_attachment();
|
test_surface_attachment();
|
||||||
test_pixel_format();
|
test_pixel_format();
|
||||||
test_create_surface_pitch();
|
test_create_surface_pitch();
|
||||||
test_mipmap_lock();
|
test_mipmap();
|
||||||
test_palette_complex();
|
test_palette_complex();
|
||||||
test_p8_rgb_blit();
|
test_p8_rgb_blit();
|
||||||
test_material();
|
test_material();
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/*
|
/*
|
||||||
|
* Copyright 2005 Antoine Chavasse (a.chavasse@gmail.com)
|
||||||
* Copyright 2011-2014 Henri Verbeet for CodeWeavers
|
* Copyright 2011-2014 Henri Verbeet for CodeWeavers
|
||||||
* Copyright 2012-2014 Stefan Dösinger for CodeWeavers
|
* Copyright 2012-2014 Stefan Dösinger for CodeWeavers
|
||||||
*
|
*
|
||||||
|
@ -6017,18 +6018,38 @@ static void test_create_surface_pitch(void)
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_mipmap_lock(void)
|
static void test_mipmap(void)
|
||||||
{
|
{
|
||||||
IDirectDrawSurface *surface1;
|
IDirectDrawSurface *surface1;
|
||||||
IDirectDrawSurface2 *surface, *surface2;
|
IDirectDrawSurface2 *surface, *surface2;
|
||||||
DDSURFACEDESC surface_desc;
|
DDSURFACEDESC surface_desc;
|
||||||
IDirectDraw2 *ddraw;
|
IDirectDraw2 *ddraw;
|
||||||
|
unsigned int i;
|
||||||
ULONG refcount;
|
ULONG refcount;
|
||||||
HWND window;
|
HWND window;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
DDSCAPS caps = {DDSCAPS_COMPLEX};
|
DDSCAPS caps = {DDSCAPS_COMPLEX};
|
||||||
DDCAPS hal_caps;
|
DDCAPS hal_caps;
|
||||||
|
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
DWORD flags;
|
||||||
|
DWORD caps;
|
||||||
|
DWORD width;
|
||||||
|
DWORD height;
|
||||||
|
DWORD mipmap_count_in;
|
||||||
|
HRESULT hr;
|
||||||
|
DWORD mipmap_count_out;
|
||||||
|
}
|
||||||
|
tests[] =
|
||||||
|
{
|
||||||
|
{DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 3, DD_OK, 3},
|
||||||
|
{DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDPARAMS, 0},
|
||||||
|
{0, DDSCAPS_TEXTURE | DDSCAPS_MIPMAP, 128, 32, 0, DD_OK, 1},
|
||||||
|
{0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DD_OK, 6},
|
||||||
|
{0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 32, 64, 0, DD_OK, 6},
|
||||||
|
};
|
||||||
|
|
||||||
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
||||||
0, 0, 640, 480, 0, 0, 0, 0);
|
0, 0, 640, 480, 0, 0, 0, 0);
|
||||||
ddraw = create_ddraw();
|
ddraw = create_ddraw();
|
||||||
|
@ -6042,42 +6063,62 @@ static void test_mipmap_lock(void)
|
||||||
ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
|
||||||
if ((hal_caps.ddsCaps.dwCaps & (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)) != (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP))
|
if ((hal_caps.ddsCaps.dwCaps & (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)) != (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP))
|
||||||
{
|
{
|
||||||
skip("Mipmapped textures not supported, skipping mipmap lock test.\n");
|
skip("Mipmapped textures not supported, skipping tests.\n");
|
||||||
IDirectDraw2_Release(ddraw);
|
IDirectDraw2_Release(ddraw);
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
|
||||||
surface_desc.dwSize = sizeof(surface_desc);
|
{
|
||||||
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_MIPMAPCOUNT;
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
surface_desc.dwWidth = 4;
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
surface_desc.dwHeight = 4;
|
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | tests[i].flags;
|
||||||
U2(surface_desc).dwMipMapCount = 2;
|
surface_desc.ddsCaps.dwCaps = tests[i].caps;
|
||||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP
|
surface_desc.dwWidth = tests[i].width;
|
||||||
| DDSCAPS_SYSTEMMEMORY;
|
surface_desc.dwHeight = tests[i].height;
|
||||||
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface1, NULL);
|
if (tests[i].flags & DDSD_MIPMAPCOUNT)
|
||||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
U2(surface_desc).dwMipMapCount = tests[i].mipmap_count_in;
|
||||||
|
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface1, NULL);
|
||||||
|
ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#x.\n", i, hr);
|
||||||
|
if (FAILED(hr))
|
||||||
|
continue;
|
||||||
|
|
||||||
hr = IDirectDrawSurface_QueryInterface(surface1, &IID_IDirectDrawSurface2, (void **)&surface);
|
hr = IDirectDrawSurface_QueryInterface(surface1, &IID_IDirectDrawSurface2, (void **)&surface);
|
||||||
ok(SUCCEEDED(hr), "Failed to get IDirectDrawSurface2 interface, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Test %u: Failed to get IDirectDrawSurface2 interface, hr %#x.\n", i, hr);
|
||||||
IDirectDrawSurface_Release(surface1);
|
IDirectDrawSurface_Release(surface1);
|
||||||
hr = IDirectDrawSurface2_GetAttachedSurface(surface, &caps, &surface2);
|
|
||||||
ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr);
|
|
||||||
|
|
||||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
surface_desc.dwSize = sizeof(surface_desc);
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
hr = IDirectDrawSurface2_Lock(surface, NULL, &surface_desc, 0, NULL);
|
hr = IDirectDrawSurface2_GetSurfaceDesc(surface, &surface_desc);
|
||||||
ok(SUCCEEDED(hr), "Failed to lock surface, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
|
||||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
ok(surface_desc.dwFlags & DDSD_MIPMAPCOUNT,
|
||||||
surface_desc.dwSize = sizeof(surface_desc);
|
"Test %u: Got unexpected flags %#x.\n", i, surface_desc.dwFlags);
|
||||||
hr = IDirectDrawSurface2_Lock(surface2, NULL, &surface_desc, 0, NULL);
|
ok(U2(surface_desc).dwMipMapCount == tests[i].mipmap_count_out,
|
||||||
ok(SUCCEEDED(hr), "Failed to lock surface, hr %#x.\n", hr);
|
"Test %u: Got unexpected mipmap count %u.\n", i, U2(surface_desc).dwMipMapCount);
|
||||||
IDirectDrawSurface2_Unlock(surface2, NULL);
|
|
||||||
IDirectDrawSurface2_Unlock(surface, NULL);
|
if (U2(surface_desc).dwMipMapCount > 1)
|
||||||
|
{
|
||||||
|
hr = IDirectDrawSurface2_GetAttachedSurface(surface, &caps, &surface2);
|
||||||
|
ok(SUCCEEDED(hr), "Test %u: Failed to get attached surface, hr %#x.\n", i, hr);
|
||||||
|
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
hr = IDirectDrawSurface2_Lock(surface, NULL, &surface_desc, 0, NULL);
|
||||||
|
ok(SUCCEEDED(hr), "Test %u: Failed to lock surface, hr %#x.\n", i, hr);
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
hr = IDirectDrawSurface2_Lock(surface2, NULL, &surface_desc, 0, NULL);
|
||||||
|
ok(SUCCEEDED(hr), "Test %u: Failed to lock surface, hr %#x.\n", i, hr);
|
||||||
|
IDirectDrawSurface2_Unlock(surface2, NULL);
|
||||||
|
IDirectDrawSurface2_Unlock(surface, NULL);
|
||||||
|
|
||||||
|
IDirectDrawSurface2_Release(surface2);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDirectDrawSurface2_Release(surface);
|
||||||
|
}
|
||||||
|
|
||||||
IDirectDrawSurface2_Release(surface2);
|
|
||||||
IDirectDrawSurface2_Release(surface);
|
|
||||||
refcount = IDirectDraw2_Release(ddraw);
|
refcount = IDirectDraw2_Release(ddraw);
|
||||||
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
|
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
|
@ -9133,7 +9174,7 @@ START_TEST(ddraw2)
|
||||||
test_surface_attachment();
|
test_surface_attachment();
|
||||||
test_pixel_format();
|
test_pixel_format();
|
||||||
test_create_surface_pitch();
|
test_create_surface_pitch();
|
||||||
test_mipmap_lock();
|
test_mipmap();
|
||||||
test_palette_complex();
|
test_palette_complex();
|
||||||
test_p8_rgb_blit();
|
test_p8_rgb_blit();
|
||||||
test_material();
|
test_material();
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/*
|
/*
|
||||||
|
* Copyright 2005 Antoine Chavasse (a.chavasse@gmail.com)
|
||||||
* Copyright 2011-2014 Henri Verbeet for CodeWeavers
|
* Copyright 2011-2014 Henri Verbeet for CodeWeavers
|
||||||
* Copyright 2012-2014 Stefan Dösinger for CodeWeavers
|
* Copyright 2012-2014 Stefan Dösinger for CodeWeavers
|
||||||
*
|
*
|
||||||
|
@ -7550,17 +7551,37 @@ static void test_create_surface_pitch(void)
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_mipmap_lock(void)
|
static void test_mipmap(void)
|
||||||
{
|
{
|
||||||
IDirectDrawSurface4 *surface, *surface2;
|
IDirectDrawSurface4 *surface, *surface2;
|
||||||
DDSURFACEDESC2 surface_desc;
|
DDSURFACEDESC2 surface_desc;
|
||||||
IDirectDraw4 *ddraw;
|
IDirectDraw4 *ddraw;
|
||||||
|
unsigned int i;
|
||||||
ULONG refcount;
|
ULONG refcount;
|
||||||
HWND window;
|
HWND window;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
DDSCAPS2 caps = {DDSCAPS_COMPLEX, 0, 0, {0}};
|
DDSCAPS2 caps = {DDSCAPS_COMPLEX, 0, 0, {0}};
|
||||||
DDCAPS hal_caps;
|
DDCAPS hal_caps;
|
||||||
|
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
DWORD flags;
|
||||||
|
DWORD caps;
|
||||||
|
DWORD width;
|
||||||
|
DWORD height;
|
||||||
|
DWORD mipmap_count_in;
|
||||||
|
HRESULT hr;
|
||||||
|
DWORD mipmap_count_out;
|
||||||
|
}
|
||||||
|
tests[] =
|
||||||
|
{
|
||||||
|
{DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 3, DD_OK, 3},
|
||||||
|
{DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDPARAMS, 0},
|
||||||
|
{0, DDSCAPS_TEXTURE | DDSCAPS_MIPMAP, 128, 32, 0, DD_OK, 1},
|
||||||
|
{0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DD_OK, 6},
|
||||||
|
{0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 32, 64, 0, DD_OK, 6},
|
||||||
|
};
|
||||||
|
|
||||||
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
||||||
0, 0, 640, 480, 0, 0, 0, 0);
|
0, 0, 640, 480, 0, 0, 0, 0);
|
||||||
ddraw = create_ddraw();
|
ddraw = create_ddraw();
|
||||||
|
@ -7574,38 +7595,58 @@ static void test_mipmap_lock(void)
|
||||||
ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
|
||||||
if ((hal_caps.ddsCaps.dwCaps & (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)) != (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP))
|
if ((hal_caps.ddsCaps.dwCaps & (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)) != (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP))
|
||||||
{
|
{
|
||||||
skip("Mipmapped textures not supported, skipping mipmap lock test.\n");
|
skip("Mipmapped textures not supported, skipping tests.\n");
|
||||||
IDirectDraw4_Release(ddraw);
|
IDirectDraw4_Release(ddraw);
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
|
||||||
surface_desc.dwSize = sizeof(surface_desc);
|
{
|
||||||
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_MIPMAPCOUNT;
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
surface_desc.dwWidth = 4;
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
surface_desc.dwHeight = 4;
|
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | tests[i].flags;
|
||||||
U2(surface_desc).dwMipMapCount = 2;
|
surface_desc.ddsCaps.dwCaps = tests[i].caps;
|
||||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP
|
surface_desc.dwWidth = tests[i].width;
|
||||||
| DDSCAPS_SYSTEMMEMORY;
|
surface_desc.dwHeight = tests[i].height;
|
||||||
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
if (tests[i].flags & DDSD_MIPMAPCOUNT)
|
||||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
U2(surface_desc).dwMipMapCount = tests[i].mipmap_count_in;
|
||||||
hr = IDirectDrawSurface4_GetAttachedSurface(surface, &caps, &surface2);
|
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||||
ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr);
|
ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#x.\n", i, hr);
|
||||||
|
if (FAILED(hr))
|
||||||
|
continue;
|
||||||
|
|
||||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
surface_desc.dwSize = sizeof(surface_desc);
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
hr = IDirectDrawSurface4_Lock(surface, NULL, &surface_desc, 0, NULL);
|
hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &surface_desc);
|
||||||
ok(SUCCEEDED(hr), "Failed to lock surface, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
|
||||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
ok(surface_desc.dwFlags & DDSD_MIPMAPCOUNT,
|
||||||
surface_desc.dwSize = sizeof(surface_desc);
|
"Test %u: Got unexpected flags %#x.\n", i, surface_desc.dwFlags);
|
||||||
hr = IDirectDrawSurface4_Lock(surface2, NULL, &surface_desc, 0, NULL);
|
ok(U2(surface_desc).dwMipMapCount == tests[i].mipmap_count_out,
|
||||||
ok(SUCCEEDED(hr), "Failed to lock surface, hr %#x.\n", hr);
|
"Test %u: Got unexpected mipmap count %u.\n", i, U2(surface_desc).dwMipMapCount);
|
||||||
IDirectDrawSurface4_Unlock(surface2, NULL);
|
|
||||||
IDirectDrawSurface4_Unlock(surface, NULL);
|
if (U2(surface_desc).dwMipMapCount > 1)
|
||||||
|
{
|
||||||
|
hr = IDirectDrawSurface4_GetAttachedSurface(surface, &caps, &surface2);
|
||||||
|
ok(SUCCEEDED(hr), "Test %u: Failed to get attached surface, hr %#x.\n", i, hr);
|
||||||
|
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
hr = IDirectDrawSurface4_Lock(surface, NULL, &surface_desc, 0, NULL);
|
||||||
|
ok(SUCCEEDED(hr), "Test %u: Failed to lock surface, hr %#x.\n", i, hr);
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
hr = IDirectDrawSurface4_Lock(surface2, NULL, &surface_desc, 0, NULL);
|
||||||
|
ok(SUCCEEDED(hr), "Test %u: Failed to lock surface, hr %#x.\n", i, hr);
|
||||||
|
IDirectDrawSurface4_Unlock(surface2, NULL);
|
||||||
|
IDirectDrawSurface4_Unlock(surface, NULL);
|
||||||
|
|
||||||
|
IDirectDrawSurface4_Release(surface2);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDirectDrawSurface4_Release(surface);
|
||||||
|
}
|
||||||
|
|
||||||
IDirectDrawSurface4_Release(surface2);
|
|
||||||
IDirectDrawSurface4_Release(surface);
|
|
||||||
refcount = IDirectDraw4_Release(ddraw);
|
refcount = IDirectDraw4_Release(ddraw);
|
||||||
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
|
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
|
@ -10310,7 +10351,7 @@ START_TEST(ddraw4)
|
||||||
test_private_data();
|
test_private_data();
|
||||||
test_pixel_format();
|
test_pixel_format();
|
||||||
test_create_surface_pitch();
|
test_create_surface_pitch();
|
||||||
test_mipmap_lock();
|
test_mipmap();
|
||||||
test_palette_complex();
|
test_palette_complex();
|
||||||
test_p8_rgb_blit();
|
test_p8_rgb_blit();
|
||||||
test_material();
|
test_material();
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/*
|
/*
|
||||||
|
* Copyright 2005 Antoine Chavasse (a.chavasse@gmail.com)
|
||||||
* Copyright 2006, 2012-2014 Stefan Dösinger for CodeWeavers
|
* Copyright 2006, 2012-2014 Stefan Dösinger for CodeWeavers
|
||||||
* Copyright 2011-2014 Henri Verbeet for CodeWeavers
|
* Copyright 2011-2014 Henri Verbeet for CodeWeavers
|
||||||
*
|
*
|
||||||
|
@ -7399,17 +7400,37 @@ static void test_create_surface_pitch(void)
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_mipmap_lock(void)
|
static void test_mipmap(void)
|
||||||
{
|
{
|
||||||
IDirectDrawSurface7 *surface, *surface2;
|
IDirectDrawSurface7 *surface, *surface2;
|
||||||
DDSURFACEDESC2 surface_desc;
|
DDSURFACEDESC2 surface_desc;
|
||||||
IDirectDraw7 *ddraw;
|
IDirectDraw7 *ddraw;
|
||||||
|
unsigned int i;
|
||||||
ULONG refcount;
|
ULONG refcount;
|
||||||
HWND window;
|
HWND window;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
DDSCAPS2 caps = {DDSCAPS_COMPLEX, 0, 0, {0}};
|
DDSCAPS2 caps = {DDSCAPS_COMPLEX, 0, 0, {0}};
|
||||||
DDCAPS hal_caps;
|
DDCAPS hal_caps;
|
||||||
|
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
DWORD flags;
|
||||||
|
DWORD caps;
|
||||||
|
DWORD width;
|
||||||
|
DWORD height;
|
||||||
|
DWORD mipmap_count_in;
|
||||||
|
HRESULT hr;
|
||||||
|
DWORD mipmap_count_out;
|
||||||
|
}
|
||||||
|
tests[] =
|
||||||
|
{
|
||||||
|
{DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 3, DD_OK, 3},
|
||||||
|
{DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDPARAMS, 0},
|
||||||
|
{0, DDSCAPS_TEXTURE | DDSCAPS_MIPMAP, 128, 32, 0, DD_OK, 1},
|
||||||
|
{0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DD_OK, 8},
|
||||||
|
{0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 32, 64, 0, DD_OK, 7},
|
||||||
|
};
|
||||||
|
|
||||||
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
||||||
0, 0, 640, 480, 0, 0, 0, 0);
|
0, 0, 640, 480, 0, 0, 0, 0);
|
||||||
ddraw = create_ddraw();
|
ddraw = create_ddraw();
|
||||||
|
@ -7424,38 +7445,58 @@ static void test_mipmap_lock(void)
|
||||||
if ((hal_caps.ddsCaps.dwCaps & (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)) != (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)
|
if ((hal_caps.ddsCaps.dwCaps & (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)) != (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)
|
||||||
|| is_ddraw64)
|
|| is_ddraw64)
|
||||||
{
|
{
|
||||||
skip("Mipmapped textures not supported, skipping mipmap lock test.\n");
|
skip("Mipmapped textures not supported, skipping tests.\n");
|
||||||
IDirectDraw7_Release(ddraw);
|
IDirectDraw7_Release(ddraw);
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
|
||||||
surface_desc.dwSize = sizeof(surface_desc);
|
{
|
||||||
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_MIPMAPCOUNT;
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
surface_desc.dwWidth = 4;
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
surface_desc.dwHeight = 4;
|
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | tests[i].flags;
|
||||||
U2(surface_desc).dwMipMapCount = 2;
|
surface_desc.ddsCaps.dwCaps = tests[i].caps;
|
||||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP
|
surface_desc.dwWidth = tests[i].width;
|
||||||
| DDSCAPS_SYSTEMMEMORY;
|
surface_desc.dwHeight = tests[i].height;
|
||||||
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
if (tests[i].flags & DDSD_MIPMAPCOUNT)
|
||||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
U2(surface_desc).dwMipMapCount = tests[i].mipmap_count_in;
|
||||||
hr = IDirectDrawSurface7_GetAttachedSurface(surface, &caps, &surface2);
|
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||||
ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr);
|
ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#x.\n", i, hr);
|
||||||
|
if (FAILED(hr))
|
||||||
|
continue;
|
||||||
|
|
||||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
surface_desc.dwSize = sizeof(surface_desc);
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
hr = IDirectDrawSurface7_Lock(surface, NULL, &surface_desc, 0, NULL);
|
hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &surface_desc);
|
||||||
ok(SUCCEEDED(hr), "Failed to lock surface, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr);
|
||||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
ok(surface_desc.dwFlags & DDSD_MIPMAPCOUNT,
|
||||||
surface_desc.dwSize = sizeof(surface_desc);
|
"Test %u: Got unexpected flags %#x.\n", i, surface_desc.dwFlags);
|
||||||
hr = IDirectDrawSurface7_Lock(surface2, NULL, &surface_desc, 0, NULL);
|
ok(U2(surface_desc).dwMipMapCount == tests[i].mipmap_count_out,
|
||||||
ok(SUCCEEDED(hr), "Failed to lock surface, hr %#x.\n", hr);
|
"Test %u: Got unexpected mipmap count %u.\n", i, U2(surface_desc).dwMipMapCount);
|
||||||
IDirectDrawSurface7_Unlock(surface2, NULL);
|
|
||||||
IDirectDrawSurface7_Unlock(surface, NULL);
|
if (U2(surface_desc).dwMipMapCount > 1)
|
||||||
|
{
|
||||||
|
hr = IDirectDrawSurface7_GetAttachedSurface(surface, &caps, &surface2);
|
||||||
|
ok(SUCCEEDED(hr), "Test %u: Failed to get attached surface, hr %#x.\n", i, hr);
|
||||||
|
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
hr = IDirectDrawSurface7_Lock(surface, NULL, &surface_desc, 0, NULL);
|
||||||
|
ok(SUCCEEDED(hr), "Test %u: Failed to lock surface, hr %#x.\n", i, hr);
|
||||||
|
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||||
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
|
hr = IDirectDrawSurface7_Lock(surface2, NULL, &surface_desc, 0, NULL);
|
||||||
|
ok(SUCCEEDED(hr), "Test %u: Failed to lock surface, hr %#x.\n", i, hr);
|
||||||
|
IDirectDrawSurface7_Unlock(surface2, NULL);
|
||||||
|
IDirectDrawSurface7_Unlock(surface, NULL);
|
||||||
|
|
||||||
|
IDirectDrawSurface7_Release(surface2);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDirectDrawSurface7_Release(surface);
|
||||||
|
}
|
||||||
|
|
||||||
IDirectDrawSurface7_Release(surface2);
|
|
||||||
IDirectDrawSurface7_Release(surface);
|
|
||||||
refcount = IDirectDraw7_Release(ddraw);
|
refcount = IDirectDraw7_Release(ddraw);
|
||||||
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
|
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
|
@ -10580,7 +10621,7 @@ START_TEST(ddraw7)
|
||||||
test_private_data();
|
test_private_data();
|
||||||
test_pixel_format();
|
test_pixel_format();
|
||||||
test_create_surface_pitch();
|
test_create_surface_pitch();
|
||||||
test_mipmap_lock();
|
test_mipmap();
|
||||||
test_palette_complex();
|
test_palette_complex();
|
||||||
test_p8_rgb_blit();
|
test_p8_rgb_blit();
|
||||||
test_material();
|
test_material();
|
||||||
|
|
|
@ -61,158 +61,6 @@ static void ReleaseDirectDraw(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MipMapCreationTest(void)
|
|
||||||
{
|
|
||||||
IDirectDrawSurface *lpDDSMipMapTest;
|
|
||||||
DDSURFACEDESC ddsd;
|
|
||||||
HRESULT rc;
|
|
||||||
|
|
||||||
/* First mipmap creation test: create a surface with DDSCAPS_COMPLEX,
|
|
||||||
DDSCAPS_MIPMAP, and DDSD_MIPMAPCOUNT. This create the number of
|
|
||||||
requested mipmap levels. */
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_MIPMAPCOUNT;
|
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
|
|
||||||
U2(ddsd).dwMipMapCount = 3;
|
|
||||||
ddsd.dwWidth = 128;
|
|
||||||
ddsd.dwHeight = 32;
|
|
||||||
rc = IDirectDraw_CreateSurface(lpDD, &ddsd, &lpDDSMipMapTest, NULL);
|
|
||||||
ok(rc==DD_OK,"CreateSurface returned: %x\n",rc);
|
|
||||||
if (FAILED(rc))
|
|
||||||
{
|
|
||||||
skip("failed to create surface\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check the number of created mipmaps */
|
|
||||||
memset(&ddsd, 0, sizeof(DDSURFACEDESC));
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
rc = IDirectDrawSurface_GetSurfaceDesc(lpDDSMipMapTest, &ddsd);
|
|
||||||
ok(rc==DD_OK,"GetSurfaceDesc returned: %x\n",rc);
|
|
||||||
ok(ddsd.dwFlags & DDSD_MIPMAPCOUNT,
|
|
||||||
"GetSurfaceDesc returned no mipmapcount.\n");
|
|
||||||
ok(U2(ddsd).dwMipMapCount == 3, "Incorrect mipmap count: %d.\n",
|
|
||||||
U2(ddsd).dwMipMapCount);
|
|
||||||
|
|
||||||
/* Destroy the surface. */
|
|
||||||
IDirectDrawSurface_Release(lpDDSMipMapTest);
|
|
||||||
|
|
||||||
|
|
||||||
/* Second mipmap creation test: create a surface without a mipmap
|
|
||||||
count, with DDSCAPS_MIPMAP and without DDSCAPS_COMPLEX.
|
|
||||||
This creates a single mipmap level. */
|
|
||||||
memset(&ddsd, 0, sizeof(DDSURFACEDESC));
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
|
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP;
|
|
||||||
ddsd.dwWidth = 128;
|
|
||||||
ddsd.dwHeight = 32;
|
|
||||||
rc = IDirectDraw_CreateSurface(lpDD, &ddsd, &lpDDSMipMapTest, NULL);
|
|
||||||
ok(rc==DD_OK,"CreateSurface returned: %x\n",rc);
|
|
||||||
if (FAILED(rc))
|
|
||||||
{
|
|
||||||
skip("failed to create surface\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* Check the number of created mipmaps */
|
|
||||||
memset(&ddsd, 0, sizeof(DDSURFACEDESC));
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
rc = IDirectDrawSurface_GetSurfaceDesc(lpDDSMipMapTest, &ddsd);
|
|
||||||
ok(rc==DD_OK,"GetSurfaceDesc returned: %x\n",rc);
|
|
||||||
ok(ddsd.dwFlags & DDSD_MIPMAPCOUNT,
|
|
||||||
"GetSurfaceDesc returned no mipmapcount.\n");
|
|
||||||
ok(U2(ddsd).dwMipMapCount == 1, "Incorrect mipmap count: %d.\n",
|
|
||||||
U2(ddsd).dwMipMapCount);
|
|
||||||
|
|
||||||
/* Destroy the surface. */
|
|
||||||
IDirectDrawSurface_Release(lpDDSMipMapTest);
|
|
||||||
|
|
||||||
|
|
||||||
/* Third mipmap creation test: create a surface with DDSCAPS_MIPMAP,
|
|
||||||
DDSCAPS_COMPLEX and without DDSD_MIPMAPCOUNT.
|
|
||||||
It's an undocumented features where a chain of mipmaps, starting from
|
|
||||||
he specified size and down to the smallest size, is automatically
|
|
||||||
created.
|
|
||||||
Anarchy Online needs this feature to work. */
|
|
||||||
memset(&ddsd, 0, sizeof(DDSURFACEDESC));
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
|
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
|
|
||||||
ddsd.dwWidth = 128;
|
|
||||||
ddsd.dwHeight = 32;
|
|
||||||
rc = IDirectDraw_CreateSurface(lpDD, &ddsd, &lpDDSMipMapTest, NULL);
|
|
||||||
ok(rc==DD_OK,"CreateSurface returned: %x\n",rc);
|
|
||||||
if (FAILED(rc))
|
|
||||||
{
|
|
||||||
skip("failed to create surface\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check the number of created mipmaps */
|
|
||||||
memset(&ddsd, 0, sizeof(DDSURFACEDESC));
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
rc = IDirectDrawSurface_GetSurfaceDesc(lpDDSMipMapTest, &ddsd);
|
|
||||||
ok(rc==DD_OK,"GetSurfaceDesc returned: %x\n",rc);
|
|
||||||
ok(ddsd.dwFlags & DDSD_MIPMAPCOUNT,
|
|
||||||
"GetSurfaceDesc returned no mipmapcount.\n");
|
|
||||||
ok(U2(ddsd).dwMipMapCount == 6, "Incorrect mipmap count: %d.\n",
|
|
||||||
U2(ddsd).dwMipMapCount);
|
|
||||||
|
|
||||||
/* Destroy the surface. */
|
|
||||||
IDirectDrawSurface_Release(lpDDSMipMapTest);
|
|
||||||
|
|
||||||
|
|
||||||
/* Fourth mipmap creation test: same as above with a different texture
|
|
||||||
size.
|
|
||||||
The purpose is to verify that the number of generated mipmaps is
|
|
||||||
dependent on the smallest dimension. */
|
|
||||||
memset(&ddsd, 0, sizeof(DDSURFACEDESC));
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
|
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
|
|
||||||
ddsd.dwWidth = 32;
|
|
||||||
ddsd.dwHeight = 64;
|
|
||||||
rc = IDirectDraw_CreateSurface(lpDD, &ddsd, &lpDDSMipMapTest, NULL);
|
|
||||||
ok(rc==DD_OK,"CreateSurface returned: %x\n",rc);
|
|
||||||
if (FAILED(rc))
|
|
||||||
{
|
|
||||||
skip("failed to create surface\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check the number of created mipmaps */
|
|
||||||
memset(&ddsd, 0, sizeof(DDSURFACEDESC));
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
rc = IDirectDrawSurface_GetSurfaceDesc(lpDDSMipMapTest, &ddsd);
|
|
||||||
ok(rc==DD_OK,"GetSurfaceDesc returned: %x\n",rc);
|
|
||||||
ok(ddsd.dwFlags & DDSD_MIPMAPCOUNT,
|
|
||||||
"GetSurfaceDesc returned no mipmapcount.\n");
|
|
||||||
ok(U2(ddsd).dwMipMapCount == 6, "Incorrect mipmap count: %d.\n",
|
|
||||||
U2(ddsd).dwMipMapCount);
|
|
||||||
|
|
||||||
/* Destroy the surface. */
|
|
||||||
IDirectDrawSurface_Release(lpDDSMipMapTest);
|
|
||||||
|
|
||||||
|
|
||||||
/* Fifth mipmap creation test: try to create a surface with
|
|
||||||
DDSCAPS_COMPLEX, DDSCAPS_MIPMAP, DDSD_MIPMAPCOUNT,
|
|
||||||
where dwMipMapCount = 0. This should fail. */
|
|
||||||
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_MIPMAPCOUNT;
|
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
|
|
||||||
U2(ddsd).dwMipMapCount = 0;
|
|
||||||
ddsd.dwWidth = 128;
|
|
||||||
ddsd.dwHeight = 32;
|
|
||||||
rc = IDirectDraw_CreateSurface(lpDD, &ddsd, &lpDDSMipMapTest, NULL);
|
|
||||||
ok(rc==DDERR_INVALIDPARAMS,"CreateSurface returned: %x\n",rc);
|
|
||||||
|
|
||||||
/* Destroy the surface. */
|
|
||||||
if( rc == DD_OK )
|
|
||||||
IDirectDrawSurface_Release(lpDDSMipMapTest);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SrcColorKey32BlitTest(void)
|
static void SrcColorKey32BlitTest(void)
|
||||||
{
|
{
|
||||||
IDirectDrawSurface *lpSrc;
|
IDirectDrawSurface *lpSrc;
|
||||||
|
@ -3932,7 +3780,6 @@ START_TEST(dsurface)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MipMapCreationTest();
|
|
||||||
SrcColorKey32BlitTest();
|
SrcColorKey32BlitTest();
|
||||||
QueryInterface();
|
QueryInterface();
|
||||||
GetDDInterface_1();
|
GetDDInterface_1();
|
||||||
|
|
Loading…
Reference in a new issue