wined3d: Use a separate flag for discarded surfaces.

This commit is contained in:
Matteo Bruni 2012-02-02 15:08:58 +01:00 committed by Alexandre Julliard
parent fc0d21aa22
commit b51a657626
4 changed files with 8 additions and 7 deletions

View File

@ -4862,7 +4862,7 @@ HRESULT CDECL wined3d_device_set_depth_stencil(struct wined3d_device *device, st
if (device->swapchains[0]->desc.flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
|| prev->flags & SFLAG_DISCARD)
{
surface_modify_ds_location(prev, SFLAG_LOST,
surface_modify_ds_location(prev, SFLAG_DISCARDED,
prev->resource.width, prev->resource.height);
if (prev == device->onscreen_depth_stencil)
{

View File

@ -762,7 +762,7 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface)
}
if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
surface->flags |= SFLAG_LOST;
surface->flags |= SFLAG_DISCARDED;
return WINED3D_OK;
}
@ -5599,7 +5599,7 @@ void surface_modify_ds_location(struct wined3d_surface *surface,
{
TRACE("surface %p, new location %#x, w %u, h %u.\n", surface, location, w, h);
if (location & ~(SFLAG_LOCATIONS | SFLAG_LOST))
if (location & ~(SFLAG_LOCATIONS | SFLAG_DISCARDED))
FIXME("Invalid location (%#x) specified.\n", location);
if (((surface->flags & SFLAG_INTEXTURE) && !(location & SFLAG_INTEXTURE))
@ -5614,7 +5614,7 @@ void surface_modify_ds_location(struct wined3d_surface *surface,
surface->ds_current_size.cx = w;
surface->ds_current_size.cy = h;
surface->flags &= ~(SFLAG_LOCATIONS | SFLAG_LOST);
surface->flags &= ~(SFLAG_LOCATIONS | SFLAG_DISCARDED);
surface->flags |= location;
}
@ -5655,7 +5655,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
return;
}
if (surface->flags & SFLAG_LOST)
if (surface->flags & SFLAG_DISCARDED)
{
TRACE("Surface was discarded, no need copy data.\n");
switch (location)
@ -5672,7 +5672,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
default:
FIXME("Unhandled location %#x\n", location);
}
surface->flags &= ~SFLAG_LOST;
surface->flags &= ~SFLAG_DISCARDED;
surface->flags |= location;
surface->ds_current_size.cx = surface->resource.width;
surface->ds_current_size.cy = surface->resource.height;

View File

@ -668,7 +668,7 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
if (swapchain->desc.flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
|| fb->depth_stencil->flags & SFLAG_DISCARD)
{
surface_modify_ds_location(fb->depth_stencil, SFLAG_LOST,
surface_modify_ds_location(fb->depth_stencil, SFLAG_DISCARDED,
fb->depth_stencil->resource.width,
fb->depth_stencil->resource.height);
if (fb->depth_stencil == swapchain->device->onscreen_depth_stencil)

View File

@ -2155,6 +2155,7 @@ void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back) D
#define SFLAG_INRB_MULTISAMPLE 0x00200000 /* The multisample renderbuffer is current. */
#define SFLAG_INRB_RESOLVED 0x00400000 /* The resolved renderbuffer is current. */
#define SFLAG_PIN_SYSMEM 0x02000000 /* Keep the surface in sysmem, at the same address. */
#define SFLAG_DISCARDED 0x04000000 /* Surface was discarded, allocating new location is enough. */
/* In some conditions the surface memory must not be freed:
* SFLAG_CONVERTED: Converting the data back would take too long