fix a nasty seg on gl startup causes by looped function pointers

This commit is contained in:
Bill Currie 2001-10-16 04:11:25 +00:00
parent d4396dfa78
commit 8417d23a94
2 changed files with 24 additions and 24 deletions

View file

@ -75,10 +75,10 @@ static const char rcsid[] =
typedef struct tfxMesaContext *fxMesaContext; typedef struct tfxMesaContext *fxMesaContext;
void (* fxMesaDestroyContext) (fxMesaContext ctx); void (* qf_fxMesaDestroyContext) (fxMesaContext ctx);
void (* fxMesaSwapBuffers) (void); void (* qf_fxMesaSwapBuffers) (void);
fxMesaContext (* fxMesaCreateContext) (GLuint win, GrScreenResolution_t, GrScreenRefresh_t, const GLint attribList[]); fxMesaContext (* qf_fxMesaCreateContext) (GLuint win, GrScreenResolution_t, GrScreenRefresh_t, const GLint attribList[]);
void (* fxMesaMakeCurrent) (fxMesaContext ctx); void (* qf_fxMesaMakeCurrent) (fxMesaContext ctx);
// FIXME!!!!! This belongs in include/qfgl_ext.h -- deek // FIXME!!!!! This belongs in include/qfgl_ext.h -- deek
typedef void (GLAPIENTRY * QF_3DfxSetDitherModeEXT) (GrDitherMode_t mode); typedef void (GLAPIENTRY * QF_3DfxSetDitherModeEXT) (GrDitherMode_t mode);
@ -101,7 +101,7 @@ VID_Shutdown (void)
if (!fc) if (!fc)
return; return;
fxMesaDestroyContext (fc); qf_fxMesaDestroyContext (fc);
} }
void void
@ -161,7 +161,7 @@ void
GL_EndRendering (void) GL_EndRendering (void)
{ {
qfglFlush (); qfglFlush ();
fxMesaSwapBuffers (); qf_fxMesaSwapBuffers ();
Sbar_Changed (); Sbar_Changed ();
} }
@ -265,13 +265,13 @@ VID_Init (unsigned char *palette)
GL_Pre_Init (); GL_Pre_Init ();
fxMesaCreateContext = QFGL_ProcAddress (libgl_handle, qf_fxMesaCreateContext = QFGL_ProcAddress (libgl_handle,
"fxMesaCreateContext", true); "fxMesaCreateContext", true);
fxMesaDestroyContext = QFGL_ProcAddress (libgl_handle, qf_fxMesaDestroyContext = QFGL_ProcAddress (libgl_handle,
"fxMesaDestroyContext", true); "fxMesaDestroyContext", true);
fxMesaMakeCurrent = QFGL_ProcAddress (libgl_handle, qf_fxMesaMakeCurrent = QFGL_ProcAddress (libgl_handle,
"fxMesaMakeCurrent", true); "fxMesaMakeCurrent", true);
fxMesaSwapBuffers = QFGL_ProcAddress (libgl_handle, qf_fxMesaSwapBuffers = QFGL_ProcAddress (libgl_handle,
"fxMesaSwapBuffers", true); "fxMesaSwapBuffers", true);
VID_GetWindowSize (640, 480); VID_GetWindowSize (640, 480);
@ -309,12 +309,12 @@ VID_Init (unsigned char *palette)
vid.conheight = max (vid.conheight, 200); vid.conheight = max (vid.conheight, 200);
fc = fxMesaCreateContext (0, findres (&scr_width, &scr_height), fc = qf_fxMesaCreateContext (0, findres (&scr_width, &scr_height),
GR_REFRESH_75Hz, attribs); GR_REFRESH_75Hz, attribs);
if (!fc) if (!fc)
Sys_Error ("Unable to create 3DFX context.\n"); Sys_Error ("Unable to create 3DFX context.\n");
fxMesaMakeCurrent (fc); qf_fxMesaMakeCurrent (fc);
vid.width = vid.conwidth = min (vid.conwidth, scr_width); vid.width = vid.conwidth = min (vid.conwidth, scr_width);
vid.height = vid.conheight = min (vid.conheight, scr_height); vid.height = vid.conheight = min (vid.conheight, scr_height);

