From 663631725ee2d633d9ec5821cd48953ffd188d00 Mon Sep 17 00:00:00 2001 From: ftrapero Date: Tue, 27 Jun 2017 12:08:38 +0200 Subject: Squashed 'nx-X11/extras/Mesa_6.4.2/' content from commit 475b1f7 git-subtree-dir: nx-X11/extras/Mesa_6.4.2 git-subtree-split: 475b1f7b56fa36ef4f3b22a749f88a98ddc0d502 --- src/glut/os2/glut_mesa.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/glut/os2/glut_mesa.cpp (limited to 'src/glut/os2/glut_mesa.cpp') diff --git a/src/glut/os2/glut_mesa.cpp b/src/glut/os2/glut_mesa.cpp new file mode 100644 index 000000000..73682a506 --- /dev/null +++ b/src/glut/os2/glut_mesa.cpp @@ -0,0 +1,57 @@ + +/* Copyright (c) Mark J. Kilgard, 1996. */ + +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or + implied. This program is -not- in the public domain. */ + +#include +#include +#include "glutint.h" + +int __glutMesaSwapHackSupport = 0; /* Not supported until + proven otherwise. */ + +/* Use the "Mesa swap hack" if reasonable if and only if + MESA_SWAP_HACK is set to something whose first character is + not "N" or "n" AND "Brian Paul" is the vendor string AND + "Mesa X11"* (or "Mesa" for backward compatibility) is the + renderer string. + + Anyone who modifies Mesa so that glXSwapBuffers does not + simply blit the previously rendered back buffer should + change either their vendor or renderer string to avoid + confusing GLUT. */ + +void +__glutDetermineMesaSwapHackSupport(void) +{ + static int doneAlready = 0; + char *env, *vendor, *renderer; + + if (doneAlready) + return; + env = getenv("MESA_SWAP_HACK"); + if (env) { + if ((env[0] != 'n') && (env[0] != 'N')) { + vendor = (char *) glGetString(GL_VENDOR); + renderer = (char *) glGetString(GL_RENDERER); + + /* Old versions of X11 Mesa uses the renderer string + "Mesa"; Brian plans to start using "Mesa X11" to + distinguish the X version of Mesa from other flavor + such as Windows or 3Dfx. */ + +#define MESA_X11 "Mesa X11" + + /* XXX At some point in the future, eliminate the + backward compatibility for the old "Mesa" renderer + string. */ + + if (!strcmp(vendor, "Brian Paul") && (!strcmp(renderer, "Mesa") || + !strncmp(renderer, MESA_X11, sizeof(MESA_X11) - 1))) + __glutMesaSwapHackSupport = 1; + } + } + doneAlready = 1; +} -- cgit v1.2.3