[AD] [WIN] page flipping again and again

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


While investigating on the overlay driver (see my previous post), I found
another bug in the page flipping code (Robin, are you there ? Reviewing the
code can sometimes be very useful :-): the backbuffer surface is enumerated
twice, as actual backbuffer *and* triple buffer !!!!
And of course it cheated me when I was trying to find the answer to the
question about the behaviour of enumeration: it's no (and the DirectX docs
are very ambiguous about that...)
Redone the testing, all is still ok (except the overlay page flipping).

--
Eric Botcazou (ebotcazou@xxxxxxxxxx)
Web Site: http://www.multimania.com/ebotcazou

--- /allegro/src/win/wddbmp.c	Fri Dec 22 11:38:10 2000
+++ /allegro/src/win/wddbmp.c	Fri Dec 22 14:29:58 2000
@@ -53,8 +53,7 @@
 {
    if (backbuffersurf == NULL)
       backbuffersurf = lpDDSurface;
-
-   if (tripbuffersurf == NULL)
+   else if (tripbuffersurf == NULL)
       tripbuffersurf = lpDDSurface;
       
    return DDENUMRET_OK;
@@ -152,15 +151,12 @@
    /* get attached backbuffers */
    if (surf_desc.dwBackBufferCount == 2) {
       IDirectDrawSurface_EnumAttachedSurfaces(surf, NULL, EnumSurfacesCallback);
+      IDirectDrawSurface_EnumAttachedSurfaces(backbuffersurf, NULL, EnumSurfacesCallback);
       primbuffersurf = surf;
    }
-   else {
-      if (surf_desc.dwBackBufferCount == 1) {
-         memset (&ddscaps, 0, sizeof(DDSCAPS));
-         ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
-         IDirectDrawSurface_GetAttachedSurface(surf, &ddscaps, &backbuffersurf);
-         primbuffersurf = surf;
-      }
+   else if (surf_desc.dwBackBufferCount == 1) {
+      IDirectDrawSurface_EnumAttachedSurfaces(surf, NULL, EnumSurfacesCallback);
+      primbuffersurf = surf;
    }
 
    return surf;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/