Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Mesa 3-D graphics library |
Brian Paul | 1136412 | 2004-11-27 03:47:14 +0000 | [diff] [blame] | 3 | * Version: 6.3 |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 4 | * |
Brian Paul | 1136412 | 2004-11-27 03:47:14 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 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 | |
Ian Romanick | a657c1a | 2005-04-07 23:58:51 +0000 | [diff] [blame] | 26 | /** |
| 27 | * \file dispatch.c |
Brian Paul | a02fb6a | 2000-02-02 19:34:08 +0000 | [diff] [blame] | 28 | * |
Ian Romanick | a657c1a | 2005-04-07 23:58:51 +0000 | [diff] [blame] | 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). |
Brian Paul | a02fb6a | 2000-02-02 19:34:08 +0000 | [diff] [blame] | 32 | * |
Ian Romanick | a657c1a | 2005-04-07 23:58:51 +0000 | [diff] [blame] | 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> |
Brian Paul | a02fb6a | 2000-02-02 19:34:08 +0000 | [diff] [blame] | 38 | */ |
| 39 | |
Ian Romanick | a657c1a | 2005-04-07 23:58:51 +0000 | [diff] [blame] | 40 | #ifndef GLX_USE_APPLEGL |
Brian Paul | a02fb6a | 2000-02-02 19:34:08 +0000 | [diff] [blame] | 41 | |
Brian Paul | bbd2871 | 2008-09-18 12:26:54 -0600 | [diff] [blame] | 42 | #include "main/glheader.h" |
| 43 | #include "glapi/glapi.h" |
| 44 | #include "glapi/glapitable.h" |
| 45 | #include "glapi/glthread.h" |
Brian Paul | 3c63452 | 2002-10-24 23:57:19 +0000 | [diff] [blame] | 46 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 47 | |
Ian Romanick | f0ff50d | 2005-07-02 08:29:57 +0000 | [diff] [blame] | 48 | #if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM)) |
Brian Paul | 59577b5 | 1999-11-27 21:40:28 +0000 | [diff] [blame] | 49 | |
Brian Paul | 04120f6 | 2001-09-14 22:19:18 +0000 | [diff] [blame] | 50 | #if defined(WIN32) |
| 51 | #define KEYWORD1 GLAPI |
| 52 | #else |
Brian Paul | 819b519 | 2004-11-27 17:30:41 +0000 | [diff] [blame] | 53 | #define KEYWORD1 PUBLIC |
Brian Paul | 04120f6 | 2001-09-14 22:19:18 +0000 | [diff] [blame] | 54 | #endif |
| 55 | |
Brian Paul | 01c0713 | 2000-01-28 19:02:57 +0000 | [diff] [blame] | 56 | #define KEYWORD2 GLAPIENTRY |
Brian Paul | 04120f6 | 2001-09-14 22:19:18 +0000 | [diff] [blame] | 57 | |
Brian Paul | 3c257e1 | 2001-03-28 17:19:58 +0000 | [diff] [blame] | 58 | #if defined(USE_MGL_NAMESPACE) |
Brian Paul | 01c0713 | 2000-01-28 19:02:57 +0000 | [diff] [blame] | 59 | #define NAME(func) mgl##func |
| 60 | #else |
| 61 | #define NAME(func) gl##func |
| 62 | #endif |
| 63 | |
Brian Paul | 4e9676f | 2002-06-29 19:48:15 +0000 | [diff] [blame] | 64 | #if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */ |
Brian Paul | 471a774 | 2001-12-04 23:43:31 +0000 | [diff] [blame] | 65 | |
| 66 | #define F stdout |
Brian Paul | 3c257e1 | 2001-03-28 17:19:58 +0000 | [diff] [blame] | 67 | #define DISPATCH(FUNC, ARGS, MESSAGE) \ |
Brian Paul | b15a3b4 | 2001-12-15 16:42:59 +0000 | [diff] [blame] | 68 | fprintf MESSAGE; \ |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 69 | CALL_ ## FUNC(GET_DISPATCH(), ARGS); |
Brian Paul | b15a3b4 | 2001-12-15 16:42:59 +0000 | [diff] [blame] | 70 | |
| 71 | #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ |
| 72 | fprintf MESSAGE; \ |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 73 | return CALL_ ## FUNC(GET_DISPATCH(), ARGS); |
Brian Paul | 471a774 | 2001-12-04 23:43:31 +0000 | [diff] [blame] | 74 | |
| 75 | #else |
| 76 | |
| 77 | #define DISPATCH(FUNC, ARGS, MESSAGE) \ |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 78 | CALL_ ## FUNC(GET_DISPATCH(), ARGS); |
Brian Paul | 471a774 | 2001-12-04 23:43:31 +0000 | [diff] [blame] | 79 | |
Brian Paul | 3c257e1 | 2001-03-28 17:19:58 +0000 | [diff] [blame] | 80 | #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ |
Ian Romanick | 9bdfee3 | 2005-07-18 12:31:24 +0000 | [diff] [blame] | 81 | return CALL_ ## FUNC(GET_DISPATCH(), ARGS); |
Brian Paul | 01c0713 | 2000-01-28 19:02:57 +0000 | [diff] [blame] | 82 | |
Brian Paul | b15a3b4 | 2001-12-15 16:42:59 +0000 | [diff] [blame] | 83 | #endif /* logging */ |
| 84 | |
Brian Paul | 01c0713 | 2000-01-28 19:02:57 +0000 | [diff] [blame] | 85 | |
| 86 | #ifndef GLAPIENTRY |
| 87 | #define GLAPIENTRY |
| 88 | #endif |
| 89 | |
Brian Paul | bbd2871 | 2008-09-18 12:26:54 -0600 | [diff] [blame] | 90 | #include "glapi/dispatch.h" |
| 91 | #include "glapi/glapitemp.h" |
Brian Paul | 3c257e1 | 2001-03-28 17:19:58 +0000 | [diff] [blame] | 92 | |
Brian Paul | 3c257e1 | 2001-03-28 17:19:58 +0000 | [diff] [blame] | 93 | #endif /* USE_X86_ASM */ |
Ian Romanick | a657c1a | 2005-04-07 23:58:51 +0000 | [diff] [blame] | 94 | |
| 95 | #endif /* !GLX_USE_APPLEGL */ |