Mesa (mesa_7_5_branch): st/wgl: dummy implementation of wgl swapinterval extension

Keith Whitwell keithw at kemper.freedesktop.org
Wed Jul 1 16:37:25 UTC 2009


Module: Mesa
Branch: mesa_7_5_branch
Commit: 6c913411d39fd68eee1c1eeee7b6e81db9785fd1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6c913411d39fd68eee1c1eeee7b6e81db9785fd1

Author: Keith Whitwell <keithw at vmware.com>
Date:   Wed Jul  1 17:34:38 2009 +0100

st/wgl: dummy implementation of wgl swapinterval extension

Required as some applications
retrieve and call these functions regardless of the fact that we
don't advertise the extension and further more the results of
wglGetProcAddress are NULL.

---

 src/gallium/state_trackers/wgl/SConscript          |    1 +
 .../wgl/shared/stw_extensionsstring.c              |    1 +
 .../wgl/shared/stw_extswapinterval.c               |   57 ++++++++++++++++++++
 .../state_trackers/wgl/shared/stw_getprocaddress.c |    4 ++
 4 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript
index 5bbcc71..a086657 100644
--- a/src/gallium/state_trackers/wgl/SConscript
+++ b/src/gallium/state_trackers/wgl/SConscript
@@ -27,6 +27,7 @@ if env['platform'] in ['windows']:
         'shared/stw_framebuffer.c',
         'shared/stw_pixelformat.c',
         'shared/stw_extensionsstring.c',
+        'shared/stw_extswapinterval.c',
         'shared/stw_getprocaddress.c',
         'shared/stw_arbpixelformat.c',
         'shared/stw_tls.c',
diff --git a/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c b/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c
index 2660c59..0051463 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c
@@ -38,6 +38,7 @@ static const char *stw_extension_string =
    "WGL_ARB_extensions_string "
    "WGL_ARB_multisample "
    "WGL_ARB_pixel_format "
+   "WGL_EXT_swap_interval "
    "WGL_EXT_extensions_string";
 
 
diff --git a/src/gallium/state_trackers/wgl/shared/stw_extswapinterval.c b/src/gallium/state_trackers/wgl/shared/stw_extswapinterval.c
new file mode 100644
index 0000000..9eac6a1
--- /dev/null
+++ b/src/gallium/state_trackers/wgl/shared/stw_extswapinterval.c
@@ -0,0 +1,57 @@
+/**************************************************************************
+ * 
+ * Copyright 2009 VMware, Inc.
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+#include <windows.h>
+
+#define WGL_WGLEXT_PROTOTYPES
+
+#include <GL/gl.h>
+#include <GL/wglext.h>
+#include "util/u_debug.h"
+
+/* A dummy implementation of this extension.
+ *
+ * Required as some applications retrieve and call these functions
+ * regardless of the fact that we don't advertise the extension and
+ * further more the results of wglGetProcAddress are NULL.
+ */
+WINGDIAPI BOOL APIENTRY
+wglSwapIntervalEXT(int interval)
+{
+   (void) interval;
+   debug_printf("%s: %d\n", __FUNCTION__, interval);
+   return TRUE;
+}
+
+WINGDIAPI int APIENTRY
+wglGetSwapIntervalEXT(void)
+{
+   return 0;
+}
+
+
diff --git a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c
index 8cacbb8..54cc038 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c
@@ -56,6 +56,10 @@ static const struct stw_extension_entry stw_extension_entries[] = {
    /* WGL_EXT_extensions_string */
    STW_EXTENSION_ENTRY( wglGetExtensionsStringEXT ),
 
+   /* WGL_EXT_swap_interval */
+   STW_EXTENSION_ENTRY( wglGetSwapIntervalEXT ),
+   STW_EXTENSION_ENTRY( wglSwapIntervalEXT ),
+
    { NULL, NULL }
 };
 




More information about the mesa-commit mailing list