typedef void (*_glapi_proc)(void); /* generic function pointer */
-typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...);
-
#if defined(USE_MGL_NAMESPACE)
#define _glapi_set_dispatch _mglapi_set_dispatch
** GL API public functions
**/
-extern void
-_glapi_noop_enable_warnings(GLboolean enable);
-
-extern void
-_glapi_set_warning_func(_glapi_warning_func func);
-
extern void
_glapi_check_multithread(void);
#include "glapi/glapi.h"
-static GLboolean WarnFlag = GL_FALSE;
-static _glapi_warning_func warning_func;
-
-/*
- * Enable/disable printing of warning messages.
- */
-PUBLIC void
-_glapi_noop_enable_warnings(GLboolean enable)
-{
- WarnFlag = enable;
-}
-
-/*
- * Register a callback function for reporting errors.
+/**
+ * Called by each of the no-op GL entrypoints.
*/
-PUBLIC void
-_glapi_set_warning_func( _glapi_warning_func func )
-{
- warning_func = func;
-}
-
-
static int
-warn(const char *func)
+Warn(const char *func)
{
#if !defined(_WIN32_WCE)
- if ((WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"))
- && warning_func) {
- warning_func(NULL, "GL User Error: called without context: %s", func);
+ if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) {
+ fprintf(stderr, "GL User Error: gl%s called without a rendering context\n",
+ func);
}
#endif
- return 0;
+ return 0;
+}
+
+
+/**
+ * This is called if the user somehow calls an unassigned GL dispatch function.
+ */
+static GLint
+NoOpUnused(void)
+{
+ return Warn(" function");
}
-#ifdef DEBUG
+/*
+ * Defines for the glapitemp.h functions.
+ */
#define KEYWORD1 static
#define KEYWORD1_ALT static
#define KEYWORD2 GLAPIENTRY
#define NAME(func) NoOp##func
-#define F NULL
-
-#define DISPATCH(func, args, msg) \
- warn(#func);
+#define DISPATCH(func, args, msg) Warn(#func);
+#define RETURN_DISPATCH(func, args, msg) Warn(#func); return 0
-#define RETURN_DISPATCH(func, args, msg) \
- warn(#func); return 0
+/*
+ * Defines for the table of no-op entry points.
+ */
#define TABLE_ENTRY(name) (_glapi_proc) NoOp##name
-
-#else
-
-static void
-NoOpGeneric(void)
-{
- if ((WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"))
- && warning_func) {
- warning_func(NULL, "GL User Error: calling GL function");
- }
-}
-
-
-#define TABLE_ENTRY(name) (_glapi_proc) NoOpGeneric
-
-#endif
-
#define DISPATCH_TABLE_NAME __glapi_noop_table
#define UNUSED_TABLE_NAME __unused_noop_functions
-static int NoOpUnused(void)
-{
- return warn("extension function");
-}
#include "glapi/glapitemp.h"
_mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
}
- if (_mesa_getenv("MESA_DEBUG")) {
- _glapi_noop_enable_warnings(GL_TRUE);
- _glapi_set_warning_func( (_glapi_warning_func) _mesa_warning );
- }
- else {
- _glapi_noop_enable_warnings(GL_FALSE);
- }
-
#if defined(DEBUG) && defined(__DATE__) && defined(__TIME__)
_mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n",
MESA_VERSION_STRING, __DATE__, __TIME__);