An app would almost have to try on purpose for this to be a problem,
but it could be hard to track down:
ctx1 = glXCreateContext(vis1); (_MatchConfig assigns to config1,
depthbuf 24)
then
vis2 = glXChooseVisual(some attribs, depth 0 ); (assigns config2
depthbuf 0)
Then notice vis1.visualid == vis2.visualid, therefore no need to create
a new context to draw with a 0-size depth buffer, but though visualids
are the same they are mapped to very different server configs.
Ideally MatchConfig and glXChooseVisual would use the same mechanism so
they could never disagree, but because one uses arbitrary attribs, the
other doesn't, and both are subject to the whims of glXChooseFBConfig I
think the only way to guarantee a match is to do the config selection
ourselves; too much code for just a theoretical edge case.
Why not just make glXChooseVisual return what _MatchConfig already
chose? It could be done, but I left a warning instead, thinking the
greater danger is the app getting a config it doesn't like if we ignore
the explicit attributes passed in. (__vglMatchVisual() is fairly loose.)
-Nathan
>From ea534f04089c54f35df32ebe63724221ac981acf Mon Sep 17 00:00:00 2001
From: nathan.kidd <nathan.kidd@17dcb34f-51d9-0310-863f-d33a0f133fc4>
Date: Fri, 18 Feb 2011 17:40:22 +0000
Subject: [PATCH] Warn if mapping a visual to a different config than before
An app would almost have to try on purpose for this to be a problem,
but it could be hard to track down:
ctx1 = glXCreateContext(vis1); (_MatchConfig assigns to config1, depthbuf 24)
then
vis2 = glXChooseVisual(some attribs, depth 0 ); (assigns config2 depthbuf 0)
Then notice vis1.visualid == vis2.visualid, therefore no need to create a new context
to draw with a 0-size depth buffer, but though visualids are the same they are
mapped to very different server configs.
---
rr/faker.cpp | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/rr/faker.cpp b/rr/faker.cpp
index 6af82eb..03699d4 100644
--- a/rr/faker.cpp
+++ b/rr/faker.cpp
@@ -785,7 +785,7 @@ XVisualInfo *glXChooseVisual(Display *dpy, int screen, int *attrib_list)
}
- GLXFBConfig *configs=NULL, c=0; int n=0;
+ GLXFBConfig *configs=NULL, c=0, cprev; int n=0;
if(!dpy || !attrib_list) return NULL;
int depth=24, c_class=TrueColor, level=0, stereo=0, trans=0;
if(!(configs=__vglConfigsFromVisAttribs(attrib_list, depth, c_class,
@@ -807,6 +807,9 @@ XVisualInfo *glXChooseVisual(Display *dpy, int screen, int *attrib_list)
if(!vid) return NULL;
v=__vglVisualFromVisualID(dpy, screen, vid);
if(!v) return NULL;
+ if((cprev=vish.getpbconfig(dpy, v)) && _FBCID(c) != _FBCID(cprev))
+ rrout.println("[VGL] WARNING: Visual 0x%x was previously mapped to FBConfig 0x%x and now mapped to 0x%x\n", v->visualid, _FBCID(cprev), _FBCID(c));
+
vish.add(dpy, v, c);
stoptrace(); prargv(v); prargc(c); closetrace();
--
1.6.4.msysgit.0
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
VirtualGL-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/virtualgl-users