2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2005 Brian Paul 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 * 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.
34 const char *_mesa_prim_name
[GL_POLYGON
+4] = {
46 "inside unkown primitive",
51 _mesa_print_state( const char *msg
, GLuint state
)
54 "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
57 (state
& _NEW_MODELVIEW
) ? "ctx->ModelView, " : "",
58 (state
& _NEW_PROJECTION
) ? "ctx->Projection, " : "",
59 (state
& _NEW_TEXTURE_MATRIX
) ? "ctx->TextureMatrix, " : "",
60 (state
& _NEW_COLOR_MATRIX
) ? "ctx->ColorMatrix, " : "",
61 (state
& _NEW_ACCUM
) ? "ctx->Accum, " : "",
62 (state
& _NEW_COLOR
) ? "ctx->Color, " : "",
63 (state
& _NEW_DEPTH
) ? "ctx->Depth, " : "",
64 (state
& _NEW_EVAL
) ? "ctx->Eval/EvalMap, " : "",
65 (state
& _NEW_FOG
) ? "ctx->Fog, " : "",
66 (state
& _NEW_HINT
) ? "ctx->Hint, " : "",
67 (state
& _NEW_LIGHT
) ? "ctx->Light, " : "",
68 (state
& _NEW_LINE
) ? "ctx->Line, " : "",
69 (state
& _NEW_PIXEL
) ? "ctx->Pixel, " : "",
70 (state
& _NEW_POINT
) ? "ctx->Point, " : "",
71 (state
& _NEW_POLYGON
) ? "ctx->Polygon, " : "",
72 (state
& _NEW_POLYGONSTIPPLE
) ? "ctx->PolygonStipple, " : "",
73 (state
& _NEW_SCISSOR
) ? "ctx->Scissor, " : "",
74 (state
& _NEW_TEXTURE
) ? "ctx->Texture, " : "",
75 (state
& _NEW_TRANSFORM
) ? "ctx->Transform, " : "",
76 (state
& _NEW_VIEWPORT
) ? "ctx->Viewport, " : "",
77 (state
& _NEW_PACKUNPACK
) ? "ctx->Pack/Unpack, " : "",
78 (state
& _NEW_ARRAY
) ? "ctx->Array, " : "",
79 (state
& _NEW_RENDERMODE
) ? "ctx->RenderMode, " : "",
80 (state
& _NEW_BUFFERS
) ? "ctx->Visual, ctx->DrawBuffer,, " : "");
86 _mesa_print_tri_caps( const char *name
, GLuint flags
)
89 "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
92 (flags
& DD_FLATSHADE
) ? "flat-shade, " : "",
93 (flags
& DD_SEPARATE_SPECULAR
) ? "separate-specular, " : "",
94 (flags
& DD_TRI_LIGHT_TWOSIDE
) ? "tri-light-twoside, " : "",
95 (flags
& DD_TRI_TWOSTENCIL
) ? "tri-twostencil, " : "",
96 (flags
& DD_TRI_UNFILLED
) ? "tri-unfilled, " : "",
97 (flags
& DD_TRI_STIPPLE
) ? "tri-stipple, " : "",
98 (flags
& DD_TRI_OFFSET
) ? "tri-offset, " : "",
99 (flags
& DD_TRI_SMOOTH
) ? "tri-smooth, " : "",
100 (flags
& DD_LINE_SMOOTH
) ? "line-smooth, " : "",
101 (flags
& DD_LINE_STIPPLE
) ? "line-stipple, " : "",
102 (flags
& DD_LINE_WIDTH
) ? "line-wide, " : "",
103 (flags
& DD_POINT_SMOOTH
) ? "point-smooth, " : "",
104 (flags
& DD_POINT_SIZE
) ? "point-size, " : "",
105 (flags
& DD_POINT_ATTEN
) ? "point-atten, " : "",
106 (flags
& DD_TRI_CULL_FRONT_BACK
) ? "cull-all, " : ""
112 * Print information about this Mesa version and build options.
114 void _mesa_print_info( void )
116 _mesa_debug(NULL
, "Mesa GL_VERSION = %s\n",
117 (char *) _mesa_GetString(GL_VERSION
));
118 _mesa_debug(NULL
, "Mesa GL_RENDERER = %s\n",
119 (char *) _mesa_GetString(GL_RENDERER
));
120 _mesa_debug(NULL
, "Mesa GL_VENDOR = %s\n",
121 (char *) _mesa_GetString(GL_VENDOR
));
122 _mesa_debug(NULL
, "Mesa GL_EXTENSIONS = %s\n",
123 (char *) _mesa_GetString(GL_EXTENSIONS
));
125 _mesa_debug(NULL
, "Mesa thread-safe: YES\n");
127 _mesa_debug(NULL
, "Mesa thread-safe: NO\n");
129 #if defined(USE_X86_ASM)
130 _mesa_debug(NULL
, "Mesa x86-optimized: YES\n");
132 _mesa_debug(NULL
, "Mesa x86-optimized: NO\n");
134 #if defined(USE_SPARC_ASM)
135 _mesa_debug(NULL
, "Mesa sparc-optimized: YES\n");
137 _mesa_debug(NULL
, "Mesa sparc-optimized: NO\n");
143 * Set the debugging flags.
145 * \param debug debug string
147 * If compiled with debugging support then search for keywords in \p debug and
148 * enables the verbose debug output of the respective feature.
150 static void add_debug_flags( const char *debug
)
153 if (_mesa_strstr(debug
, "varray"))
154 MESA_VERBOSE
|= VERBOSE_VARRAY
;
156 if (_mesa_strstr(debug
, "tex"))
157 MESA_VERBOSE
|= VERBOSE_TEXTURE
;
159 if (_mesa_strstr(debug
, "imm"))
160 MESA_VERBOSE
|= VERBOSE_IMMEDIATE
;
162 if (_mesa_strstr(debug
, "pipe"))
163 MESA_VERBOSE
|= VERBOSE_PIPELINE
;
165 if (_mesa_strstr(debug
, "driver"))
166 MESA_VERBOSE
|= VERBOSE_DRIVER
;
168 if (_mesa_strstr(debug
, "state"))
169 MESA_VERBOSE
|= VERBOSE_STATE
;
171 if (_mesa_strstr(debug
, "api"))
172 MESA_VERBOSE
|= VERBOSE_API
;
174 if (_mesa_strstr(debug
, "list"))
175 MESA_VERBOSE
|= VERBOSE_DISPLAY_LIST
;
177 if (_mesa_strstr(debug
, "lighting"))
178 MESA_VERBOSE
|= VERBOSE_LIGHTING
;
180 if (_mesa_strstr(debug
, "disassem"))
181 MESA_VERBOSE
|= VERBOSE_DISASSEM
;
185 if (_mesa_strstr(debug
, "flush"))
186 MESA_DEBUG_FLAGS
|= DEBUG_ALWAYS_FLUSH
;
188 #if defined(_FPU_GETCW) && defined(_FPU_SETCW)
189 if (_mesa_strstr(debug
, "fpexceptions")) {
190 /* raise FP exceptions */
193 mask
&= ~(_FPU_MASK_IM
| _FPU_MASK_DM
| _FPU_MASK_ZM
194 | _FPU_MASK_OM
| _FPU_MASK_UM
);
206 _mesa_init_debug( GLcontext
*ctx
)
211 ctx
->NoDither
= _mesa_getenv("MESA_NO_DITHER") ? GL_TRUE
: GL_FALSE
;
213 if (_mesa_getenv("MESA_DEBUG")) {
214 _mesa_debug(ctx
, "MESA_NO_DITHER set - dithering disabled\n");
216 ctx
->Color
.DitherFlag
= GL_FALSE
;
219 c
= _mesa_getenv("MESA_DEBUG");
223 c
= _mesa_getenv("MESA_VERBOSE");