| 1245 | |
| 1246 | |
| 1247 | void queryContextTest(Display *dpy, XVisualInfo *vis, GLXFBConfig config) |
| 1248 | { |
| 1249 | GLXContext ctx = 0; int fbcid, temp; |
| 1250 | try |
| 1251 | { |
| 1252 | int visual_caveat; |
| 1253 | GET_CFG_ATTRIB(config, GLX_CONFIG_CAVEAT, visual_caveat); |
| 1254 | if(visual_caveat == GLX_NON_CONFORMANT_CONFIG) return; |
| 1255 | fbcid = cfgid(dpy, config); |
| 1256 | |
| 1257 | if(!(ctx = glXCreateNewContext(dpy, config, GLX_RGBA_TYPE, NULL, True))) |
| 1258 | THROWNL("glXCreateNewContext"); |
| 1259 | temp = -20; |
| 1260 | glXQueryContext(dpy, ctx, GLX_FBCONFIG_ID, &temp); |
| 1261 | if(temp != fbcid) THROWNL("glXQueryContext FB cfg ID"); |
| 1262 | glXDestroyContext(dpy, ctx); ctx = 0; |
| 1263 | |
| 1264 | if(!(ctx = glXCreateContext(dpy, vis, NULL, True))) |
| 1265 | THROWNL("glXCreateNewContext"); |
| 1266 | temp = -20; |
| 1267 | glXQueryContext(dpy, ctx, GLX_FBCONFIG_ID, &temp); |
| 1268 | if(temp != fbcid) THROWNL("glXQueryContext FB cfg ID"); |
| 1269 | temp = -20; |
| 1270 | glXQueryContext(dpy, ctx, GLX_RENDER_TYPE, &temp); |
| 1271 | if(temp != GLX_RGBA_TYPE) THROWNL("glXQueryContext render type"); |
| 1272 | temp = -20; |
| 1273 | glXQueryContext(dpy, ctx, GLX_SCREEN, &temp); |
| 1274 | if(temp != DefaultScreen(dpy)) THROWNL("glXQueryContext screen"); |
| 1275 | |
| 1276 | if(GLX_EXTENSION_EXISTS(GLX_EXT_import_context)) |
| 1277 | { |
| 1278 | temp = -20; |
| 1279 | glXQueryContextInfoEXT(dpy, ctx, GLX_SCREEN_EXT, &temp); |
| 1280 | if(temp != DefaultScreen(dpy)) THROWNL("glXQueryContextInfoEXT screen"); |
| 1281 | temp = -20; |
| 1282 | glXQueryContextInfoEXT(dpy, ctx, GLX_VISUAL_ID_EXT, &temp); |
| 1283 | if((VisualID)temp != vis->visualid) |
| 1284 | THROWNL("glXQueryContextInfoEXT visual ID"); |
| 1285 | } |
| 1286 | |
| 1287 | glXDestroyContext(dpy, ctx); |
| 1288 | } |
| 1289 | catch(...) |
| 1290 | { |
| 1291 | if(ctx) glXDestroyContext(dpy, ctx); |
| 1292 | throw; |
| 1293 | } |
| 1294 | } |
| 1295 | |
| 1296 | |
| 1297 | GLXFBConfig getFBConfigFromVisual(Display *dpy, XVisualInfo *vis) |
no test coverage detected