Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / mesa / src / mapi / glapi / glapi_nop.c
blob9b092971506f59bb12df7a3d941877ab0b710e42
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.8
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 * Copyright (C) 2010 VMware, Inc. All Rights Reserved.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 /**
28 * No-op dispatch table.
30 * This file defines a special dispatch table which is loaded with no-op
31 * functions.
33 * When there's no current rendering context, calling a GL function like
34 * glBegin() is a no-op. Apps should never normally do this. So as a
35 * debugging aid, each of the no-op functions will emit a warning to
36 * stderr if the MESA_DEBUG or LIBGL_DEBUG env var is set.
41 #include "glapi/glapi_priv.h"
44 void
45 _glapi_noop_enable_warnings(unsigned char enable)
49 void
50 _glapi_set_warning_func(_glapi_proc func)
54 #ifdef DEBUG
56 /**
57 * Called by each of the no-op GL entrypoints.
59 static int
60 Warn(const char *func)
62 #if !defined(_WIN32_WCE)
63 if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) {
64 fprintf(stderr, "GL User Error: gl%s called without a rendering context\n",
65 func);
67 #endif
68 return 0;
72 /**
73 * This is called if the user somehow calls an unassigned GL dispatch function.
75 static GLint
76 NoOpUnused(void)
78 return Warn(" function");
82 * Defines for the glapitemp.h functions.
84 #define KEYWORD1 static
85 #define KEYWORD1_ALT static
86 #define KEYWORD2 GLAPIENTRY
87 #define NAME(func) NoOp##func
88 #define DISPATCH(func, args, msg) Warn(#func);
89 #define RETURN_DISPATCH(func, args, msg) Warn(#func); return 0
93 * Defines for the table of no-op entry points.
95 #define TABLE_ENTRY(name) (_glapi_proc) NoOp##name
97 #else
99 static int
100 NoOpGeneric(void)
102 #if !defined(_WIN32_WCE)
103 if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) {
104 fprintf(stderr, "GL User Error: calling GL function without a rendering context\n");
106 #endif
107 return 0;
110 #define TABLE_ENTRY(name) (_glapi_proc) NoOpGeneric
112 #endif
114 #define DISPATCH_TABLE_NAME __glapi_noop_table
115 #define UNUSED_TABLE_NAME __unused_noop_functions
117 #include "glapi/glapitemp.h"