mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
fix some init order issues brought up by the new gl_funcs.c code.
This commit is contained in:
parent
fd25261ab3
commit
460a270a54
7 changed files with 25 additions and 40 deletions
|
@ -37,6 +37,8 @@
|
|||
#include "QF/GL/qf_funcs_list.h"
|
||||
#undef QFGL_NEED
|
||||
|
||||
extern void *libgl_handle;
|
||||
|
||||
qboolean GLF_Init (void);
|
||||
void *QFGL_ProcAddress (void *, const char *, qboolean);
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@ ret (GLAPIENTRY * qf##name) args = NULL;
|
|||
#include "QF/GL/qf_funcs_list.h"
|
||||
#undef QFGL_NEED
|
||||
|
||||
void *libgl_handle;
|
||||
|
||||
#if defined(HAVE_DLOPEN)
|
||||
|
||||
static QF_glXGetProcAddressARB glGetProcAddress = NULL;
|
||||
|
@ -119,18 +121,13 @@ QFGL_LoadLibrary (void)
|
|||
qboolean
|
||||
GLF_Init (void)
|
||||
{
|
||||
void *handle;
|
||||
|
||||
handle = QFGL_LoadLibrary ();
|
||||
libgl_handle = QFGL_LoadLibrary ();
|
||||
|
||||
#define QFGL_NEED(ret, name, args) \
|
||||
qf##name = QFGL_ProcAddress (handle, #name, true);
|
||||
qf##name = QFGL_ProcAddress (libgl_handle, #name, true);
|
||||
#include "QF/GL/qf_funcs_list.h"
|
||||
#undef QFGL_NEED
|
||||
|
||||
// tell ProcAddress to clear its cache
|
||||
QFGL_ProcAddress (NULL, NULL, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,10 +88,9 @@ cvar_t *tdfx_brighten;
|
|||
|
||||
static fxMesaContext fc = NULL;
|
||||
|
||||
void *libgl_handle;
|
||||
|
||||
int VID_options_items = 0;
|
||||
|
||||
extern void GL_Pre_Init (void);
|
||||
extern void GL_Init_Common (void);
|
||||
extern void VID_Init8bitPalette (void);
|
||||
|
||||
|
@ -264,15 +263,8 @@ VID_Init (unsigned char *palette)
|
|||
int i;
|
||||
GLint attribs[32];
|
||||
|
||||
#ifdef HAVE_DLOPEN
|
||||
if (!(libgl_handle = dlopen (gl_driver->string, RTLD_NOW))) {
|
||||
Sys_Error ("Can't open OpenGL library \"%s\": %s\n", gl_driver->string,
|
||||
dlerror());
|
||||
return;
|
||||
}
|
||||
#else
|
||||
# error "No dynamic library support. FIXME."
|
||||
#endif
|
||||
GL_Pre_Init ();
|
||||
|
||||
fxMesaCreateContext = QFGL_ProcAddress (libgl_handle,
|
||||
"fxMesaCreateContext", true);
|
||||
fxMesaDestroyContext = QFGL_ProcAddress (libgl_handle,
|
||||
|
@ -282,7 +274,6 @@ VID_Init (unsigned char *palette)
|
|||
fxMesaSwapBuffers = QFGL_ProcAddress (libgl_handle,
|
||||
"fxMesaSwapBuffers", true);
|
||||
|
||||
QFGL_ProcAddress (NULL, NULL, false);
|
||||
VID_GetWindowSize (640, 480);
|
||||
Con_CheckResize (); // Now that we have a window size, fix console
|
||||
|
||||
|
|
|
@ -228,17 +228,21 @@ VID_SetPalette (unsigned char *palette)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
GL_Pre_Init (void)
|
||||
{
|
||||
if (!GLF_Init()) {
|
||||
Sys_Error("Can't init video.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GL_Init_Common
|
||||
*/
|
||||
void
|
||||
GL_Init_Common (void)
|
||||
{
|
||||
if (!GLF_Init()) {
|
||||
Sys_Error("Can't init video.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
gl_vendor = qfglGetString (GL_VENDOR);
|
||||
Con_Printf ("GL_VENDOR: %s\n", gl_vendor);
|
||||
gl_renderer = qfglGetString (GL_RENDERER);
|
||||
|
|
|
@ -86,6 +86,7 @@ XVisualInfo* (* glXChooseVisual) (Display *dpy, int screen, int *attribList);
|
|||
GLXContext (* glXCreateContext) (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);
|
||||
Bool (* glXMakeCurrent) (Display *dpy, GLXDrawable drawable, GLXContext ctx);
|
||||
|
||||
extern void GL_Pre_Init (void);
|
||||
extern void GL_Init_Common (void);
|
||||
extern void VID_Init8bitPalette (void);
|
||||
|
||||
|
@ -95,7 +96,6 @@ const char *gl_vendor;
|
|||
const char *gl_renderer;
|
||||
const char *gl_version;
|
||||
const char *gl_extensions;
|
||||
void *libgl_handle;
|
||||
|
||||
|
||||
void
|
||||
|
@ -143,22 +143,13 @@ VID_Init (unsigned char *palette)
|
|||
None
|
||||
};
|
||||
|
||||
#ifdef HAVE_DLOPEN
|
||||
if (!(libgl_handle = dlopen (gl_driver->string, RTLD_NOW))) {
|
||||
Sys_Error ("Can't open OpenGL library \"%s\": %s\n", gl_driver->string,
|
||||
dlerror());
|
||||
return;
|
||||
}
|
||||
#else
|
||||
# error "No dynamic library support. FIXME."
|
||||
#endif
|
||||
GL_Pre_Init ();
|
||||
|
||||
glXSwapBuffers = QFGL_ProcAddress (libgl_handle, "glXSwapBuffers", true);
|
||||
glXChooseVisual = QFGL_ProcAddress (libgl_handle, "glXChooseVisual", true);
|
||||
glXCreateContext = QFGL_ProcAddress (libgl_handle, "glXCreateContext",
|
||||
true);
|
||||
glXMakeCurrent = QFGL_ProcAddress (libgl_handle, "glXMakeCurrent", true);
|
||||
QFGL_ProcAddress (NULL, NULL, false); // make ProcAddress clear its cache
|
||||
|
||||
Cmd_AddCommand ("vid_center", VID_Center_f, "Center the view port on the "
|
||||
"quake window in a virtual desktop.\n");
|
||||
|
|
|
@ -69,6 +69,7 @@ cvar_t *vid_system_gamma;
|
|||
int VID_options_items = 1;
|
||||
int modestate;
|
||||
|
||||
extern void GL_Pre_Init (void);
|
||||
extern void GL_Init_Common (void);
|
||||
extern void VID_Init8bitPalette (void);
|
||||
|
||||
|
@ -134,6 +135,8 @@ VID_Init (unsigned char *palette)
|
|||
Uint32 flags = SDL_OPENGL;
|
||||
int i;
|
||||
|
||||
GL_Pre_Init ();
|
||||
|
||||
// SDL_SysWMinfo info;
|
||||
|
||||
VID_GetWindowSize (640, 480);
|
||||
|
|
|
@ -55,6 +55,7 @@ static const char rcsid[] =
|
|||
#include "resource.h"
|
||||
#include "sbar.h"
|
||||
|
||||
extern void GL_Pre_Init (void);
|
||||
extern void GL_Init_Common (void);
|
||||
extern void VID_Init8bitPalette (void);
|
||||
|
||||
|
@ -108,7 +109,6 @@ const char *gl_vendor;
|
|||
const char *gl_renderer;
|
||||
const char *gl_version;
|
||||
const char *gl_extensions;
|
||||
void *libgl_handle;
|
||||
|
||||
// 8-bit and permedia support
|
||||
qboolean isPermedia = false;
|
||||
|
@ -1138,10 +1138,7 @@ VID_Init (unsigned char *palette)
|
|||
HGLRC baseRC;
|
||||
DWORD lasterror;
|
||||
|
||||
if (!(libgl_handle = LoadLibrary (gl_driver->string))) {
|
||||
Sys_Error ("Can't open OpenGL library \"%s\"\n", gl_driver->string);
|
||||
return;
|
||||
}
|
||||
GL_Pre_Init ();
|
||||
|
||||
qf_wglCreateContext = QFGL_ProcAddress (libgl_handle, "wglCreateContext",
|
||||
true);
|
||||
|
|
Loading…
Reference in a new issue