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

oldstable
Henri Verbeet 2013-11-26 10:41:51 +01:00 committed by Alexandre Julliard
parent f0f38d9b8d
commit 995ff1d3f8
2 changed files with 18 additions and 24 deletions

View File

@ -2877,30 +2877,6 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
return DDERR_INVALIDCAPS;
}
/* Check cube maps but only if the size includes them */
if (DDSD->dwSize >= sizeof(DDSURFACEDESC2))
{
if(DDSD->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES &&
!(DDSD->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP))
{
WARN("Cube map faces requested without cube map flag\n");
return DDERR_INVALIDCAPS;
}
if(DDSD->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP &&
(DDSD->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES) == 0)
{
WARN("Cube map without faces requested\n");
return DDERR_INVALIDPARAMS;
}
/* Quick tests confirm those can be created, but we don't do that yet */
if(DDSD->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP &&
(DDSD->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES) != DDSCAPS2_CUBEMAP_ALLFACES)
{
FIXME("Partial cube maps not supported yet\n");
}
}
/* Modify some flags */
copy_to_surfacedesc2(&desc2, DDSD);

View File

@ -5608,6 +5608,24 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
DDRAW_dump_surface_desc(desc);
}
if ((desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES)
&& !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP))
{
WARN("Cube map faces requested without cube map flag.\n");
return DDERR_INVALIDCAPS;
}
if ((desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
&& !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES))
{
WARN("Cube map without faces requested.\n");
return DDERR_INVALIDPARAMS;
}
if ((desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
&& (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES) != DDSCAPS2_CUBEMAP_ALLFACES)
FIXME("Partial cube maps not implemented.\n");
if (desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))
{
if (!(desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))