DDraw: Set the DDSCAPS2_MIPMAPSUBLEVEL flag on sublevels

Stefan Dösinger stefandoesinger at gmx.at
Sun Oct 8 17:29:10 CDT 2006


The msdn mentiones that this flag is ignored when passed to CreateSurface and 
set for mipmap sublevels for convenience when calling GetAttachedSurface. The 
BBC Dinosaur world demo expects this.
-------------- next part --------------
From 53795c53612d710cea8bbe1d10ddd8cd195fd7fb Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Mon, 9 Oct 2006 00:16:35 +0200
Subject: [PATCH] DDraw: Set DDSCAPS2_MIPMAPSUBLEVEL on mipmap sublevels
---
 dlls/ddraw/ddraw.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 594f434..a2177d2 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -2155,6 +2155,9 @@ IDirectDrawImpl_CreateSurface(IDirectDra
         return E_POINTER; /* unchecked */
     }
 
+    /* According to the msdn this flag is ignored by CreateSurface */
+    DDSD->ddsCaps.dwCaps2 &= ~DDSCAPS2_MIPMAPSUBLEVEL;
+
     /* Modify some flags */
     memset(&desc2, 0, sizeof(desc2));
     desc2.dwSize = sizeof(desc2);   /* For the struct copy */
@@ -2330,6 +2333,11 @@ IDirectDrawImpl_CreateSurface(IDirectDra
         desc2.ddsCaps.dwCaps &= ~DDSCAPS_FRONTBUFFER; /* It's not a front buffer */
         desc2.ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER;
     }
+    /* Set the DDSCAPS2_MIPMAPSUBLEVEL flag on mipmap sublevels according to the msdn */
+    if(DDSD->ddsCaps.dwCaps & DDSCAPS_MIPMAP)
+    {
+        desc2.ddsCaps.dwCaps2 |= DDSCAPS2_MIPMAPSUBLEVEL;
+    }
 
     for(i = 0; i < extra_surfaces; i++)
     {
-- 
1.4.1.1



More information about the wine-patches mailing list