From 3bfa1fb3845b32f6270d42a5b0021cc0de863879 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@wanadoo.fr>
Date: Wed, 25 Sep 2002 03:18:17 +0000
Subject: [PATCH] IDirect3DTexture2Impl_Load: when the surface is not allocated
 and no location are specified, set it to video memory.

---
 dlls/ddraw/d3dtexture.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dlls/ddraw/d3dtexture.c b/dlls/ddraw/d3dtexture.c
index 9728f97851c..46ff3d77607 100644
--- a/dlls/ddraw/d3dtexture.c
+++ b/dlls/ddraw/d3dtexture.c
@@ -382,6 +382,12 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
   TRACE("(%p)->(%p)\n", This, ilpD3DTexture2);
   TRACE("Copied surface %p to surface %p\n", ilpD3DTexture2->surface, This->surface);
 
+  if ( This->surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD )
+    /* If the surface is not allocated and its location is not yet specified,
+       force it to video memory */ 
+    if ( !(This->surface->surface_desc.ddsCaps.dwCaps & (DDSCAPS_SYSTEMMEMORY|DDSCAPS_VIDEOMEMORY)) )
+      This->surface->surface_desc.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
+
   /* Suppress the ALLOCONLOAD flag */
   This->surface->surface_desc.ddsCaps.dwCaps &= ~DDSCAPS_ALLOCONLOAD;
 
-- 
GitLab