Commit 1736431c authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Allow DDSCAPS_FLIP without DDSCAPS_PRIMARYSURFACE.

parent 4e02cc3a
......@@ -5718,39 +5718,60 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
/* Ensure DDSD_CAPS is always set. */
desc->dwFlags |= DDSD_CAPS;
if (desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
if (desc->ddsCaps.dwCaps & DDSCAPS_FLIP)
{
DWORD flippable = desc->ddsCaps.dwCaps & (DDSCAPS_FLIP | DDSCAPS_COMPLEX);
if (!(desc->dwFlags & DDSD_BACKBUFFERCOUNT) || !desc->u5.dwBackBufferCount)
{
WARN("Tried to create a flippable surface without any back buffers.\n");
HeapFree(GetProcessHeap(), 0, texture);
return DDERR_INVALIDCAPS;
}
if (!(desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX))
{
WARN("Tried to create a flippable surface without DDSCAPS_COMPLEX.\n");
HeapFree(GetProcessHeap(), 0, texture);
return DDERR_INVALIDCAPS;
}
if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
{
WARN("Tried to create a primary surface with DDSCAPS_TEXTURE.\n");
FIXME("Flippable textures not implemented.\n");
HeapFree(GetProcessHeap(), 0, texture);
return DDERR_INVALIDCAPS;
}
}
else
{
if (desc->dwFlags & DDSD_BACKBUFFERCOUNT)
{
WARN("Tried to specify a back buffer count for a non-flippable surface.\n");
HeapFree(GetProcessHeap(), 0, texture);
return DDERR_INVALIDCAPS;
}
}
if (flippable)
if (desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
{
if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
{
if (flippable != (DDSCAPS_FLIP | DDSCAPS_COMPLEX))
{
WARN("Tried to create a flippable primary surface without both DDSCAPS_FLIP and DDSCAPS_COMPLEX.\n");
HeapFree(GetProcessHeap(), 0, texture);
return DDERR_INVALIDCAPS;
}
WARN("Tried to create a primary surface with DDSCAPS_TEXTURE.\n");
HeapFree(GetProcessHeap(), 0, texture);
return DDERR_INVALIDCAPS;
}
if (!(desc->dwFlags & DDSD_BACKBUFFERCOUNT) || !desc->u5.dwBackBufferCount)
{
WARN("Tried to create a flippable primary surface without any back buffers.\n");
HeapFree(GetProcessHeap(), 0, texture);
return DDERR_INVALIDCAPS;
}
if ((desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX) && !(desc->ddsCaps.dwCaps & DDSCAPS_FLIP))
{
WARN("Tried to create a flippable primary surface without both DDSCAPS_FLIP and DDSCAPS_COMPLEX.\n");
HeapFree(GetProcessHeap(), 0, texture);
return DDERR_INVALIDCAPS;
}
if (!(ddraw->cooperative_level & DDSCL_EXCLUSIVE))
{
WARN("Tried to create a flippable primary surface without DDSCL_EXCLUSIVE.\n");
HeapFree(GetProcessHeap(), 0, texture);
return DDERR_NOEXCLUSIVEMODE;
}
if ((desc->ddsCaps.dwCaps & DDSCAPS_FLIP) && !(ddraw->cooperative_level & DDSCL_EXCLUSIVE))
{
WARN("Tried to create a flippable primary surface without DDSCL_EXCLUSIVE.\n");
HeapFree(GetProcessHeap(), 0, texture);
return DDERR_NOEXCLUSIVEMODE;
}
}
......@@ -5853,12 +5874,13 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
return DDERR_INVALIDPARAMS;
}
if (desc->ddsCaps.dwCaps & DDSCAPS_FLIP)
desc->ddsCaps.dwCaps |= DDSCAPS_FRONTBUFFER;
if (desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
{
/* The first surface is a front buffer, the back buffers are created
* afterwards. */
if (desc->ddsCaps.dwCaps & DDSCAPS_FLIP)
desc->ddsCaps.dwCaps |= DDSCAPS_FRONTBUFFER;
desc->ddsCaps.dwCaps |= DDSCAPS_VISIBLE;
if (ddraw->cooperative_level & DDSCL_EXCLUSIVE)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment