mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Add QFGL_WANT, and ability to handle non-required extensions.
This commit is contained in:
parent
9abe3b29e0
commit
0e6681a069
8 changed files with 54 additions and 8 deletions
|
@ -37,9 +37,11 @@
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define QFGL_WANT(ret, name, args) extern ret (GLAPIENTRY * qf##name) args;
|
||||||
#define QFGL_NEED(ret, name, args) extern ret (GLAPIENTRY * qf##name) args;
|
#define QFGL_NEED(ret, name, args) extern ret (GLAPIENTRY * qf##name) args;
|
||||||
#include "QF/GL/qf_funcs_list.h"
|
#include "QF/GL/qf_funcs_list.h"
|
||||||
#undef QFGL_NEED
|
#undef QFGL_NEED
|
||||||
|
#undef QFGL_WANT
|
||||||
|
|
||||||
extern void *libgl_handle;
|
extern void *libgl_handle;
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
#define UNDEF_QFGL_DONT_NEED
|
#define UNDEF_QFGL_DONT_NEED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef QFGL_WANT
|
||||||
|
#define QFGL_WANT(ret, func, params)
|
||||||
|
#define UNDEF_QFGL_WANT
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef QFGL_NEED
|
#ifndef QFGL_NEED
|
||||||
#define QFGL_NEED(ret, func, params)
|
#define QFGL_NEED(ret, func, params)
|
||||||
#define UNDEF_QFGL_NEED
|
#define UNDEF_QFGL_NEED
|
||||||
|
@ -412,12 +417,16 @@ QFGL_NEED (void, glVertexPointer, (GLint size, GLenum type, GLsizei stride, cons
|
||||||
QFGL_NEED (void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height))
|
QFGL_NEED (void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height))
|
||||||
|
|
||||||
// ATI Extensions
|
// ATI Extensions
|
||||||
QFGL_NEED (void, glPNTrianglesiATI, (GLenum pname, GLint param))
|
QFGL_WANT (void, glPNTrianglesiATI, (GLenum pname, GLint param))
|
||||||
|
|
||||||
#ifdef UNDEF_QFGL_DONT_NEED
|
#ifdef UNDEF_QFGL_DONT_NEED
|
||||||
#undef QFGL_DONT_NEED
|
#undef QFGL_DONT_NEED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef UNDEF_QFGL_WANT
|
||||||
|
#undef QFGL_WANT
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef UNDEF_QFGL_NEED
|
#ifdef UNDEF_QFGL_NEED
|
||||||
#undef QFGL_DONT_NEED
|
#undef QFGL_DONT_NEED
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -36,6 +36,7 @@ extern struct cvar_s *gl_sky_clip;
|
||||||
extern struct cvar_s *gl_sky_debug;
|
extern struct cvar_s *gl_sky_debug;
|
||||||
extern struct cvar_s *gl_sky_divide;
|
extern struct cvar_s *gl_sky_divide;
|
||||||
extern struct cvar_s *gl_sky_multipass;
|
extern struct cvar_s *gl_sky_multipass;
|
||||||
|
extern struct cvar_s *gl_tessellate;
|
||||||
extern struct cvar_s *gl_texsort;
|
extern struct cvar_s *gl_texsort;
|
||||||
extern struct cvar_s *gl_triplebuffer;
|
extern struct cvar_s *gl_triplebuffer;
|
||||||
|
|
||||||
|
|
|
@ -94,10 +94,13 @@ QFGL_ProcAddress (void *handle, const char *name, qboolean crit)
|
||||||
}
|
}
|
||||||
|
|
||||||
// First we need to get all the function pointers declared.
|
// First we need to get all the function pointers declared.
|
||||||
#define QFGL_NEED(ret, name, args) \
|
#define QFGL_WANT(ret, name, args) \
|
||||||
|
ret (GLAPIENTRY * qf##name) args;
|
||||||
|
#define QFGL_NEED(ret, name, args) \
|
||||||
ret (GLAPIENTRY * qf##name) args;
|
ret (GLAPIENTRY * qf##name) args;
|
||||||
#include "QF/GL/qf_funcs_list.h"
|
#include "QF/GL/qf_funcs_list.h"
|
||||||
#undef QFGL_NEED
|
#undef QFGL_NEED
|
||||||
|
#undef QFGL_WANT
|
||||||
void *libgl_handle;
|
void *libgl_handle;
|
||||||
|
|
||||||
// Then we need to open the libGL and set all the symbols.
|
// Then we need to open the libGL and set all the symbols.
|
||||||
|
@ -106,10 +109,13 @@ GLF_Init (void)
|
||||||
{
|
{
|
||||||
libgl_handle = QFGL_LoadLibrary ();
|
libgl_handle = QFGL_LoadLibrary ();
|
||||||
|
|
||||||
#define QFGL_NEED(ret, name, args) \
|
#define QFGL_WANT(ret, name, args) \
|
||||||
|
qf##name = QFGL_ProcAddress (libgl_handle, #name, false);
|
||||||
|
#define QFGL_NEED(ret, name, args) \
|
||||||
qf##name = QFGL_ProcAddress (libgl_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
|
||||||
|
#undef QFGL_WANT
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,10 +165,10 @@ GL_Common_Init_Cvars (void)
|
||||||
gl_screenshot_byte_swap_f, "Swap the bytes for gl "
|
gl_screenshot_byte_swap_f, "Swap the bytes for gl "
|
||||||
"screenshots. Needed if you get screenshots with red and "
|
"screenshots. Needed if you get screenshots with red and "
|
||||||
"blue swapped.");
|
"blue swapped.");
|
||||||
gl_tessellate = Cvar_Get ("gl_tessellate", "0", CVAR_NONE, gl_tessellate_f,
|
gl_tessellate =
|
||||||
nva ("Specifies tessellation level from 0 to "
|
Cvar_Get ("gl_tessellate", "0", CVAR_NONE, gl_tessellate_f,
|
||||||
"%i. Quadruples the triangle count at each "
|
nva ("Specifies tessellation level from 0 to %i. Higher "
|
||||||
"tessellation level.", tess_max));
|
"tessellation level means more triangles.", tess_max));
|
||||||
gl_vaelements_max = Cvar_Get ("gl_vaelements_max", "0", CVAR_ROM, NULL,
|
gl_vaelements_max = Cvar_Get ("gl_vaelements_max", "0", CVAR_ROM, NULL,
|
||||||
"Limit the vertex array size for buggy "
|
"Limit the vertex array size for buggy "
|
||||||
"drivers. 0 (default) uses driver provided "
|
"drivers. 0 (default) uses driver provided "
|
||||||
|
|
|
@ -40,21 +40,27 @@
|
||||||
|
|
||||||
#define QFGL_DONT_NEED(ret, func, params) QFGL_NEED(ret, func, params)
|
#define QFGL_DONT_NEED(ret, func, params) QFGL_NEED(ret, func, params)
|
||||||
|
|
||||||
|
#undef QFGL_WANT
|
||||||
#undef QFGL_NEED
|
#undef QFGL_NEED
|
||||||
|
#define QFGL_WANT(ret, name, args) \
|
||||||
|
ret GLAPIENTRY norm_##name args;
|
||||||
#define QFGL_NEED(ret, name, args) \
|
#define QFGL_NEED(ret, name, args) \
|
||||||
ret GLAPIENTRY norm_##name args;
|
ret GLAPIENTRY norm_##name args;
|
||||||
#include "QF/GL/qf_funcs_list.h"
|
#include "QF/GL/qf_funcs_list.h"
|
||||||
#undef QFGL_NEED
|
#undef QFGL_NEED
|
||||||
|
#undef QFGL_WANT
|
||||||
fxMesaContext norm_fxMesaCreateContext (GLuint win, GrScreenResolution_t res, GrScreenRefresh_t ref, const GLint attribList[]);
|
fxMesaContext norm_fxMesaCreateContext (GLuint win, GrScreenResolution_t res, GrScreenRefresh_t ref, const GLint attribList[]);
|
||||||
void norm_fxMesaMakeCurrent(fxMesaContext fxMesa);
|
void norm_fxMesaMakeCurrent(fxMesaContext fxMesa);
|
||||||
void norm_fxMesaDestroyContext(fxMesaContext fxMesa);
|
void norm_fxMesaDestroyContext(fxMesaContext fxMesa);
|
||||||
void norm_fxMesaSwapBuffers(void);
|
void norm_fxMesaSwapBuffers(void);
|
||||||
|
|
||||||
|
#define QFGL_WANT(ret, name, args) \
|
||||||
|
ret GLAPIENTRY trace_##name args;
|
||||||
#define QFGL_NEED(ret, name, args) \
|
#define QFGL_NEED(ret, name, args) \
|
||||||
ret GLAPIENTRY trace_##name args;
|
ret GLAPIENTRY trace_##name args;
|
||||||
#include "QF/GL/qf_funcs_list.h"
|
#include "QF/GL/qf_funcs_list.h"
|
||||||
#undef QFGL_NEED
|
#undef QFGL_NEED
|
||||||
|
#undef QFGL_WANT
|
||||||
fxMesaContext trace_fxMesaCreateContext (GLuint win, GrScreenResolution_t res, GrScreenRefresh_t ref, const GLint attribList[]);
|
fxMesaContext trace_fxMesaCreateContext (GLuint win, GrScreenResolution_t res, GrScreenRefresh_t ref, const GLint attribList[]);
|
||||||
void trace_fxMesaMakeCurrent(fxMesaContext fxMesa);
|
void trace_fxMesaMakeCurrent(fxMesaContext fxMesa);
|
||||||
void trace_fxMesaDestroyContext(fxMesaContext fxMesa);
|
void trace_fxMesaDestroyContext(fxMesaContext fxMesa);
|
||||||
|
@ -67,10 +73,13 @@ typedef struct {
|
||||||
} gl_stub_t;
|
} gl_stub_t;
|
||||||
|
|
||||||
static gl_stub_t gl_stub_funcs[] = {
|
static gl_stub_t gl_stub_funcs[] = {
|
||||||
|
#define QFGL_WANT(ret, name, args) \
|
||||||
|
{#name, norm_##name, trace_##name},
|
||||||
#define QFGL_NEED(ret, name, args) \
|
#define QFGL_NEED(ret, name, args) \
|
||||||
{#name, norm_##name, trace_##name},
|
{#name, norm_##name, trace_##name},
|
||||||
#include "QF/GL/qf_funcs_list.h"
|
#include "QF/GL/qf_funcs_list.h"
|
||||||
#undef QFGL_NEED
|
#undef QFGL_NEED
|
||||||
|
#undef QFGL_WANT
|
||||||
{"fxMesaCreateContext", norm_fxMesaCreateContext, trace_fxMesaCreateContext},
|
{"fxMesaCreateContext", norm_fxMesaCreateContext, trace_fxMesaCreateContext},
|
||||||
{"fxMesaMakeCurrent", norm_fxMesaMakeCurrent, trace_fxMesaMakeCurrent},
|
{"fxMesaMakeCurrent", norm_fxMesaMakeCurrent, trace_fxMesaMakeCurrent},
|
||||||
{"fxMesaDestroyContext", norm_fxMesaDestroyContext, trace_fxMesaDestroyContext},
|
{"fxMesaDestroyContext", norm_fxMesaDestroyContext, trace_fxMesaDestroyContext},
|
||||||
|
|
|
@ -20,17 +20,24 @@ typedef struct __GLXcontextRec *GLXContext;
|
||||||
|
|
||||||
#define QFGL_DONT_NEED(ret, func, params) QFGL_NEED(ret, func, params)
|
#define QFGL_DONT_NEED(ret, func, params) QFGL_NEED(ret, func, params)
|
||||||
|
|
||||||
|
#undef QFGL_WANT
|
||||||
#undef QFGL_NEED
|
#undef QFGL_NEED
|
||||||
|
|
||||||
|
#define QFGL_WANT(ret, name, args) \
|
||||||
|
ret GLAPIENTRY norm_##name args;
|
||||||
#define QFGL_NEED(ret, name, args) \
|
#define QFGL_NEED(ret, name, args) \
|
||||||
ret GLAPIENTRY norm_##name args;
|
ret GLAPIENTRY norm_##name args;
|
||||||
#include "QF/GL/qf_funcs_list.h"
|
#include "QF/GL/qf_funcs_list.h"
|
||||||
#undef QFGL_NEED
|
#undef QFGL_NEED
|
||||||
|
#undef QFGL_WANT
|
||||||
|
|
||||||
|
#define QFGL_WANT(ret, name, args) \
|
||||||
|
ret GLAPIENTRY trace_##name args;
|
||||||
#define QFGL_NEED(ret, name, args) \
|
#define QFGL_NEED(ret, name, args) \
|
||||||
ret GLAPIENTRY trace_##name args;
|
ret GLAPIENTRY trace_##name args;
|
||||||
#include "QF/GL/qf_funcs_list.h"
|
#include "QF/GL/qf_funcs_list.h"
|
||||||
#undef QFGL_NEED
|
#undef QFGL_NEED
|
||||||
|
#undef QFGL_WANT
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *name;
|
const char *name;
|
||||||
|
@ -41,10 +48,13 @@ typedef struct {
|
||||||
static int trace;
|
static int trace;
|
||||||
|
|
||||||
static gl_stub_t gl_stub_funcs[] = {
|
static gl_stub_t gl_stub_funcs[] = {
|
||||||
|
#define QFGL_WANT(ret, name, args) \
|
||||||
|
{#name, norm_##name, trace_##name},
|
||||||
#define QFGL_NEED(ret, name, args) \
|
#define QFGL_NEED(ret, name, args) \
|
||||||
{#name, norm_##name, trace_##name},
|
{#name, norm_##name, trace_##name},
|
||||||
#include "QF/GL/qf_funcs_list.h"
|
#include "QF/GL/qf_funcs_list.h"
|
||||||
#undef QFGL_NEED
|
#undef QFGL_NEED
|
||||||
|
#undef QFGL_WANT
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NUM_FUNCS (sizeof (gl_stub_funcs) / sizeof (gl_stub_funcs[0]))
|
#define NUM_FUNCS (sizeof (gl_stub_funcs) / sizeof (gl_stub_funcs[0]))
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
#define UNDEF_QFGL_DONT_NEED
|
#define UNDEF_QFGL_DONT_NEED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef QFGL_WANT
|
||||||
|
#define QFGL_WANT(ret, func, params)
|
||||||
|
#define UNDEF_QFGL_WANT
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef QFGL_NEED
|
#ifndef QFGL_NEED
|
||||||
#define QFGL_NEED(ret, func, params)
|
#define QFGL_NEED(ret, func, params)
|
||||||
#define UNDEF_QFGL_NEED
|
#define UNDEF_QFGL_NEED
|
||||||
|
@ -45,6 +50,10 @@ QFGL_NEED (void, glXMakeCurrent, (Display *dpy, GLXDrawable drawable, GLXContext
|
||||||
#undef QFGL_DONT_NEED
|
#undef QFGL_DONT_NEED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef UNDEF_QFGL_WANT
|
||||||
|
#undef QFGL_WANT
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef UNDEF_QFGL_NEED
|
#ifdef UNDEF_QFGL_NEED
|
||||||
#undef QFGL_DONT_NEED
|
#undef QFGL_DONT_NEED
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue