diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-02-17 11:40:09 -0800 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-02-17 11:40:38 -0800 |
commit | 7ccbeb41acd2f5c416005bd48c11996a054a869a (patch) | |
tree | 15e295fdf176ae5dc35c82f2f584ac540681f7fc /progs | |
parent | 0583c29313a4bcd01cc8d30846c815cdc775cb16 (diff) | |
parent | 381d5e209815235911c4aab516037c868c8f695f (diff) |
Merge commit '381d5e209815235911c4aab516037c868c8f695f'
This merges the patches from the series "[PATCH 00/14] More
client-side GLX house cleaning" that were posted to the mesa3d-dev
mailing list. See
http://marc.info/?l=mesa3d-dev&m=126582985214612&w=2
Patches 01 through 04 eliminate a bunch of annoying warnings that I
get when building Mesa.
Patch 05 fixes an inconsistency between the implementation of
glXSwapIntervalMESA and the spec. I chose to favor the code over the
spec in this case. This also eliminated a warning.
Patches 06 through 12 clean up the way that context creation is
performed on the client. When support for GLX_SGIX_fbconfig and the
related GLX 1.3 functions was added, I refactored a bunch
nuts-and-bolts of context creation to CreateContext. The refactor was
a good idea, I just didn't do it right.
Patches 13 and 14 update glxgears_fbconfig to use GLX 1.3 interfaces.
Diffstat (limited to 'progs')
-rw-r--r-- | progs/xdemos/glxgears_fbconfig.c | 78 |
1 files changed, 54 insertions, 24 deletions
diff --git a/progs/xdemos/glxgears_fbconfig.c b/progs/xdemos/glxgears_fbconfig.c index 2dac00b75d..36bf73138c 100644 --- a/progs/xdemos/glxgears_fbconfig.c +++ b/progs/xdemos/glxgears_fbconfig.c @@ -46,13 +46,11 @@ #include <assert.h> #include "pbutil.h" -/* I had to use the SGIX versions of these because for some reason glxext.h - * doesn't define the core versions if GLX_VERSION_1_3 is defined, and glx.h - * doesn't define them at all. One or both header files is clearly broken. - */ -static PFNGLXCHOOSEFBCONFIGSGIXPROC choose_fbconfig = NULL; -static PFNGLXGETVISUALFROMFBCONFIGSGIXPROC get_visual_from_fbconfig = NULL; -static PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC create_new_context = NULL; +static PFNGLXCHOOSEFBCONFIGPROC choose_fbconfig = NULL; +static PFNGLXGETVISUALFROMFBCONFIGPROC get_visual_from_fbconfig = NULL; +static PFNGLXCREATENEWCONTEXTPROC create_new_context = NULL; +static PFNGLXCREATEWINDOWPROC create_window = NULL; +static PFNGLXDESTROYWINDOWPROC destroy_window = NULL; #define BENCHMARK @@ -324,6 +322,26 @@ init(void) } +static GLXWindow +dummy_create_window(Display *dpy, GLXFBConfig config, Window win, + const int *attrib_list) +{ + (void) dpy; + (void) config; + (void) attrib_list; + + return (GLXWindow) win; +} + + +static void +dummy_destroy_window(Display *dpy, GLXWindow win) +{ + (void) dpy; + (void) win; +} + + /** * Initialize fbconfig related function pointers. */ @@ -359,20 +377,26 @@ init_fbconfig_functions(Display *dpy, int scrnum) ext_name, (ext_version_supported) ? "" : "not " ); if ( glx_1_3_supported ) { - choose_fbconfig = (PFNGLXCHOOSEFBCONFIGSGIXPROC) glXGetProcAddressARB( - (GLubyte *) "glXChooseFBConfig"); - get_visual_from_fbconfig = (PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) glXGetProcAddressARB( - (GLubyte *) "glXGetVisualFromFBConfig"); - create_new_context = (PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) glXGetProcAddressARB( - (GLubyte *) "glXCreateNewContext"); + choose_fbconfig = (PFNGLXCHOOSEFBCONFIGPROC) + glXGetProcAddressARB((GLubyte *) "glXChooseFBConfig"); + get_visual_from_fbconfig = (PFNGLXGETVISUALFROMFBCONFIGPROC) + glXGetProcAddressARB((GLubyte *) "glXGetVisualFromFBConfig"); + create_new_context = (PFNGLXCREATENEWCONTEXTPROC) + glXGetProcAddressARB((GLubyte *) "glXCreateNewContext"); + create_window = (PFNGLXCREATEWINDOWPROC) + glXGetProcAddressARB((GLubyte *) "glXCreateWindow"); + destroy_window = (PFNGLXDESTROYWINDOWPROC) + glXGetProcAddressARB((GLubyte *) "glXDestroyWindow"); } else if ( ext_version_supported ) { - choose_fbconfig = (PFNGLXCHOOSEFBCONFIGSGIXPROC) glXGetProcAddressARB( - (GLubyte *) "glXChooseFBConfigSGIX"); - get_visual_from_fbconfig = (PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) glXGetProcAddressARB( - (GLubyte *) "glXGetVisualFromFBConfigSGIX"); - create_new_context = (PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) glXGetProcAddressARB( - (GLubyte *) "glXCreateContextWithConfigSGIX"); + choose_fbconfig = (PFNGLXCHOOSEFBCONFIGPROC) + glXGetProcAddressARB((GLubyte *) "glXChooseFBConfigSGIX"); + get_visual_from_fbconfig = (PFNGLXGETVISUALFROMFBCONFIGPROC) + glXGetProcAddressARB((GLubyte *) "glXGetVisualFromFBConfigSGIX"); + create_new_context = (PFNGLXCREATENEWCONTEXTPROC) + glXGetProcAddressARB((GLubyte *) "glXCreateContextWithConfigSGIX"); + create_window = dummy_create_window; + destroy_window = dummy_destroy_window; } else { printf( "This demo requires either GLX 1.3 or %s be supported.\n", @@ -404,7 +428,7 @@ init_fbconfig_functions(Display *dpy, int scrnum) static void make_window( Display *dpy, const char *name, int x, int y, int width, int height, - Window *winRet, GLXContext *ctxRet) + Window *winRet, GLXWindow *glxWinRet, GLXContext *ctxRet) { int attrib[] = { GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, GLX_RENDER_TYPE, GLX_RGBA_BIT, @@ -422,6 +446,7 @@ make_window( Display *dpy, const char *name, unsigned long mask; Window root; Window win; + GLXWindow glxWin; GLXContext ctx; XVisualInfo *visinfo; @@ -467,6 +492,8 @@ make_window( Display *dpy, const char *name, None, (char **)NULL, 0, &sizehints); } + glxWin = (*create_window)(dpy, fbconfig[0], win, NULL); + ctx = (*create_new_context)(dpy, fbconfig[0], GLX_RGBA_TYPE, NULL, GL_TRUE); if (!ctx) { printf("Error: glXCreateNewContext failed\n"); @@ -475,13 +502,14 @@ make_window( Display *dpy, const char *name, XFree(fbconfig); + *glxWinRet = glxWin; *winRet = win; *ctxRet = ctx; } static void -event_loop(Display *dpy, Window win) +event_loop(Display *dpy, GLXWindow win) { while (1) { while (XPending(dpy) > 0) { @@ -558,6 +586,7 @@ main(int argc, char *argv[]) { Display *dpy; Window win; + GLXWindow glxWin; GLXContext ctx; const char *dpyName = NULL; GLboolean printInfo = GL_FALSE; @@ -579,9 +608,9 @@ main(int argc, char *argv[]) return -1; } - make_window(dpy, "glxgears", 0, 0, 300, 300, &win, &ctx); + make_window(dpy, "glxgears", 0, 0, 300, 300, &win, &glxWin, &ctx); XMapWindow(dpy, win); - glXMakeCurrent(dpy, win, ctx); + glXMakeCurrent(dpy, glxWin, ctx); if (printInfo) { printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); @@ -592,9 +621,10 @@ main(int argc, char *argv[]) init(); - event_loop(dpy, win); + event_loop(dpy, glxWin); glXDestroyContext(dpy, ctx); + destroy_window(dpy, glxWin); XDestroyWindow(dpy, win); XCloseDisplay(dpy); |