summaryrefslogtreecommitdiffstats
path: root/src/mesa/glapi/glapi_nop.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/glapi/glapi_nop.c')
-rw-r--r--src/mesa/glapi/glapi_nop.c79
1 files changed, 25 insertions, 54 deletions
diff --git a/src/mesa/glapi/glapi_nop.c b/src/mesa/glapi/glapi_nop.c
index a0d4b65f55f..e45faef72d4 100644
--- a/src/mesa/glapi/glapi_nop.c
+++ b/src/mesa/glapi/glapi_nop.c
@@ -42,78 +42,49 @@
#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"