MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / getFBConfigFromVisual

Function getFBConfigFromVisual

server/fakerut.cpp:1297–1324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1295
1296
1297GLXFBConfig getFBConfigFromVisual(Display *dpy, XVisualInfo *vis)
1298{
1299 GLXContext ctx = 0; int temp, fbcid = 0, n = 0;
1300 GLXFBConfig *configs = NULL, config = 0;
1301 try
1302 {
1303 if(!(ctx = glXCreateContext(dpy, vis, NULL, True)))
1304 THROWNL("glXCreateNewContext");
1305 glXQueryContext(dpy, ctx, GLX_FBCONFIG_ID, &fbcid);
1306 glXDestroyContext(dpy, ctx); ctx = 0;
1307 if(!(configs = glXGetFBConfigs(dpy, DefaultScreen(dpy), &n)) || n == 0)
1308 THROWNL("Cannot map visual to FB config");
1309 for(int i = 0; i < n; i++)
1310 {
1311 temp = cfgid(dpy, configs[i]);
1312 if(temp == fbcid) { config = configs[i]; break; }
1313 }
1314 XFree(configs); configs = NULL;
1315 if(!config) THROWNL("Cannot map visual to FB config");
1316 return config;
1317 }
1318 catch(...)
1319 {
1320 if(ctx) glXDestroyContext(dpy, ctx);
1321 if(configs) XFree(configs);
1322 throw;
1323 }
1324}
1325
1326
1327#define TEST_ATTRIB(vattribs, cattribs, desc) \

Callers 1

visTestFunction · 0.85

Calls 6

glXCreateContextFunction · 0.85
glXQueryContextFunction · 0.85
glXDestroyContextFunction · 0.85
glXGetFBConfigsFunction · 0.85
cfgidFunction · 0.85
XFreeFunction · 0.85

Tested by

no test coverage detected