ddraw[ex]: Show a caps handling difference.
This commit is contained in:
parent
60039a5ba8
commit
ae4e824423
|
@ -2432,6 +2432,7 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
|
|||
LONG extra_surfaces = 0;
|
||||
DDSURFACEDESC2 desc2;
|
||||
WINED3DDISPLAYMODE Mode;
|
||||
const DWORD sysvidmem = DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
|
||||
|
||||
TRACE("(%p)->(%p,%p,%p)\n", This, DDSD, Surf, UnkOuter);
|
||||
|
||||
|
@ -2490,6 +2491,16 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
|
|||
LeaveCriticalSection(&ddraw_cs);
|
||||
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 */
|
||||
if (DDSD->dwSize >= sizeof(DDSURFACEDESC2))
|
||||
{
|
||||
|
|
|
@ -2746,6 +2746,16 @@ static void SurfaceCapsTest(void)
|
|||
|
||||
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)
|
||||
|
|
|
@ -147,6 +147,26 @@ static void GetDCTest(void)
|
|||
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)
|
||||
{
|
||||
IClassFactory *classfactory = NULL;
|
||||
|
@ -169,6 +189,7 @@ START_TEST(surface)
|
|||
ok(hr == S_OK, "Failed to create a IDirectDrawFactory\n");
|
||||
|
||||
GetDCTest();
|
||||
CapsTest();
|
||||
|
||||
if(factory) {
|
||||
ref = IDirectDrawFactory_Release(factory);
|
||||
|
|
Loading…
Reference in New Issue