Commit b51a6576 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

wined3d: Use a separate flag for discarded surfaces.

parent fc0d21aa
...@@ -4862,7 +4862,7 @@ HRESULT CDECL wined3d_device_set_depth_stencil(struct wined3d_device *device, st ...@@ -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 if (device->swapchains[0]->desc.flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
|| prev->flags & SFLAG_DISCARD) || prev->flags & SFLAG_DISCARD)
{ {
surface_modify_ds_location(prev, SFLAG_LOST, surface_modify_ds_location(prev, SFLAG_DISCARDED,
prev->resource.width, prev->resource.height); prev->resource.width, prev->resource.height);
if (prev == device->onscreen_depth_stencil) if (prev == device->onscreen_depth_stencil)
{ {
......
...@@ -762,7 +762,7 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface) ...@@ -762,7 +762,7 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface)
} }
if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
surface->flags |= SFLAG_LOST; surface->flags |= SFLAG_DISCARDED;
return WINED3D_OK; return WINED3D_OK;
} }
...@@ -5599,7 +5599,7 @@ void surface_modify_ds_location(struct wined3d_surface *surface, ...@@ -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); 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); FIXME("Invalid location (%#x) specified.\n", location);
if (((surface->flags & SFLAG_INTEXTURE) && !(location & SFLAG_INTEXTURE)) if (((surface->flags & SFLAG_INTEXTURE) && !(location & SFLAG_INTEXTURE))
...@@ -5614,7 +5614,7 @@ void surface_modify_ds_location(struct wined3d_surface *surface, ...@@ -5614,7 +5614,7 @@ void surface_modify_ds_location(struct wined3d_surface *surface,
surface->ds_current_size.cx = w; surface->ds_current_size.cx = w;
surface->ds_current_size.cy = h; surface->ds_current_size.cy = h;
surface->flags &= ~(SFLAG_LOCATIONS | SFLAG_LOST); surface->flags &= ~(SFLAG_LOCATIONS | SFLAG_DISCARDED);
surface->flags |= location; surface->flags |= location;
} }
...@@ -5655,7 +5655,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co ...@@ -5655,7 +5655,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
return; return;
} }
if (surface->flags & SFLAG_LOST) if (surface->flags & SFLAG_DISCARDED)
{ {
TRACE("Surface was discarded, no need copy data.\n"); TRACE("Surface was discarded, no need copy data.\n");
switch (location) switch (location)
...@@ -5672,7 +5672,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co ...@@ -5672,7 +5672,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
default: default:
FIXME("Unhandled location %#x\n", location); FIXME("Unhandled location %#x\n", location);
} }
surface->flags &= ~SFLAG_LOST; surface->flags &= ~SFLAG_DISCARDED;
surface->flags |= location; surface->flags |= location;
surface->ds_current_size.cx = surface->resource.width; surface->ds_current_size.cx = surface->resource.width;
surface->ds_current_size.cy = surface->resource.height; surface->ds_current_size.cy = surface->resource.height;
......
...@@ -668,7 +668,7 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R ...@@ -668,7 +668,7 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
if (swapchain->desc.flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL if (swapchain->desc.flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
|| fb->depth_stencil->flags & SFLAG_DISCARD) || 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.width,
fb->depth_stencil->resource.height); fb->depth_stencil->resource.height);
if (fb->depth_stencil == swapchain->device->onscreen_depth_stencil) if (fb->depth_stencil == swapchain->device->onscreen_depth_stencil)
......
...@@ -2155,6 +2155,7 @@ void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back) D ...@@ -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_MULTISAMPLE 0x00200000 /* The multisample renderbuffer is current. */
#define SFLAG_INRB_RESOLVED 0x00400000 /* The resolved 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_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: /* In some conditions the surface memory must not be freed:
* SFLAG_CONVERTED: Converting the data back would take too long * SFLAG_CONVERTED: Converting the data back would take too long
......
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