opengl32 wglSwapLayerBuffers

Lionel Ulmer lionel.ulmer at free.fr
Thu Jun 6 14:59:25 CDT 2002


Well, the attached patch does exactly the same, it's just a little more
verbose about it :-)

Anyway, we do not support OVERLAYS and UNDERLAYS in OpenGL right now (I do
not even know how we could do *that* with GLX) so your code should be about
right.

Moreover, according to MSDN, War3 should never call wglSwapLayerBuffers as
we do not have the 'PFD_SWAP_LAYER_BUFFERS' bit set in our
PIXELFORMATDESCRIPTOR (oh well, that is Windows programs for ya :-) ).

Could you, out of curiosity, add me a log showing what value War3 uses in
the fuPlanes field ?

Changelog:
 Jesse Allen <uh_ja at gmx.net>
 Lionel Ulmer <lionel.ulmer at free.fr>
 - add implementation of wglSwapLayerBuffers

                  Lionel

PS: War3 running in Wine using OpenGL !!! Man, this is nice :-)

-- 
		 Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
Index: include/wingdi.h
===================================================================
RCS file: /home/wine/wine/include/wingdi.h,v
retrieving revision 1.71
diff -u -r1.71 wingdi.h
--- include/wingdi.h	2 Jun 2002 21:40:25 -0000	1.71
+++ include/wingdi.h	6 Jun 2002 19:53:18 -0000
@@ -3412,6 +3412,39 @@
 BOOL      WINAPI PolyTextOutW(HDC,PPOLYTEXTW,INT);
 #define   PolyTextOut WINELIB_NAME_AW(PolyTextOut)
 
+/* These defines are used by wglSwapLayerBuffers */
+#define WGL_SWAP_MAIN_PLANE (1 <<  0)
+#define WGL_SWAP_OVERLAY1   (1 <<  1)
+#define WGL_SWAP_OVERLAY2   (1 <<  2)
+#define WGL_SWAP_OVERLAY3   (1 <<  3)
+#define WGL_SWAP_OVERLAY4   (1 <<  4)
+#define WGL_SWAP_OVERLAY5   (1 <<  5)
+#define WGL_SWAP_OVERLAY6   (1 <<  6)
+#define WGL_SWAP_OVERLAY7   (1 <<  7)
+#define WGL_SWAP_OVERLAY8   (1 <<  8)
+#define WGL_SWAP_OVERLAY9   (1 <<  9)
+#define WGL_SWAP_OVERLAY10  (1 << 10)
+#define WGL_SWAP_OVERLAY11  (1 << 11)
+#define WGL_SWAP_OVERLAY12  (1 << 12)
+#define WGL_SWAP_OVERLAY13  (1 << 13)
+#define WGL_SWAP_OVERLAY14  (1 << 14)
+#define WGL_SWAP_OVERLAY15  (1 << 15)
+#define WGL_SWAP_UNDERLAY1  (1 << 16)
+#define WGL_SWAP_UNDERLAY2  (1 << 17)
+#define WGL_SWAP_UNDERLAY3  (1 << 18)
+#define WGL_SWAP_UNDERLAY4  (1 << 19)
+#define WGL_SWAP_UNDERLAY5  (1 << 20)
+#define WGL_SWAP_UNDERLAY6  (1 << 21)
+#define WGL_SWAP_UNDERLAY7  (1 << 22)
+#define WGL_SWAP_UNDERLAY8  (1 << 23)
+#define WGL_SWAP_UNDERLAY9  (1 << 24)
+#define WGL_SWAP_UNDERLAY10 (1 << 25)
+#define WGL_SWAP_UNDERLAY11 (1 << 26)
+#define WGL_SWAP_UNDERLAY12 (1 << 27)
+#define WGL_SWAP_UNDERLAY13 (1 << 28)
+#define WGL_SWAP_UNDERLAY14 (1 << 29)
+#define WGL_SWAP_UNDERLAY15 (1 << 30)
+
 #ifdef __cplusplus
 }
 #endif
Index: dlls/opengl32/wgl.c
===================================================================
RCS file: /home/wine/wine/dlls/opengl32/wgl.c,v
retrieving revision 1.23
diff -u -r1.23 wgl.c
--- dlls/opengl32/wgl.c	31 May 2002 23:25:51 -0000	1.23
+++ dlls/opengl32/wgl.c	6 Jun 2002 19:53:18 -0000
@@ -435,9 +435,18 @@
  */
 BOOL WINAPI wglSwapLayerBuffers(HDC hdc,
 				UINT fuPlanes) {
-  FIXME("(): stub !\n");
+  TRACE("(%08x, %08x)\n", hdc, fuPlanes);
 
-  return FALSE;
+  if (fuPlanes & WGL_SWAP_MAIN_PLANE) {
+    if (!SwapBuffers(hdc)) return FALSE;
+    fuPlanes &= ~WGL_SWAP_MAIN_PLANE;
+  }
+
+  if (fuPlanes) {
+    WARN("Following layers unhandled : %08x\n", fuPlanes);
+  }
+  
+  return TRUE;
 }
 
 /***********************************************************************


More information about the wine-patches mailing list