Module: wine Branch: master Commit: b51a6576269e0b92532332adf849735ad78a20a7 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b51a6576269e0b92532332adf8...
Author: Matteo Bruni mbruni@codeweavers.com Date: Thu Feb 2 15:08:58 2012 +0100
wined3d: Use a separate flag for discarded surfaces.
---
dlls/wined3d/device.c | 2 +- dlls/wined3d/surface.c | 10 +++++----- dlls/wined3d/swapchain.c | 2 +- dlls/wined3d/wined3d_private.h | 1 + 4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 2d014ab..d0768aa 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -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) { diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index e6b4cd8..30dc63e 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -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; diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 83678f8..efe2293 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -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) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index b218ca7..416d970 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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