From c158f0028beecf32bb787d1ba70aca729286abc5 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 10 Dec 2002 15:30:16 +0000 Subject: [PATCH] fix gl_stub so it works again and also get the gl functions being looked up properly --- libs/video/targets/vid_glx.c | 4 ++- tools/gl_stub/gl_stub.c | 68 +++++++++++++++++++++++++++++++++--- tools/gl_stub/gls_norm.c | 43 ----------------------- tools/gl_stub/gls_trace.c | 50 -------------------------- 4 files changed, 66 insertions(+), 99 deletions(-) diff --git a/libs/video/targets/vid_glx.c b/libs/video/targets/vid_glx.c index 3a1ed5e97..9fbd69aea 100644 --- a/libs/video/targets/vid_glx.c +++ b/libs/video/targets/vid_glx.c @@ -90,7 +90,7 @@ Bool (* qfglXMakeCurrent) (Display *dpy, GLXDrawable drawable, GLXContext ctx); // ============================================================================ -static int use_gl_procaddress; +static int use_gl_procaddress = 1; #if defined(HAVE_DLOPEN) @@ -186,6 +186,8 @@ VID_Init (unsigned char *palette) GL_Pre_Init (); + use_gl_procaddress = 0; + qfglXSwapBuffers = QFGL_ProcAddress (libgl_handle, "glXSwapBuffers", true); qfglXChooseVisual = QFGL_ProcAddress (libgl_handle, "glXChooseVisual", true); diff --git a/tools/gl_stub/gl_stub.c b/tools/gl_stub/gl_stub.c index 9eef4f5a0..8196f8f35 100644 --- a/tools/gl_stub/gl_stub.c +++ b/tools/gl_stub/gl_stub.c @@ -14,6 +14,10 @@ typedef XID GLXDrawable; typedef struct __GLXcontextRec *GLXContext; +#define TRACE do { \ + puts (__FUNCTION__);\ +} while (0) + #define QFGL_DONT_NEED(ret, func, params) QFGL_NEED(ret, func, params) #undef QFGL_NEED @@ -21,13 +25,11 @@ typedef struct __GLXcontextRec *GLXContext; #define QFGL_NEED(ret, name, args) \ ret GLAPIENTRY norm_##name args; #include "QF/GL/qf_funcs_list.h" -#include "glx_funcs_list.h" #undef QFGL_NEED #define QFGL_NEED(ret, name, args) \ ret GLAPIENTRY trace_##name args; #include "QF/GL/qf_funcs_list.h" -#include "glx_funcs_list.h" #undef QFGL_NEED typedef struct { @@ -36,11 +38,12 @@ typedef struct { void *trace; } gl_stub_t; +static int trace; + static gl_stub_t gl_stub_funcs[] = { #define QFGL_NEED(ret, name, args) \ {#name, norm_##name, trace_##name}, #include "QF/GL/qf_funcs_list.h" -#include "glx_funcs_list.h" #undef QFGL_NEED }; @@ -56,10 +59,9 @@ void * glXGetProcAddressARB (const GLubyte *procName) { static int called; - static int trace; gl_stub_t *stub; gl_stub_t key; - +puts(procName); if (!called) { char *glstub_trace; @@ -76,3 +78,59 @@ glXGetProcAddressARB (const GLubyte *procName) return 0; return trace ? stub->trace : stub->norm; } + +void +glXSwapBuffers (Display *dpy, GLXDrawable drawable) +{ + if (trace) + TRACE; +} + +XVisualInfo* +glXChooseVisual (Display *dpy, int screen, int *attribList) +{ + XVisualInfo template; + int num_visuals; + int template_mask; + + if (trace) + TRACE; + + template_mask = 0; + template.visualid = + XVisualIDFromVisual (XDefaultVisual (dpy, screen)); + template_mask = VisualIDMask; + return XGetVisualInfo (dpy, template_mask, &template, &num_visuals); +} + +GLXContext +glXCreateContext (Display *dpy, XVisualInfo *vis, GLXContext shareList, + Bool direct) +{ + if (trace) + TRACE; + return (GLXContext)1; +} + +Bool +glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx) +{ + if (trace) + TRACE; + return 1; +} + +void +glXDestroyContext (Display *dpy, GLXContext ctx ) +{ + if (trace) + TRACE; +} + +int +glXGetConfig (Display *dpy, XVisualInfo *visual, int attrib, int *value ) +{ + if (trace) + TRACE; + return 0; +} diff --git a/tools/gl_stub/gls_norm.c b/tools/gl_stub/gls_norm.c index bcabea51a..204ac9cf5 100644 --- a/tools/gl_stub/gls_norm.c +++ b/tools/gl_stub/gls_norm.c @@ -1957,46 +1957,3 @@ void norm_glViewport (GLint x, GLint y, GLsizei width, GLsizei height) { } - -void -norm_glXSwapBuffers (Display *dpy, GLXDrawable drawable) -{ -} - -XVisualInfo* -norm_glXChooseVisual (Display *dpy, int screen, int *attribList) -{ - XVisualInfo template; - int num_visuals; - int template_mask; - - template_mask = 0; - template.visualid = - XVisualIDFromVisual (XDefaultVisual (dpy, screen)); - template_mask = VisualIDMask; - return XGetVisualInfo (dpy, template_mask, &template, &num_visuals); -} - -GLXContext -norm_glXCreateContext (Display *dpy, XVisualInfo *vis, GLXContext shareList, - Bool direct) -{ - return (GLXContext)1; -} - -Bool -norm_glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx) -{ - return 1; -} - -void -norm_glXDestroyContext (Display *dpy, GLXContext ctx ) -{ -} - -int -norm_glXGetConfig (Display *dpy, XVisualInfo *visual, int attrib, int *value ) -{ - return 0; -} diff --git a/tools/gl_stub/gls_trace.c b/tools/gl_stub/gls_trace.c index 11b59add6..0aba693ee 100644 --- a/tools/gl_stub/gls_trace.c +++ b/tools/gl_stub/gls_trace.c @@ -2335,53 +2335,3 @@ trace_glViewport (GLint x, GLint y, GLsizei width, GLsizei height) { TRACE; } - -void -trace_glXSwapBuffers (Display *dpy, GLXDrawable drawable) -{ - TRACE; -} - -XVisualInfo* -trace_glXChooseVisual (Display *dpy, int screen, int *attribList) -{ - XVisualInfo template; - int num_visuals; - int template_mask; - - TRACE; - - template_mask = 0; - template.visualid = - XVisualIDFromVisual (XDefaultVisual (dpy, screen)); - template_mask = VisualIDMask; - return XGetVisualInfo (dpy, template_mask, &template, &num_visuals); -} - -GLXContext -trace_glXCreateContext (Display *dpy, XVisualInfo *vis, GLXContext shareList, - Bool direct) -{ - TRACE; - return (GLXContext)1; -} - -Bool -trace_glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx) -{ - TRACE; - return 1; -} - -void -trace_glXDestroyContext (Display *dpy, GLXContext ctx ) -{ - TRACE; -} - -int -trace_glXGetConfig (Display *dpy, XVisualInfo *visual, int attrib, int *value ) -{ - TRACE; - return 0; -}