ddraw: Reject creating primary surfaces with DDSCAPS_TEXTURE.

This commit is contained in:
Henri Verbeet 2013-12-04 09:49:37 +01:00 committed by Alexandre Julliard
parent a9afc9356e
commit 6cba2285bc

View File

@ -5627,14 +5627,22 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
if ((desc->ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD) || !desc->lpSurface) if ((desc->ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD) || !desc->lpSurface)
desc->dwFlags &= ~DDSD_LPSURFACE; desc->dwFlags &= ~DDSD_LPSURFACE;
if ((desc->ddsCaps.dwCaps & (DDSCAPS_FLIP | DDSCAPS_PRIMARYSURFACE)) if (desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
== (DDSCAPS_FLIP | DDSCAPS_PRIMARYSURFACE) {
&& !(ddraw->cooperative_level & DDSCL_EXCLUSIVE)) if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
{
WARN("Tried to create a primary surface with DDSCAPS_TEXTURE.\n");
HeapFree(GetProcessHeap(), 0, texture);
return DDERR_INVALIDCAPS;
}
if ((desc->ddsCaps.dwCaps & DDSCAPS_FLIP) && !(ddraw->cooperative_level & DDSCL_EXCLUSIVE))
{ {
WARN("Tried to create a flippable primary surface without DDSCL_EXCLUSIVE.\n"); WARN("Tried to create a flippable primary surface without DDSCL_EXCLUSIVE.\n");
HeapFree(GetProcessHeap(), 0, texture); HeapFree(GetProcessHeap(), 0, texture);
return DDERR_NOEXCLUSIVEMODE; return DDERR_NOEXCLUSIVEMODE;
} }
}
/* This is a special case in ddrawex, but not allowed in ddraw. */ /* This is a special case in ddrawex, but not allowed in ddraw. */
if ((desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY)) if ((desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))