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

Function visTest

server/fakerut.cpp:1336–1642  ·  view source on GitHub ↗

This tests the faker's client/server visual matching heuristics

Source from the content-addressed store, hash-verified

1334
1335// This tests the faker's client/server visual matching heuristics
1336int visTest(void)
1337{
1338 Display *dpy = NULL;
1339 XVisualInfo **visuals = NULL, *vis0 = NULL, vtemp;
1340 GLXFBConfig config = 0, *configs = NULL; int n = 0, i, retval = 1;
1341
1342 printf("Visual matching heuristics test\n\n");
1343
1344 try
1345 {
1346 if(!(dpy = XOpenDisplay(0))) THROW("Could not open display");
1347
1348 // This will fail with VGL 2.2.x and earlier
1349 if(!(configs = glXChooseFBConfig(dpy, DefaultScreen(dpy), NULL, &n))
1350 || n == 0)
1351 THROW("No FB configs found");
1352 XFree(configs); configs = NULL;
1353
1354 // These should fail, since we no longer support transparent overlays.
1355 int attribs0[] = { GLX_LEVEL, 1, None };
1356 TEST_ATTRIB(attribs0, attribs0, "Overlay")
1357 int vattribs1[] = { None };
1358 int cattribs1[] = { GLX_RENDER_TYPE, GLX_COLOR_INDEX_BIT, None };
1359 TEST_ATTRIB(vattribs1, cattribs1, "CI")
1360 int vattribs2[] = { GLX_RGBA, GLX_TRANSPARENT_TYPE, GLX_TRANSPARENT_RGB,
1361 None };
1362 int cattribs2[] = { GLX_TRANSPARENT_TYPE, GLX_TRANSPARENT_RGB, None };
1363 TEST_ATTRIB(vattribs2, cattribs2, "Transparent")
1364
1365 try
1366 {
1367 printf("GLX attributes: ");
1368
1369 // Iterate through RGBA attributes
1370 int rgbattrib[] = { GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8,
1371 GLX_ALPHA_SIZE, 0, GLX_DEPTH_SIZE, 0, GLX_AUX_BUFFERS, 0,
1372 GLX_STENCIL_SIZE, 0, GLX_ACCUM_RED_SIZE, 0, GLX_ACCUM_GREEN_SIZE, 0,
1373 GLX_ACCUM_BLUE_SIZE, 0, GLX_ACCUM_ALPHA_SIZE, 0, GLX_SAMPLE_BUFFERS, 0,
1374 GLX_SAMPLES, 1, GLX_RGBA, GLX_X_VISUAL_TYPE, GLX_NONE, None, None,
1375 None };
1376 int rgbattrib13[] = { GLX_LEVEL, 0, GLX_DOUBLEBUFFER, 1, GLX_STEREO, 1,
1377 GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8,
1378 GLX_ALPHA_SIZE, 0, GLX_DEPTH_SIZE, 0, GLX_AUX_BUFFERS, 0,
1379 GLX_STENCIL_SIZE, 0, GLX_ACCUM_RED_SIZE, 0, GLX_ACCUM_GREEN_SIZE, 0,
1380 GLX_ACCUM_BLUE_SIZE, 0, GLX_ACCUM_ALPHA_SIZE, 0, GLX_SAMPLE_BUFFERS, 0,
1381 GLX_SAMPLES, 1, GLX_X_VISUAL_TYPE, GLX_NONE, None };
1382 unsigned int visualTypes[3] = { GLX_TRUE_COLOR, GLX_DIRECT_COLOR,
1383 GLX_DONT_CARE };
1384 if(DefaultDepth(dpy, DefaultScreen(dpy)) == 30)
1385 {
1386 rgbattrib[1] = rgbattrib[3] = rgbattrib[5] = 10;
1387 rgbattrib13[7] = rgbattrib13[9] = rgbattrib13[11] = 10;
1388 }
1389
1390 for(int db = 0; db <= 1; db++)
1391 {
1392 rgbattrib13[0] = db ? GLX_TRANSPARENT_TYPE : GLX_LEVEL;
1393 rgbattrib13[1] = db ? GLX_NONE : 0;

Callers 1

mainFunction · 0.70

Calls 14

XOpenDisplayFunction · 0.85
glXChooseFBConfigFunction · 0.85
XFreeFunction · 0.85
glXChooseVisualFunction · 0.85
configVsVisualFunction · 0.85
glXGetFBConfigsFunction · 0.85
cfgidFunction · 0.85
glXGetFBConfigAttribFunction · 0.85
glXGetVisualFromFBConfigFunction · 0.85
queryContextTestFunction · 0.85
getFBConfigFromVisualFunction · 0.85
glXGetConfigFunction · 0.85

Tested by

no test coverage detected