1 | /* $Id: api.h,v 1.1 2000-02-29 00:48:24 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Mesa 3-D graphics library
|
---|
5 | * Version: 3.1
|
---|
6 | *
|
---|
7 | * Copyright (C) 1999 Brian Paul All Rights Reserved.
|
---|
8 | *
|
---|
9 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
10 | * copy of this software and associated documentation files (the "Software"),
|
---|
11 | * to deal in the Software without restriction, including without limitation
|
---|
12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
13 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
14 | * Software is furnished to do so, subject to the following conditions:
|
---|
15 | *
|
---|
16 | * The above copyright notice and this permission notice shall be included
|
---|
17 | * in all copies or substantial portions of the Software.
|
---|
18 | *
|
---|
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
---|
20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
22 | * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
---|
23 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
25 | */
|
---|
26 | /* $XFree86: xc/lib/GL/mesa/src/api.h,v 1.4 1999/06/27 14:07:26 dawes Exp $ */
|
---|
27 |
|
---|
28 |
|
---|
29 |
|
---|
30 |
|
---|
31 | /*
|
---|
32 | * This header contains stuff only included by api1.c, api2.c and apiext.c
|
---|
33 | * and cva.c and varray.c
|
---|
34 | */
|
---|
35 |
|
---|
36 |
|
---|
37 | #ifndef API_H
|
---|
38 | #define API_H
|
---|
39 |
|
---|
40 |
|
---|
41 | #if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server) && !defined(GLX_USE_DLOPEN)
|
---|
42 | #define NEED_MESA_FUNCS_WRAPPED
|
---|
43 | #include "mesa_api.h"
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | /*
|
---|
47 | * Single/multiple thread context selection.
|
---|
48 | */
|
---|
49 | #ifdef THREADS
|
---|
50 |
|
---|
51 | /* Get the context associated with the calling thread */
|
---|
52 | #define GET_CONTEXT GLcontext *CC = gl_get_thread_context()
|
---|
53 | #define GET_IMMEDIATE struct immediate *IM = (gl_get_thread_context())->input;
|
---|
54 |
|
---|
55 | #define SET_IMMEDIATE(ctx, im) \
|
---|
56 | do { \
|
---|
57 | ctx->input = im; \
|
---|
58 | } while (0)
|
---|
59 |
|
---|
60 | #else
|
---|
61 |
|
---|
62 | /* CC is a global pointer for all threads in the address space */
|
---|
63 | #define GET_CONTEXT
|
---|
64 |
|
---|
65 | /* And so is VB */
|
---|
66 | #define GET_IMMEDIATE struct immediate *IM = CURRENT_INPUT
|
---|
67 |
|
---|
68 | #define SET_IMMEDIATE(ctx, im) \
|
---|
69 | do { \
|
---|
70 | ctx->input = im; \
|
---|
71 | CURRENT_INPUT = im; \
|
---|
72 | } while (0)
|
---|
73 |
|
---|
74 | #endif /* THREADS */
|
---|
75 |
|
---|
76 |
|
---|
77 | /* Make sure there's a rendering context. KW: Only do this if compiled
|
---|
78 | * debug.
|
---|
79 | */
|
---|
80 | #ifdef DEBUG
|
---|
81 | #ifdef __WIN32OS2__
|
---|
82 | #define CHECK_CONTEXT \
|
---|
83 | if (!CC) { \
|
---|
84 | dprintf(("Mesa user error: no rendering context.\n")); \
|
---|
85 | return; \
|
---|
86 | }
|
---|
87 | #else
|
---|
88 | #define CHECK_CONTEXT \
|
---|
89 | if (!CC) { \
|
---|
90 | if (getenv("MESA_DEBUG")) { \
|
---|
91 | fprintf(stderr,"Mesa user error: no rendering context.\n"); \
|
---|
92 | } \
|
---|
93 | return; \
|
---|
94 | }
|
---|
95 | #endif
|
---|
96 |
|
---|
97 | #ifdef __WIN32OS2__
|
---|
98 | #define CHECK_CONTEXT_RETURN(R) \
|
---|
99 | if (!CC) { \
|
---|
100 | dprintf(("Mesa user error: no rendering context.\n")); \
|
---|
101 | } \
|
---|
102 | return (R);
|
---|
103 | #else
|
---|
104 | #define CHECK_CONTEXT_RETURN(R) \
|
---|
105 | if (!CC) { \
|
---|
106 | if (getenv("MESA_DEBUG")) { \
|
---|
107 | fprintf(stderr,"Mesa user error: no rendering context.\n"); \
|
---|
108 | } \
|
---|
109 | return (R); \
|
---|
110 | }
|
---|
111 | #endif
|
---|
112 | #else
|
---|
113 | #define CHECK_CONTEXT
|
---|
114 | #define CHECK_CONTEXT_RETURN(R)
|
---|
115 | #endif
|
---|
116 |
|
---|
117 |
|
---|
118 | #if !defined(CTX_ARG)
|
---|
119 | #define CTX_ARG
|
---|
120 | #define CTX_VOID
|
---|
121 | #define CTX_PRM
|
---|
122 | #define CTX_VPRM
|
---|
123 | #endif
|
---|
124 |
|
---|
125 | /*
|
---|
126 | * An optimization in a few performance-critical functions.
|
---|
127 | */
|
---|
128 | #ifndef XFree86Server /* don't think we want this in DRI??? */
|
---|
129 | #define SHORTCUT
|
---|
130 | #endif
|
---|
131 |
|
---|
132 |
|
---|
133 |
|
---|
134 | #endif
|
---|