Merge branch 'radeon-texrewrite-clean' into mesa_7_7_branch
[mesa.git] / src / mesa / main / dispatch.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.3
4 *
5 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
6 *
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:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
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 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 /**
27 * \file dispatch.c
28 *
29 * This file generates all the gl* function entrypoints. This code is not
30 * used if optimized assembly stubs are available (e.g., using x86/glapi_x86.S
31 * on IA32 or sparc/glapi_sparc.S on SPARC).
32 *
33 * \note
34 * This file is also used to build the client-side libGL that loads DRI-based
35 * device drivers. At build-time it is symlinked to src/glx/x11.
36 *
37 * \author Brian Paul <brian@precisioninsight.com>
38 */
39
40 #ifndef GLX_USE_APPLEGL
41
42 #include "main/glheader.h"
43 #include "main/compiler.h"
44 #include "glapi/glapi.h"
45 #include "glapi/glapitable.h"
46 #include "glapi/glapidispatch.h"
47 #include "glapi/glthread.h"
48
49
50 #if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM))
51
52 #if defined(WIN32)
53 #define KEYWORD1 GLAPI
54 #else
55 #define KEYWORD1 PUBLIC
56 #endif
57
58 #define KEYWORD2 GLAPIENTRY
59
60 #if defined(USE_MGL_NAMESPACE)
61 #define NAME(func) mgl##func
62 #else
63 #define NAME(func) gl##func
64 #endif
65
66 #if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */
67
68 #define F stdout
69 #define DISPATCH(FUNC, ARGS, MESSAGE) \
70 fprintf MESSAGE; \
71 CALL_ ## FUNC(GET_DISPATCH(), ARGS);
72
73 #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
74 fprintf MESSAGE; \
75 return CALL_ ## FUNC(GET_DISPATCH(), ARGS);
76
77 #else
78
79 #define DISPATCH(FUNC, ARGS, MESSAGE) \
80 CALL_ ## FUNC(GET_DISPATCH(), ARGS);
81
82 #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
83 return CALL_ ## FUNC(GET_DISPATCH(), ARGS);
84
85 #endif /* logging */
86
87
88 #ifndef GLAPIENTRY
89 #define GLAPIENTRY
90 #endif
91
92 #include "glapi/glapitemp.h"
93
94 #endif /* USE_X86_ASM */
95
96 #endif /* !GLX_USE_APPLEGL */