ddraw: Move the location validation from CreateSurface() to ddraw_surface_create_texture().

This commit is contained in:
Henri Verbeet 2013-11-27 11:04:49 +01:00 committed by Alexandre Julliard
parent 4b3db52b53
commit 559229aa10
2 changed files with 8 additions and 8 deletions

View File

@ -2814,7 +2814,6 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
struct ddraw_surface *object = NULL; struct ddraw_surface *object = NULL;
HRESULT hr; HRESULT hr;
DDSURFACEDESC2 desc2; DDSURFACEDESC2 desc2;
const DWORD sysvidmem = DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY;
TRACE("ddraw %p, surface_desc %p, surface %p, outer_unknown %p.\n", ddraw, DDSD, surface, UnkOuter); TRACE("ddraw %p, surface_desc %p, surface %p, outer_unknown %p.\n", ddraw, DDSD, surface, UnkOuter);
@ -2870,13 +2869,6 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
return DDERR_INVALIDCAPS; return DDERR_INVALIDCAPS;
} }
/* This is a special case in ddrawex, but not allowed in ddraw. */
if ((DDSD->ddsCaps.dwCaps & sysvidmem) == sysvidmem)
{
WARN("Tried to create a surface in both system and video memory.\n");
return DDERR_INVALIDCAPS;
}
/* Modify some flags */ /* Modify some flags */
copy_to_surfacedesc2(&desc2, DDSD); copy_to_surfacedesc2(&desc2, DDSD);

View File

@ -5608,6 +5608,14 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
DDRAW_dump_surface_desc(desc); DDRAW_dump_surface_desc(desc);
} }
/* This is a special case in ddrawex, but not allowed in ddraw. */
if ((desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
== (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
{
WARN("Tried to create a surface in both system and video memory.\n");
return DDERR_INVALIDCAPS;
}
if ((desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES) if ((desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES)
&& !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)) && !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP))
{ {