View file

@ -81,10 +81,10 @@ typedef struct __GLXcontextRec *GLXContext;
static GLXContext ctx = NULL; static GLXContext ctx = NULL;
typedef XID GLXDrawable; typedef XID GLXDrawable;
void (* glXSwapBuffers) (Display *dpy, GLXDrawable drawable); void (* qfglXSwapBuffers) (Display *dpy, GLXDrawable drawable);
XVisualInfo* (* glXChooseVisual) (Display *dpy, int screen, int *attribList); XVisualInfo* (* qfglXChooseVisual) (Display *dpy, int screen, int *attribList);
GLXContext (* glXCreateContext) (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct); GLXContext (* qfglXCreateContext) (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);
Bool (* glXMakeCurrent) (Display *dpy, GLXDrawable drawable, GLXContext ctx); Bool (* qfglXMakeCurrent) (Display *dpy, GLXDrawable drawable, GLXContext ctx);
extern void GL_Pre_Init (void); extern void GL_Pre_Init (void);
extern void GL_Init_Common (void); extern void GL_Init_Common (void);
@ -120,7 +120,7 @@ void
GL_EndRendering (void) GL_EndRendering (void)
{ {
qfglFlush (); qfglFlush ();
glXSwapBuffers (x_disp, x_win); qfglXSwapBuffers (x_disp, x_win);
Sbar_Changed (); Sbar_Changed ();
} }
@ -145,11 +145,11 @@ VID_Init (unsigned char *palette)
GL_Pre_Init (); GL_Pre_Init ();
glXSwapBuffers = QFGL_ProcAddress (libgl_handle, "glXSwapBuffers", true); qfglXSwapBuffers = QFGL_ProcAddress (libgl_handle, "glXSwapBuffers", true);
glXChooseVisual = QFGL_ProcAddress (libgl_handle, "glXChooseVisual", true); qfglXChooseVisual = QFGL_ProcAddress (libgl_handle, "glXChooseVisual", true);
glXCreateContext = QFGL_ProcAddress (libgl_handle, "glXCreateContext", qfglXCreateContext = QFGL_ProcAddress (libgl_handle, "glXCreateContext",
true); true);
glXMakeCurrent = QFGL_ProcAddress (libgl_handle, "glXMakeCurrent", true); qfglXMakeCurrent = QFGL_ProcAddress (libgl_handle, "glXMakeCurrent", true);
Cmd_AddCommand ("vid_center", VID_Center_f, "Center the view port on the " Cmd_AddCommand ("vid_center", VID_Center_f, "Center the view port on the "
"quake window in a virtual desktop.\n"); "quake window in a virtual desktop.\n");
@ -184,7 +184,7 @@ VID_Init (unsigned char *palette)
X11_OpenDisplay (); X11_OpenDisplay ();
x_visinfo = glXChooseVisual (x_disp, x_screen, attrib); x_visinfo = qfglXChooseVisual (x_disp, x_screen, attrib);
if (!x_visinfo) { if (!x_visinfo) {
Sys_Error ("Error couldn't get an RGB, Double-buffered, Depth " Sys_Error ("Error couldn't get an RGB, Double-buffered, Depth "
"visual\n"); "visual\n");
@ -198,9 +198,9 @@ VID_Init (unsigned char *palette)
XSync (x_disp, 0); XSync (x_disp, 0);
ctx = glXCreateContext (x_disp, x_visinfo, NULL, True); ctx = qfglXCreateContext (x_disp, x_visinfo, NULL, True);
glXMakeCurrent (x_disp, x_win, ctx); qfglXMakeCurrent (x_disp, x_win, ctx);
vid.height = vid.conheight = min (vid.conheight, scr_height); vid.height = vid.conheight = min (vid.conheight, scr_height);
vid.width = vid.conwidth = min (vid.conwidth, scr_width); vid.width = vid.conwidth = min (vid.conwidth, scr_width);