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"
|
#include "QF/GL/qf_funcs_list.h"
|
||||||
#undef QFGL_NEED
|
#undef QFGL_NEED
|
||||||
|
|
||||||
|
extern void *libgl_handle;
|
||||||
|
|
||||||
qboolean GLF_Init (void);
|
qboolean GLF_Init (void);
|
||||||
void *QFGL_ProcAddress (void *, const char *, qboolean);
|
void *QFGL_ProcAddress (void *, const char *, qboolean);
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,8 @@ ret (GLAPIENTRY * qf##name) args = NULL;
|
||||||
#include "QF/GL/qf_funcs_list.h"
|
#include "QF/GL/qf_funcs_list.h"
|
||||||
#undef QFGL_NEED
|
#undef QFGL_NEED
|
||||||
|
|
||||||
|
void *libgl_handle;
|
||||||
|
|
||||||
#if defined(HAVE_DLOPEN)
|
#if defined(HAVE_DLOPEN)
|
||||||
|
|
||||||
static QF_glXGetProcAddressARB glGetProcAddress = NULL;
|
static QF_glXGetProcAddressARB glGetProcAddress = NULL;
|
||||||
|
@ -119,18 +121,13 @@ QFGL_LoadLibrary (void)
|
||||||
qboolean
|
qboolean
|
||||||
GLF_Init (void)
|
GLF_Init (void)
|
||||||
{
|
{
|
||||||
void *handle;
|
libgl_handle = QFGL_LoadLibrary ();
|
||||||
|
|
||||||
handle = QFGL_LoadLibrary ();
|
|
||||||
|
|
||||||
#define QFGL_NEED(ret, name, args) \
|
#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"
|
#include "QF/GL/qf_funcs_list.h"
|
||||||
#undef QFGL_NEED
|
#undef QFGL_NEED
|
||||||
|
|
||||||
// tell ProcAddress to clear its cache
|
|
||||||
QFGL_ProcAddress (NULL, NULL, false);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,10 +88,9 @@ cvar_t *tdfx_brighten;
|
||||||
|
|
||||||
static fxMesaContext fc = NULL;
|
static fxMesaContext fc = NULL;
|
||||||
|
|
||||||
void *libgl_handle;
|
|
||||||
|
|
||||||
int VID_options_items = 0;
|
int VID_options_items = 0;
|
||||||
|
|
||||||
|
extern void GL_Pre_Init (void);
|
||||||
extern void GL_Init_Common (void);
|
extern void GL_Init_Common (void);
|
||||||
extern void VID_Init8bitPalette (void);
|
extern void VID_Init8bitPalette (void);
|
||||||
|
|
||||||
|
@ -264,15 +263,8 @@ VID_Init (unsigned char *palette)
|
||||||
int i;
|
int i;
|
||||||
GLint attribs[32];
|
GLint attribs[32];
|
||||||
|
|
||||||
#ifdef HAVE_DLOPEN
|
GL_Pre_Init ();
|
||||||
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
|
|
||||||
fxMesaCreateContext = QFGL_ProcAddress (libgl_handle,
|
fxMesaCreateContext = QFGL_ProcAddress (libgl_handle,
|
||||||
"fxMesaCreateContext", true);
|
"fxMesaCreateContext", true);
|
||||||
fxMesaDestroyContext = QFGL_ProcAddress (libgl_handle,
|
fxMesaDestroyContext = QFGL_ProcAddress (libgl_handle,
|
||||||
|
@ -282,7 +274,6 @@ VID_Init (unsigned char *palette)
|
||||||
fxMesaSwapBuffers = QFGL_ProcAddress (libgl_handle,
|
fxMesaSwapBuffers = QFGL_ProcAddress (libgl_handle,
|
||||||
"fxMesaSwapBuffers", true);
|
"fxMesaSwapBuffers", true);
|
||||||
|
|
||||||
QFGL_ProcAddress (NULL, NULL, false);
|
|
||||||
VID_GetWindowSize (640, 480);
|
VID_GetWindowSize (640, 480);
|
||||||
Con_CheckResize (); // Now that we have a window size, fix console
|
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
|
GL_Init_Common
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
GL_Init_Common (void)
|
GL_Init_Common (void)
|
||||||
{
|
{
|
||||||
if (!GLF_Init()) {
|
|
||||||
Sys_Error("Can't init video.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gl_vendor = qfglGetString (GL_VENDOR);
|
gl_vendor = qfglGetString (GL_VENDOR);
|
||||||
Con_Printf ("GL_VENDOR: %s\n", gl_vendor);
|
Con_Printf ("GL_VENDOR: %s\n", gl_vendor);
|
||||||
gl_renderer = qfglGetString (GL_RENDERER);
|
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);
|
GLXContext (* glXCreateContext) (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);
|
||||||
Bool (* glXMakeCurrent) (Display *dpy, GLXDrawable drawable, GLXContext ctx);
|
Bool (* glXMakeCurrent) (Display *dpy, GLXDrawable drawable, GLXContext ctx);
|
||||||
|
|
||||||
|
extern void GL_Pre_Init (void);
|
||||||
extern void GL_Init_Common (void);
|
extern void GL_Init_Common (void);
|
||||||
extern void VID_Init8bitPalette (void);
|
extern void VID_Init8bitPalette (void);
|
||||||
|
|
||||||
|
@ -95,7 +96,6 @@ const char *gl_vendor;
|
||||||
const char *gl_renderer;
|
const char *gl_renderer;
|
||||||
const char *gl_version;
|
const char *gl_version;
|
||||||
const char *gl_extensions;
|
const char *gl_extensions;
|
||||||
void *libgl_handle;
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -143,22 +143,13 @@ VID_Init (unsigned char *palette)
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_DLOPEN
|
GL_Pre_Init ();
|
||||||
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
|
|
||||||
|
|
||||||
glXSwapBuffers = QFGL_ProcAddress (libgl_handle, "glXSwapBuffers", true);
|
glXSwapBuffers = QFGL_ProcAddress (libgl_handle, "glXSwapBuffers", true);
|
||||||
glXChooseVisual = QFGL_ProcAddress (libgl_handle, "glXChooseVisual", true);
|
glXChooseVisual = QFGL_ProcAddress (libgl_handle, "glXChooseVisual", true);
|
||||||
glXCreateContext = QFGL_ProcAddress (libgl_handle, "glXCreateContext",
|
glXCreateContext = QFGL_ProcAddress (libgl_handle, "glXCreateContext",
|
||||||
true);
|
true);
|
||||||
glXMakeCurrent = QFGL_ProcAddress (libgl_handle, "glXMakeCurrent", 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 "
|
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");
|
||||||
|
|
|
@ -69,6 +69,7 @@ cvar_t *vid_system_gamma;
|
||||||
int VID_options_items = 1;
|
int VID_options_items = 1;
|
||||||
int modestate;
|
int modestate;
|
||||||
|
|
||||||
|
extern void GL_Pre_Init (void);
|
||||||
extern void GL_Init_Common (void);
|
extern void GL_Init_Common (void);
|
||||||
extern void VID_Init8bitPalette (void);
|
extern void VID_Init8bitPalette (void);
|
||||||
|
|
||||||
|
@ -134,6 +135,8 @@ VID_Init (unsigned char *palette)
|
||||||
Uint32 flags = SDL_OPENGL;
|
Uint32 flags = SDL_OPENGL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
GL_Pre_Init ();
|
||||||
|
|
||||||
// SDL_SysWMinfo info;
|
// SDL_SysWMinfo info;
|
||||||
|
|
||||||
VID_GetWindowSize (640, 480);
|
VID_GetWindowSize (640, 480);
|
||||||
|
|
|
@ -55,6 +55,7 @@ static const char rcsid[] =
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "sbar.h"
|
#include "sbar.h"
|
||||||
|
|
||||||
|
extern void GL_Pre_Init (void);
|
||||||
extern void GL_Init_Common (void);
|
extern void GL_Init_Common (void);
|
||||||
extern void VID_Init8bitPalette (void);
|
extern void VID_Init8bitPalette (void);
|
||||||
|
|
||||||
|
@ -108,7 +109,6 @@ const char *gl_vendor;
|
||||||
const char *gl_renderer;
|
const char *gl_renderer;
|
||||||
const char *gl_version;
|
const char *gl_version;
|
||||||
const char *gl_extensions;
|
const char *gl_extensions;
|
||||||
void *libgl_handle;
|
|
||||||
|
|
||||||
// 8-bit and permedia support
|
// 8-bit and permedia support
|
||||||
qboolean isPermedia = false;
|
qboolean isPermedia = false;
|
||||||
|
@ -1138,10 +1138,7 @@ VID_Init (unsigned char *palette)
|
||||||
HGLRC baseRC;
|
HGLRC baseRC;
|
||||||
DWORD lasterror;
|
DWORD lasterror;
|
||||||
|
|
||||||
if (!(libgl_handle = LoadLibrary (gl_driver->string))) {
|
GL_Pre_Init ();
|
||||||
Sys_Error ("Can't open OpenGL library \"%s\"\n", gl_driver->string);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
qf_wglCreateContext = QFGL_ProcAddress (libgl_handle, "wglCreateContext",
|
qf_wglCreateContext = QFGL_ProcAddress (libgl_handle, "wglCreateContext",
|
||||||
true);
|
true);
|
||||||
|
|
Loading…
Reference in a new issue