ddraw[ex]: Show a caps handling difference.

This commit is contained in:
Stefan Dösinger 2009-01-09 12:32:24 +01:00 committed by Alexandre Julliard
parent 60039a5ba8
commit ae4e824423
3 changed files with 42 additions and 0 deletions

View File

@ -2432,6 +2432,7 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
LONG extra_surfaces = 0; LONG extra_surfaces = 0;
DDSURFACEDESC2 desc2; DDSURFACEDESC2 desc2;
WINED3DDISPLAYMODE Mode; WINED3DDISPLAYMODE Mode;
const DWORD sysvidmem = DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
TRACE("(%p)->(%p,%p,%p)\n", This, DDSD, Surf, UnkOuter); TRACE("(%p)->(%p,%p,%p)\n", This, DDSD, Surf, UnkOuter);
@ -2490,6 +2491,16 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DDERR_INVALIDCAPS; return DDERR_INVALIDCAPS;
} }
if((DDSD->ddsCaps.dwCaps & sysvidmem) == sysvidmem)
{
/* This is a special switch in ddrawex.dll, but not allowed in ddraw.dll */
WARN("Application tries to put the surface in both system and video memory\n");
LeaveCriticalSection(&ddraw_cs);
*Surf = NULL;
return DDERR_INVALIDCAPS;
}
/* Check cube maps but only if the size includes them */ /* Check cube maps but only if the size includes them */
if (DDSD->dwSize >= sizeof(DDSURFACEDESC2)) if (DDSD->dwSize >= sizeof(DDSURFACEDESC2))
{ {

View File

@ -2746,6 +2746,16 @@ static void SurfaceCapsTest(void)
IDirectDraw7_Release(dd7); IDirectDraw7_Release(dd7);
} }
memset(&create, 0, sizeof(create));
create.dwSize = sizeof(create);
create.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
create.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_VIDEOMEMORY;
create.dwWidth = 64;
create.dwHeight = 64;
hr = IDirectDraw_CreateSurface(lpDD, &create, &surface1, NULL);
ok(hr == DDERR_INVALIDCAPS, "Creating a SYSMEM | VIDMEM surface returned 0x%08x, expected DDERR_INVALIDCAPS\n", hr);
if(surface1) IDirectDrawSurface_Release(surface1);
} }
static BOOL can_create_primary_surface(void) static BOOL can_create_primary_surface(void)

View File

@ -147,6 +147,26 @@ static void GetDCTest(void)
IDirectDraw_Release(dd1); IDirectDraw_Release(dd1);
} }
static void CapsTest(void)
{
DDSURFACEDESC ddsd;
IDirectDraw *dd1 = createDD();
IDirectDrawSurface *surf;
HRESULT hr;
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_VIDEOMEMORY;
ddsd.dwWidth = 64;
ddsd.dwHeight = 64;
hr = IDirectDraw_CreateSurface(dd1, &ddsd, &surf, NULL);
todo_wine ok(hr == DD_OK, "Creating a SYSMEM | VIDMEM surface returned 0x%08x, expected DD_OK\n", hr);
if(surf) IDirectDrawSurface_Release(surf);
IDirectDraw_Release(dd1);
}
START_TEST(surface) START_TEST(surface)
{ {
IClassFactory *classfactory = NULL; IClassFactory *classfactory = NULL;
@ -169,6 +189,7 @@ START_TEST(surface)
ok(hr == S_OK, "Failed to create a IDirectDrawFactory\n"); ok(hr == S_OK, "Failed to create a IDirectDrawFactory\n");
GetDCTest(); GetDCTest();
CapsTest();
if(factory) { if(factory) {
ref = IDirectDrawFactory_Release(factory); ref = IDirectDrawFactory_Release(factory);