diff options
author | Hans de Goede <j.w.r.degoede@hhs.nl> | 2008-04-23 12:28:30 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2008-04-23 12:28:30 -0400 |
commit | f6e22d69af6bc8f63c3a46535a09e217696a679f (patch) | |
tree | a16942d3ecfd771824af6c76740c606be6ef4d71 /GL | |
parent | 00effad583713e882c3f2518bcd3da51bf4db716 (diff) |
Prefer glxvisuals with stencil buffer for default visuals
The first fbconfig which has a depthbuffer > 0 and doublebuf is choosen
when associating fbconfigs with the visuals, indepenent of stencil bits.
This happens to work ok on intel as there all fbconfigs with a
depthbuffer > 0 also have stencil bits.
This patch fixes this by first trying to get a fbconfig for default X visuals
with both stencilbuf, depthbuf and doublebuffering, and if that fails fallback
to trying to get one with only a depthbuf and doublebuffering.
Diffstat (limited to 'GL')
-rw-r--r-- | GL/glx/glxscreens.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/GL/glx/glxscreens.c b/GL/glx/glxscreens.c index 41ee029e6..5859de0b1 100644 --- a/GL/glx/glxscreens.c +++ b/GL/glx/glxscreens.c @@ -437,6 +437,7 @@ initGlxVisual(VisualPtr visual, __GLXconfig *config) typedef struct { GLboolean doubleBuffer; GLboolean depthBuffer; + GLboolean stencilBuffer; } FBConfigTemplateRec, *FBConfigTemplatePtr; static __GLXconfig * @@ -453,6 +454,8 @@ pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template, int class) continue; if ((config->depthBits > 0) != template->depthBuffer) continue; + if ((config->stencilBits > 0) != template->stencilBuffer) + continue; return config; } @@ -466,8 +469,9 @@ addMinimalSet(__GLXscreen *pGlxScreen) __GLXconfig *config; VisualPtr visuals; int i, j; - FBConfigTemplateRec best = { GL_TRUE, GL_TRUE }; - FBConfigTemplateRec minimal = { GL_FALSE, GL_FALSE }; + FBConfigTemplateRec best = { GL_TRUE, GL_TRUE, GL_TRUE }; + FBConfigTemplateRec good = { GL_TRUE, GL_TRUE, GL_FALSE }; + FBConfigTemplateRec minimal = { GL_FALSE, GL_FALSE, GL_FALSE }; pGlxScreen->visuals = xcalloc(pGlxScreen->pScreen->numVisuals, sizeof (__GLXconfig *)); @@ -480,8 +484,11 @@ addMinimalSet(__GLXscreen *pGlxScreen) for (i = 0, j = 0; i < pGlxScreen->pScreen->numVisuals; i++) { if (visuals[i].nplanes == 32) config = pickFBConfig(pGlxScreen, &minimal, visuals[i].class); - else + else { config = pickFBConfig(pGlxScreen, &best, visuals[i].class); + if (config == NULL) + config = pickFBConfig(pGlxScreen, &good, visuals[i].class); + } if (config == NULL) config = pGlxScreen->fbconfigs; if (config == NULL) |