Forgot to attached simple app I used to test this. -Nathan

On 11-05-13 01:11 PM, Nathan Kidd wrote:
Rather than ripping out the rug from under the user, worst-case the app
doesn't draw correctly but at least the user has a chance to save. The
trace logs will still give necessary info to know something went wrong.

This is the logical follow-up to the previous patch. Given enough time,
I suggest an app that triggers one of these cases will be encountered.
While we don't want to start baby-sitting bad applications, we should at
least be as lenient as other known GL drivers.

-Nathan
/*
 * A demonstration of what happens when you abuse 
 * glXGetConfig/glXGetFBconfigAttrib.
 *
 * [email protected] May 2011
 */


#include <GL/gl.h>
#define GLX_GLXEXT_PROTOTYPES
#include <GL/glx.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main( int argc, char *argv[] )
{
	Display *dpy;
	int value;
	int rv,n;
	XVisualInfo *xvi;
	GLXFBConfig *fb;
	int visattrib[]={GLX_RGBA, None};
	int fbattrib[]={GLX_RENDER_TYPE, GLX_RGBA_BIT, None};

	dpy = XOpenDisplay(NULL);
	if (!dpy){printf("Error: can't open display\n"); return 1;}
	xvi = glXChooseVisual(dpy, DefaultScreen(dpy), visattrib);
	if (!xvi){printf("Error: can't get visual\n"); return 1;}
	printf("glXGetConfig:\n");
	rv = glXGetConfig(dpy, xvi, GLX_USE_GL, &value); printf("all good  rv=%d\n", rv);
	rv = glXGetConfig(0, xvi, GLX_USE_GL, &value);   printf("nul dpy   rv=%d\n", rv);
	rv = glXGetConfig(dpy, 0, GLX_USE_GL, &value);   printf("nul vis   rv=%d\n", rv);
	rv = glXGetConfig(dpy, xvi, 0, &value);          printf("nul attrb rv=%d\n", rv);
	rv = glXGetConfig(dpy, xvi, GLX_USE_GL, 0);      printf("nul value rv=%d\n", rv);

	printf("glXGetFBConfigAttrib:\n");
	fb = glXChooseFBConfig(dpy, DefaultScreen(dpy), fbattrib, &n);
	if (!fb||!n){printf("Error: can't get fbconfig\n"); return 1;}
	rv = glXGetFBConfigAttrib(dpy, fb[0], GLX_LEVEL, &value); printf("all good  rv=%d\n", rv);
	rv = glXGetFBConfigAttrib(0, fb[0], GLX_LEVEL, &value);   printf("nul dpy   rv=%d\n", rv);
	rv = glXGetFBConfigAttrib(dpy, 0, GLX_LEVEL, &value);  printf("nul confg rv=%d\n", rv);
	rv = glXGetFBConfigAttrib(dpy, fb[0], 0, &value);         printf("nul attrb rv=%d\n", rv);
	rv = glXGetFBConfigAttrib(dpy, fb[0], GLX_LEVEL, 0);      printf("nul value rv=%d\n", rv);
		

	return 0;
}
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
VirtualGL-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/virtualgl-devel

Reply via email to