fix gl_stub so it works again and also get the gl functions being looked up

properly
This commit is contained in:
Bill Currie 2002-12-10 15:30:16 +00:00
parent 7da551d044
commit c158f0028b
4 changed files with 66 additions and 99 deletions

View file

@ -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);

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}