From 34c2831af2c72f793ddb94da134f21f9cd613b5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 19 Sep 2013 12:06:00 +0200
Subject: wined3d: Handle WINED3D_LOCATION_DISCARDED in surface_load_texture.

TODO: Move texture allocation to the caller, this way discarded locations can be handled in the resource.
---
 dlls/wined3d/surface.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 4be6a50..09bd72b 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -4091,6 +4091,13 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
     POINT dst_point = {0, 0};
     BYTE *mem = NULL;
 
+    if (surface->resource.locations & WINED3D_LOCATION_DISCARDED)
+    {
+        TRACE("Surface was discarded, nothing to do.\n");
+        wined3d_texture_prepare_texture(texture, context, srgb);
+        return WINED3D_OK;
+    }
+
     if (wined3d_settings.offscreen_rendering_mode != ORM_FBO
             && wined3d_resource_is_offscreen(&texture->resource)
             && (surface->resource.locations & WINED3D_LOCATION_DRAWABLE))
-- 
2.1.3

