Commit e718eae9 authored by Alexander Dorofeyev's avatar Alexander Dorofeyev Committed by Alexandre Julliard

ddraw/tests: Skip cubemap tests when cubemap isn't supported.

parent c38b2fe0
...@@ -1652,6 +1652,7 @@ static void DeviceLoadTest() ...@@ -1652,6 +1652,7 @@ static void DeviceLoadTest()
IDirectDrawPalette *palettes[5]; IDirectDrawPalette *palettes[5];
PALETTEENTRY table1[256]; PALETTEENTRY table1[256];
DDCOLORKEY ddckey; DDCOLORKEY ddckey;
D3DDEVICEDESC7 d3dcaps;
/* Test loading of texture subrectangle with a mipmap surface. */ /* Test loading of texture subrectangle with a mipmap surface. */
memset(texture_levels, 0, sizeof(texture_levels)); memset(texture_levels, 0, sizeof(texture_levels));
...@@ -1858,270 +1859,281 @@ static void DeviceLoadTest() ...@@ -1858,270 +1859,281 @@ static void DeviceLoadTest()
IDirectDrawSurface7_Release(texture_levels[1][0]); IDirectDrawSurface7_Release(texture_levels[1][0]);
memset(texture_levels, 0, sizeof(texture_levels)); memset(texture_levels, 0, sizeof(texture_levels));
/* Test loading mipmapped cubemap texture subrectangle from another similar texture. */ memset(&d3dcaps, 0, sizeof(d3dcaps));
for (i = 0; i < 2; i++) hr = IDirect3DDevice7_GetCaps(lpD3DDevice, &d3dcaps);
{ ok(hr == D3D_OK, "IDirect3DDevice7_GetCaps returned %08x\n", hr);
memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_ALLFACES;
ddsd.dwWidth = 128;
ddsd.dwHeight = 128;
U4(ddsd).ddpfPixelFormat.dwSize = sizeof(U4(ddsd).ddpfPixelFormat);
U4(ddsd).ddpfPixelFormat.dwFlags = DDPF_RGB;
U1(U4(ddsd).ddpfPixelFormat).dwRGBBitCount = 32;
U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00FF0000;
U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000FF00;
U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000FF;
hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &cube_face_levels[i][0][0], NULL);
ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
if (FAILED(hr)) goto out;
flags = DDSCAPS2_CUBEMAP_NEGATIVEX;
for (i1 = 1; i1 < 6; i1++, flags <<= 1)
{
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | flags;
hr = IDirectDrawSurface7_GetAttachedSurface(cube_face_levels[i][0][0], &ddsd.ddsCaps, &cube_face_levels[i][i1][0]);
ok(hr == DD_OK, "GetAttachedSurface returned %08x\n", hr);
if (FAILED(hr)) goto out;
}
for (i1 = 0; i1 < 6; i1++) if (!(d3dcaps.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_CUBEMAP))
{
skip("No cubemap support\n");
}
else
{
/* Test loading mipmapped cubemap texture subrectangle from another similar texture. */
for (i = 0; i < 2; i++)
{ {
/* Check the number of created mipmaps */
memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
ddsd.dwSize = sizeof(ddsd); ddsd.dwSize = sizeof(ddsd);
hr = IDirectDrawSurface7_GetSurfaceDesc(cube_face_levels[i][i1][0], &ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
ok(hr==DD_OK,"IDirectDrawSurface7_GetSurfaceDesc returned: %x\n",hr); ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
ok(U2(ddsd).dwMipMapCount == 8, "unexpected mip count %u\n", U2(ddsd).dwMipMapCount); ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_ALLFACES;
if (U2(ddsd).dwMipMapCount != 8) goto out; ddsd.dwWidth = 128;
ddsd.dwHeight = 128;
U4(ddsd).ddpfPixelFormat.dwSize = sizeof(U4(ddsd).ddpfPixelFormat);
U4(ddsd).ddpfPixelFormat.dwFlags = DDPF_RGB;
U1(U4(ddsd).ddpfPixelFormat).dwRGBBitCount = 32;
U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00FF0000;
U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000FF00;
U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000FF;
hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &cube_face_levels[i][0][0], NULL);
ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
if (FAILED(hr)) goto out;
for (i2 = 1; i2 < 8; i2++) flags = DDSCAPS2_CUBEMAP_NEGATIVEX;
for (i1 = 1; i1 < 6; i1++, flags <<= 1)
{ {
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP; ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL; ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | flags;
hr = IDirectDrawSurface7_GetAttachedSurface(cube_face_levels[i][i1][i2 - 1], &ddsd.ddsCaps, &cube_face_levels[i][i1][i2]); hr = IDirectDrawSurface7_GetAttachedSurface(cube_face_levels[i][0][0], &ddsd.ddsCaps, &cube_face_levels[i][i1][0]);
ok(hr == DD_OK, "GetAttachedSurface returned %08x\n", hr); ok(hr == DD_OK, "GetAttachedSurface returned %08x\n", hr);
if (FAILED(hr)) goto out; if (FAILED(hr)) goto out;
} }
}
}
for (i = 0; i < 6; i++) for (i1 = 0; i1 < 6; i1++)
for (i1 = 0; i1 < 8; i1++)
{
memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
ddsd.dwSize = sizeof(ddsd);
hr = IDirectDrawSurface7_Lock(cube_face_levels[0][i][i1], NULL, &ddsd, DDLOCK_WAIT, NULL);
ok(hr==DD_OK, "IDirectDrawSurface7_Lock returned: %x\n",hr);
if (FAILED(hr)) goto out;
for (y = 0 ; y < ddsd.dwHeight; y++)
{ {
DWORD *textureRow = (DWORD*)((char*)ddsd.lpSurface + y * U1(ddsd).lPitch); /* Check the number of created mipmaps */
memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
ddsd.dwSize = sizeof(ddsd);
hr = IDirectDrawSurface7_GetSurfaceDesc(cube_face_levels[i][i1][0], &ddsd);
ok(hr==DD_OK,"IDirectDrawSurface7_GetSurfaceDesc returned: %x\n",hr);
ok(U2(ddsd).dwMipMapCount == 8, "unexpected mip count %u\n", U2(ddsd).dwMipMapCount);
if (U2(ddsd).dwMipMapCount != 8) goto out;
for (x = 0; x < ddsd.dwWidth; x++) for (i2 = 1; i2 < 8; i2++)
{ {
/* face number in low 4 bits of red, x stored in green component, y in blue. */ ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP;
DWORD color = 0xf00000 | (i << 16) | (x << 8) | y; ddsd.ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL;
*textureRow++ = color; hr = IDirectDrawSurface7_GetAttachedSurface(cube_face_levels[i][i1][i2 - 1], &ddsd.ddsCaps, &cube_face_levels[i][i1][i2]);
ok(hr == DD_OK, "GetAttachedSurface returned %08x\n", hr);
if (FAILED(hr)) goto out;
} }
} }
hr = IDirectDrawSurface7_Unlock(cube_face_levels[0][i][i1], NULL);
ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n",hr);
} }
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
for (i1 = 0; i1 < 8; i1++) for (i1 = 0; i1 < 8; i1++)
{ {
memset(&ddbltfx, 0, sizeof(ddbltfx)); memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
ddbltfx.dwSize = sizeof(ddbltfx); ddsd.dwSize = sizeof(ddsd);
U5(ddbltfx).dwFillColor = 0; hr = IDirectDrawSurface7_Lock(cube_face_levels[0][i][i1], NULL, &ddsd, DDLOCK_WAIT, NULL);
hr = IDirectDrawSurface7_Blt(cube_face_levels[1][i][i1], NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); ok(hr==DD_OK, "IDirectDrawSurface7_Lock returned: %x\n",hr);
ok(hr == DD_OK, "IDirectDrawSurface7_Blt failed with %08x\n", hr); if (FAILED(hr)) goto out;
}
loadpoint.x = loadpoint.y = 10; for (y = 0 ; y < ddsd.dwHeight; y++)
loadrect.left = 30; {
loadrect.top = 20; DWORD *textureRow = (DWORD*)((char*)ddsd.lpSurface + y * U1(ddsd).lPitch);
loadrect.right = 93;
loadrect.bottom = 52;
hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[1][0][0], &loadpoint, cube_face_levels[0][0][0], &loadrect, for (x = 0; x < ddsd.dwWidth; x++)
DDSCAPS2_CUBEMAP_ALLFACES); {
ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr); /* face number in low 4 bits of red, x stored in green component, y in blue. */
DWORD color = 0xf00000 | (i << 16) | (x << 8) | y;
*textureRow++ = color;
}
}
hr = IDirectDrawSurface7_Unlock(cube_face_levels[0][i][i1], NULL);
ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n",hr);
}
for (i = 0; i < 6; i++)
for (i1 = 0; i1 < 8; i1++)
{
memset(&ddbltfx, 0, sizeof(ddbltfx));
ddbltfx.dwSize = sizeof(ddbltfx);
U5(ddbltfx).dwFillColor = 0;
hr = IDirectDrawSurface7_Blt(cube_face_levels[1][i][i1], NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
ok(hr == DD_OK, "IDirectDrawSurface7_Blt failed with %08x\n", hr);
}
for (i = 0; i < 6; i++)
{
loadpoint.x = loadpoint.y = 10; loadpoint.x = loadpoint.y = 10;
loadrect.left = 30; loadrect.left = 30;
loadrect.top = 20; loadrect.top = 20;
loadrect.right = 93; loadrect.right = 93;
loadrect.bottom = 52; loadrect.bottom = 52;
for (i1 = 0; i1 < 8; i1++) hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[1][0][0], &loadpoint, cube_face_levels[0][0][0], &loadrect,
{ DDSCAPS2_CUBEMAP_ALLFACES);
diff_count = 0; ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr);
diff_count2 = 0;
memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); for (i = 0; i < 6; i++)
ddsd.dwSize = sizeof(ddsd); {
hr = IDirectDrawSurface7_Lock(cube_face_levels[1][i][i1], NULL, &ddsd, DDLOCK_WAIT, NULL); loadpoint.x = loadpoint.y = 10;
ok(hr==DD_OK, "IDirectDrawSurface7_Lock returned: %x\n",hr); loadrect.left = 30;
if (FAILED(hr)) goto out; loadrect.top = 20;
loadrect.right = 93;
loadrect.bottom = 52;
for (y = 0 ; y < ddsd.dwHeight; y++) for (i1 = 0; i1 < 8; i1++)
{ {
DWORD *textureRow = (DWORD*)((char*)ddsd.lpSurface + y * U1(ddsd).lPitch); diff_count = 0;
diff_count2 = 0;
for (x = 0; x < ddsd.dwWidth; x++) memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
ddsd.dwSize = sizeof(ddsd);
hr = IDirectDrawSurface7_Lock(cube_face_levels[1][i][i1], NULL, &ddsd, DDLOCK_WAIT, NULL);
ok(hr==DD_OK, "IDirectDrawSurface7_Lock returned: %x\n",hr);
if (FAILED(hr)) goto out;
for (y = 0 ; y < ddsd.dwHeight; y++)
{ {
DWORD color = *textureRow++; DWORD *textureRow = (DWORD*)((char*)ddsd.lpSurface + y * U1(ddsd).lPitch);
if (x < loadpoint.x || x >= loadpoint.x + loadrect.right - loadrect.left || for (x = 0; x < ddsd.dwWidth; x++)
y < loadpoint.y || y >= loadpoint.y + loadrect.bottom - loadrect.top)
{
if (color & 0xffffff) diff_count++;
}
else
{ {
DWORD r = (color & 0xff0000) >> 16; DWORD color = *textureRow++;
DWORD g = (color & 0xff00) >> 8;
DWORD b = (color & 0xff);
if (r != (0xf0 | i) || g != x + loadrect.left - loadpoint.x || if (x < loadpoint.x || x >= loadpoint.x + loadrect.right - loadrect.left ||
b != y + loadrect.top - loadpoint.y) diff_count++; y < loadpoint.y || y >= loadpoint.y + loadrect.bottom - loadrect.top)
} {
if (color & 0xffffff) diff_count++;
}
else
{
DWORD r = (color & 0xff0000) >> 16;
DWORD g = (color & 0xff00) >> 8;
DWORD b = (color & 0xff);
/* This codepath is for software RGB device. It has what looks like some weird off by one errors, but may if (r != (0xf0 | i) || g != x + loadrect.left - loadpoint.x ||
technically be correct as it's not precisely defined by docs. */ b != y + loadrect.top - loadpoint.y) diff_count++;
if (x < loadpoint.x || x >= loadpoint.x + loadrect.right - loadrect.left || }
y < loadpoint.y || y >= loadpoint.y + loadrect.bottom - loadrect.top + 1)
{
if (color & 0xffffff) diff_count2++;
}
else
{
DWORD r = (color & 0xff0000) >> 16;
DWORD g = (color & 0xff00) >> 8;
DWORD b = (color & 0xff);
if (r != (0xf0 | i) || !IS_VALUE_NEAR(g, x + loadrect.left - loadpoint.x) || /* This codepath is for software RGB device. It has what looks like some weird off by one errors, but may
!IS_VALUE_NEAR(b, y + loadrect.top - loadpoint.y)) diff_count2++; technically be correct as it's not precisely defined by docs. */
if (x < loadpoint.x || x >= loadpoint.x + loadrect.right - loadrect.left ||
y < loadpoint.y || y >= loadpoint.y + loadrect.bottom - loadrect.top + 1)
{
if (color & 0xffffff) diff_count2++;
}
else
{
DWORD r = (color & 0xff0000) >> 16;
DWORD g = (color & 0xff00) >> 8;
DWORD b = (color & 0xff);
if (r != (0xf0 | i) || !IS_VALUE_NEAR(g, x + loadrect.left - loadpoint.x) ||
!IS_VALUE_NEAR(b, y + loadrect.top - loadpoint.y)) diff_count2++;
}
} }
} }
}
hr = IDirectDrawSurface7_Unlock(cube_face_levels[1][i][i1], NULL); hr = IDirectDrawSurface7_Unlock(cube_face_levels[1][i][i1], NULL);
ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n",hr); ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n",hr);
ok(diff_count == 0 || diff_count2 == 0, ok(diff_count == 0 || diff_count2 == 0,
"Unexpected destination texture level pixels; %u differences at face %x level %d\n", "Unexpected destination texture level pixels; %u differences at face %x level %d\n",
MIN(diff_count, diff_count2), i, i1); MIN(diff_count, diff_count2), i, i1);
loadpoint.x /= 2; loadpoint.x /= 2;
loadpoint.y /= 2; loadpoint.y /= 2;
loadrect.top /= 2; loadrect.top /= 2;
loadrect.left /= 2; loadrect.left /= 2;
loadrect.right = (loadrect.right + 1) / 2; loadrect.right = (loadrect.right + 1) / 2;
loadrect.bottom = (loadrect.bottom + 1) / 2; loadrect.bottom = (loadrect.bottom + 1) / 2;
}
} }
}
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
for (i1 = 5; i1 >= 0; i1--) for (i1 = 5; i1 >= 0; i1--)
for (i2 = 7; i2 >= 0; i2--) for (i2 = 7; i2 >= 0; i2--)
{ {
if (cube_face_levels[i][i1][i2]) IDirectDrawSurface7_Release(cube_face_levels[i][i1][i2]); if (cube_face_levels[i][i1][i2]) IDirectDrawSurface7_Release(cube_face_levels[i][i1][i2]);
} }
memset(cube_face_levels, 0, sizeof(cube_face_levels)); memset(cube_face_levels, 0, sizeof(cube_face_levels));
/* Test cubemap loading from regular texture. */ /* Test cubemap loading from regular texture. */
memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
ddsd.dwSize = sizeof(ddsd); ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX; ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_ALLFACES; ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_ALLFACES;
ddsd.dwWidth = 128; ddsd.dwWidth = 128;
ddsd.dwHeight = 128; ddsd.dwHeight = 128;
hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &cube_face_levels[0][0][0], NULL); hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &cube_face_levels[0][0][0], NULL);
ok(hr==DD_OK,"CreateSurface returned: %x\n",hr); ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
if (FAILED(hr)) goto out; if (FAILED(hr)) goto out;
memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
ddsd.dwSize = sizeof(ddsd); ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE; ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.dwWidth = 128; ddsd.dwWidth = 128;
ddsd.dwHeight = 128; ddsd.dwHeight = 128;
hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &texture_levels[0][0], NULL); hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &texture_levels[0][0], NULL);
ok(hr==DD_OK,"CreateSurface returned: %x\n",hr); ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
if (FAILED(hr)) goto out; if (FAILED(hr)) goto out;
hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[0][0][0], NULL, texture_levels[0][0], NULL, hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[0][0][0], NULL, texture_levels[0][0], NULL,
DDSCAPS2_CUBEMAP_ALLFACES); DDSCAPS2_CUBEMAP_ALLFACES);
ok(hr==DDERR_INVALIDPARAMS, "IDirect3DDevice7_Load returned: %x\n",hr); ok(hr==DDERR_INVALIDPARAMS, "IDirect3DDevice7_Load returned: %x\n",hr);
IDirectDrawSurface7_Release(cube_face_levels[0][0][0]); IDirectDrawSurface7_Release(cube_face_levels[0][0][0]);
memset(cube_face_levels, 0, sizeof(cube_face_levels)); memset(cube_face_levels, 0, sizeof(cube_face_levels));
IDirectDrawSurface7_Release(texture_levels[0][0]); IDirectDrawSurface7_Release(texture_levels[0][0]);
memset(texture_levels, 0, sizeof(texture_levels)); memset(texture_levels, 0, sizeof(texture_levels));
/* Test cubemap loading from cubemap with different number of faces. */ /* Test cubemap loading from cubemap with different number of faces. */
memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
ddsd.dwSize = sizeof(ddsd); ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX; ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEX; ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEX;
ddsd.dwWidth = 128; ddsd.dwWidth = 128;
ddsd.dwHeight = 128; ddsd.dwHeight = 128;
hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &cube_face_levels[0][0][0], NULL); hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &cube_face_levels[0][0][0], NULL);
ok(hr==DD_OK,"CreateSurface returned: %x\n",hr); ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
if (FAILED(hr)) goto out; if (FAILED(hr)) goto out;
memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
ddsd.dwSize = sizeof(ddsd); ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX; ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX;
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEX | DDSCAPS2_CUBEMAP_POSITIVEY; ddsd.ddsCaps.dwCaps2 = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEX | DDSCAPS2_CUBEMAP_POSITIVEY;
ddsd.dwWidth = 128; ddsd.dwWidth = 128;
ddsd.dwHeight = 128; ddsd.dwHeight = 128;
hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &cube_face_levels[1][0][0], NULL); hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &cube_face_levels[1][0][0], NULL);
ok(hr==DD_OK,"CreateSurface returned: %x\n",hr); ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
if (FAILED(hr)) goto out; if (FAILED(hr)) goto out;
/* INVALIDPARAMS tests currently would fail because wine doesn't support partial cube faces /* INVALIDPARAMS tests currently would fail because wine doesn't support partial cube faces
(the above created cubemaps will have all faces. */ (the above created cubemaps will have all faces. */
hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[0][0][0], NULL, cube_face_levels[1][0][0], NULL, hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[0][0][0], NULL, cube_face_levels[1][0][0], NULL,
DDSCAPS2_CUBEMAP_ALLFACES); DDSCAPS2_CUBEMAP_ALLFACES);
todo_wine ok(hr==DDERR_INVALIDPARAMS, "IDirect3DDevice7_Load returned: %x\n",hr); todo_wine ok(hr==DDERR_INVALIDPARAMS, "IDirect3DDevice7_Load returned: %x\n",hr);
hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[0][0][0], NULL, cube_face_levels[1][0][0], NULL, hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[0][0][0], NULL, cube_face_levels[1][0][0], NULL,
DDSCAPS2_CUBEMAP_POSITIVEX | DDSCAPS2_CUBEMAP_POSITIVEY); DDSCAPS2_CUBEMAP_POSITIVEX | DDSCAPS2_CUBEMAP_POSITIVEY);
todo_wine ok(hr==DDERR_INVALIDPARAMS, "IDirect3DDevice7_Load returned: %x\n",hr); todo_wine ok(hr==DDERR_INVALIDPARAMS, "IDirect3DDevice7_Load returned: %x\n",hr);
hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[0][0][0], NULL, cube_face_levels[1][0][0], NULL, hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[0][0][0], NULL, cube_face_levels[1][0][0], NULL,
DDSCAPS2_CUBEMAP_POSITIVEX); DDSCAPS2_CUBEMAP_POSITIVEX);
todo_wine ok(hr==DDERR_INVALIDPARAMS, "IDirect3DDevice7_Load returned: %x\n",hr); todo_wine ok(hr==DDERR_INVALIDPARAMS, "IDirect3DDevice7_Load returned: %x\n",hr);
hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[1][0][0], NULL, cube_face_levels[0][0][0], NULL, hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[1][0][0], NULL, cube_face_levels[0][0][0], NULL,
DDSCAPS2_CUBEMAP_ALLFACES); DDSCAPS2_CUBEMAP_ALLFACES);
ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr); ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr);
hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[1][0][0], NULL, cube_face_levels[0][0][0], NULL, hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[1][0][0], NULL, cube_face_levels[0][0][0], NULL,
DDSCAPS2_CUBEMAP_POSITIVEX); DDSCAPS2_CUBEMAP_POSITIVEX);
ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr); ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr);
hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[1][0][0], NULL, cube_face_levels[0][0][0], NULL, hr = IDirect3DDevice7_Load(lpD3DDevice, cube_face_levels[1][0][0], NULL, cube_face_levels[0][0][0], NULL,
DDSCAPS2_CUBEMAP_POSITIVEZ); DDSCAPS2_CUBEMAP_POSITIVEZ);
ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr); ok(hr==D3D_OK, "IDirect3DDevice7_Load returned: %x\n",hr);
IDirectDrawSurface7_Release(cube_face_levels[0][0][0]); IDirectDrawSurface7_Release(cube_face_levels[0][0][0]);
IDirectDrawSurface7_Release(cube_face_levels[1][0][0]); IDirectDrawSurface7_Release(cube_face_levels[1][0][0]);
memset(cube_face_levels, 0, sizeof(cube_face_levels)); memset(cube_face_levels, 0, sizeof(cube_face_levels));
}
/* Test texture loading with different mip level count (larger levels match, smaller levels missing in destination. */ /* Test texture loading with different mip level count (larger levels match, smaller levels missing in destination. */
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
......
...@@ -1495,7 +1495,7 @@ HRESULT WINAPI CubeTestLvl1Enum(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *de ...@@ -1495,7 +1495,7 @@ HRESULT WINAPI CubeTestLvl1Enum(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *de
static void CubeMapTest(void) static void CubeMapTest(void)
{ {
IDirectDraw7 *dd7 = NULL; IDirectDraw7 *dd7 = NULL;
IDirectDrawSurface7 *cubemap; IDirectDrawSurface7 *cubemap = NULL;
DDSURFACEDESC2 ddsd; DDSURFACEDESC2 ddsd;
HRESULT hr; HRESULT hr;
UINT num = 0; UINT num = 0;
...@@ -1503,6 +1503,7 @@ static void CubeMapTest(void) ...@@ -1503,6 +1503,7 @@ static void CubeMapTest(void)
hr = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw7, (void **) &dd7); hr = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw7, (void **) &dd7);
ok(hr == DD_OK, "IDirectDraw::QueryInterface returned %08x\n", hr); ok(hr == DD_OK, "IDirectDraw::QueryInterface returned %08x\n", hr);
if (FAILED(hr)) goto err;
memset(&ddsd, 0, sizeof(ddsd)); memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd); ddsd.dwSize = sizeof(ddsd);
...@@ -1521,7 +1522,11 @@ static void CubeMapTest(void) ...@@ -1521,7 +1522,11 @@ static void CubeMapTest(void)
U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x001F; U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x001F;
hr = IDirectDraw7_CreateSurface(dd7, &ddsd, &cubemap, NULL); hr = IDirectDraw7_CreateSurface(dd7, &ddsd, &cubemap, NULL);
ok(hr == DD_OK, "IDirectDraw7::CreateSurface returned %08x\n", hr); if (FAILED(hr))
{
skip("Can't create cubemap surface\n");
goto err;
}
hr = IDirectDrawSurface7_GetSurfaceDesc(cubemap, &ddsd); hr = IDirectDrawSurface7_GetSurfaceDesc(cubemap, &ddsd);
ok(hr == DD_OK, "IDirectDrawSurface7_GetSurfaceDesc returned %08x\n", hr); ok(hr == DD_OK, "IDirectDrawSurface7_GetSurfaceDesc returned %08x\n", hr);
...@@ -1603,7 +1608,8 @@ static void CubeMapTest(void) ...@@ -1603,7 +1608,8 @@ static void CubeMapTest(void)
ok(hr == DD_OK, "IDirectDraw_EnumSurfaces returned %08x\n", hr); ok(hr == DD_OK, "IDirectDraw_EnumSurfaces returned %08x\n", hr);
ok(ctx.count == 0, "%d surfaces enumerated, expected 0\n", ctx.count); ok(ctx.count == 0, "%d surfaces enumerated, expected 0\n", ctx.count);
IDirectDraw7_Release(dd7); err:
if (dd7) IDirectDraw7_Release(dd7);
} }
static void test_lockrect_invalid(void) static void test_lockrect_invalid(void)
......
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