2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2010 VMware, Inc. All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
28 * No-op dispatch table.
30 * This file defines a special dispatch table which is loaded with no-op
33 * Mesa can register a "no-op handler function" which will be called in
34 * the event that a no-op function is called.
36 * In the past, the dispatch table was loaded with pointers to a single
37 * no-op function. But that broke on Windows because the GL entrypoints
38 * use __stdcall convention. __stdcall means the callee cleans up the
39 * stack. So one no-op function can't properly clean up the stack. This
40 * would lead to crashes.
42 * Another benefit of unique no-op functions is we can accurately report
43 * the function's name in an error message.
49 #include "glapi/glapi_priv.h"
53 _glapi_noop_enable_warnings(unsigned char enable
)
58 _glapi_set_warning_func(_glapi_proc func
)
64 * We'll jump though this function pointer whenever a no-op function
67 static _glapi_nop_handler_proc nop_handler
= NULL
;
71 * Register the no-op handler call-back function.
74 _glapi_set_nop_handler(_glapi_nop_handler_proc func
)
81 * Called by each of the no-op GL entrypoints.
92 * This is called if the user somehow calls an unassigned GL dispatch function.
97 nop("unused GL entry point");
102 * Defines for the glapitemp.h functions.
104 #define KEYWORD1 static
105 #define KEYWORD1_ALT static
106 #define KEYWORD2 GLAPIENTRY
107 #define NAME(func) NoOp##func
108 #define DISPATCH(func, args, msg) nop(#func);
109 #define RETURN_DISPATCH(func, args, msg) nop(#func); return 0
113 * Defines for the table of no-op entry points.
115 #define TABLE_ENTRY(name) (_glapi_proc) NoOp##name
116 #define DISPATCH_TABLE_NAME __glapi_noop_table
117 #define UNUSED_TABLE_NAME __unused_noop_functions
119 #include "glapitemp.h"
122 /** Return pointer to new dispatch table filled with no-op functions */
123 struct _glapi_table
*
124 _glapi_new_nop_table(unsigned num_entries
)
126 struct _glapi_table
*table
= malloc(num_entries
* sizeof(_glapi_proc
));
128 memcpy(table
, __glapi_noop_table
,
129 num_entries
* sizeof(_glapi_proc
));