3 * Mesa 3-D graphics library
6 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 const char *_mesa_prim_name
[GL_POLYGON
+4] = {
47 "inside unkown primitive",
52 _mesa_print_state( const char *msg
, GLuint state
)
55 "%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",
58 (state
& _NEW_MODELVIEW
) ? "ctx->ModelView, " : "",
59 (state
& _NEW_PROJECTION
) ? "ctx->Projection, " : "",
60 (state
& _NEW_TEXTURE_MATRIX
) ? "ctx->TextureMatrix, " : "",
61 (state
& _NEW_COLOR_MATRIX
) ? "ctx->ColorMatrix, " : "",
62 (state
& _NEW_ACCUM
) ? "ctx->Accum, " : "",
63 (state
& _NEW_COLOR
) ? "ctx->Color, " : "",
64 (state
& _NEW_DEPTH
) ? "ctx->Depth, " : "",
65 (state
& _NEW_EVAL
) ? "ctx->Eval/EvalMap, " : "",
66 (state
& _NEW_FOG
) ? "ctx->Fog, " : "",
67 (state
& _NEW_HINT
) ? "ctx->Hint, " : "",
68 (state
& _NEW_LIGHT
) ? "ctx->Light, " : "",
69 (state
& _NEW_LINE
) ? "ctx->Line, " : "",
70 (state
& _NEW_PIXEL
) ? "ctx->Pixel, " : "",
71 (state
& _NEW_POINT
) ? "ctx->Point, " : "",
72 (state
& _NEW_POLYGON
) ? "ctx->Polygon, " : "",
73 (state
& _NEW_POLYGONSTIPPLE
) ? "ctx->PolygonStipple, " : "",
74 (state
& _NEW_SCISSOR
) ? "ctx->Scissor, " : "",
75 (state
& _NEW_TEXTURE
) ? "ctx->Texture, " : "",
76 (state
& _NEW_TRANSFORM
) ? "ctx->Transform, " : "",
77 (state
& _NEW_VIEWPORT
) ? "ctx->Viewport, " : "",
78 (state
& _NEW_PACKUNPACK
) ? "ctx->Pack/Unpack, " : "",
79 (state
& _NEW_ARRAY
) ? "ctx->Array, " : "",
80 (state
& _NEW_RENDERMODE
) ? "ctx->RenderMode, " : "",
81 (state
& _NEW_BUFFERS
) ? "ctx->Visual, ctx->DrawBuffer,, " : "");
87 _mesa_print_tri_caps( const char *name
, GLuint flags
)
90 "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
93 (flags
& DD_FLATSHADE
) ? "flat-shade, " : "",
94 (flags
& DD_SEPARATE_SPECULAR
) ? "separate-specular, " : "",
95 (flags
& DD_TRI_LIGHT_TWOSIDE
) ? "tri-light-twoside, " : "",
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 _mesa_check_driver_hooks( GLcontext
*ctx
)
114 ASSERT(ctx
->Driver
.GetString
);
115 ASSERT(ctx
->Driver
.UpdateState
);
116 ASSERT(ctx
->Driver
.Clear
);
117 ASSERT(ctx
->Driver
.GetBufferSize
);
118 if (ctx
->Visual
.accumRedBits
> 0) {
119 ASSERT(ctx
->Driver
.Accum
);
121 ASSERT(ctx
->Driver
.DrawPixels
);
122 ASSERT(ctx
->Driver
.ReadPixels
);
123 ASSERT(ctx
->Driver
.CopyPixels
);
124 ASSERT(ctx
->Driver
.Bitmap
);
125 ASSERT(ctx
->Driver
.ResizeBuffers
);
126 ASSERT(ctx
->Driver
.TexImage1D
);
127 ASSERT(ctx
->Driver
.TexImage2D
);
128 ASSERT(ctx
->Driver
.TexImage3D
);
129 ASSERT(ctx
->Driver
.TexSubImage1D
);
130 ASSERT(ctx
->Driver
.TexSubImage2D
);
131 ASSERT(ctx
->Driver
.TexSubImage3D
);
132 ASSERT(ctx
->Driver
.CopyTexImage1D
);
133 ASSERT(ctx
->Driver
.CopyTexImage2D
);
134 ASSERT(ctx
->Driver
.CopyTexSubImage1D
);
135 ASSERT(ctx
->Driver
.CopyTexSubImage2D
);
136 ASSERT(ctx
->Driver
.CopyTexSubImage3D
);
137 if (ctx
->Extensions
.ARB_texture_compression
) {
138 #if 0 /* HW drivers need these, but not SW rasterizers */
139 ASSERT(ctx
->Driver
.CompressedTexImage1D
);
140 ASSERT(ctx
->Driver
.CompressedTexImage2D
);
141 ASSERT(ctx
->Driver
.CompressedTexImage3D
);
142 ASSERT(ctx
->Driver
.CompressedTexSubImage1D
);
143 ASSERT(ctx
->Driver
.CompressedTexSubImage2D
);
144 ASSERT(ctx
->Driver
.CompressedTexSubImage3D
);
150 * Print information about this Mesa version and build options.
152 void _mesa_print_info( void )
154 _mesa_debug(NULL
, "Mesa GL_VERSION = %s\n",
155 (char *) _mesa_GetString(GL_VERSION
));
156 _mesa_debug(NULL
, "Mesa GL_RENDERER = %s\n",
157 (char *) _mesa_GetString(GL_RENDERER
));
158 _mesa_debug(NULL
, "Mesa GL_VENDOR = %s\n",
159 (char *) _mesa_GetString(GL_VENDOR
));
160 _mesa_debug(NULL
, "Mesa GL_EXTENSIONS = %s\n",
161 (char *) _mesa_GetString(GL_EXTENSIONS
));
163 _mesa_debug(NULL
, "Mesa thread-safe: YES\n");
165 _mesa_debug(NULL
, "Mesa thread-safe: NO\n");
167 #if defined(USE_X86_ASM)
168 _mesa_debug(NULL
, "Mesa x86-optimized: YES\n");
170 _mesa_debug(NULL
, "Mesa x86-optimized: NO\n");
172 #if defined(USE_SPARC_ASM)
173 _mesa_debug(NULL
, "Mesa sparc-optimized: YES\n");
175 _mesa_debug(NULL
, "Mesa sparc-optimized: NO\n");
181 * Set the debugging flags.
183 * \param debug debug string
185 * If compiled with debugging support then search for keywords in \p debug and
186 * enables the verbose debug output of the respective feature.
188 static void add_debug_flags( const char *debug
)
191 if (_mesa_strstr(debug
, "varray"))
192 MESA_VERBOSE
|= VERBOSE_VARRAY
;
194 if (_mesa_strstr(debug
, "tex"))
195 MESA_VERBOSE
|= VERBOSE_TEXTURE
;
197 if (_mesa_strstr(debug
, "imm"))
198 MESA_VERBOSE
|= VERBOSE_IMMEDIATE
;
200 if (_mesa_strstr(debug
, "pipe"))
201 MESA_VERBOSE
|= VERBOSE_PIPELINE
;
203 if (_mesa_strstr(debug
, "driver"))
204 MESA_VERBOSE
|= VERBOSE_DRIVER
;
206 if (_mesa_strstr(debug
, "state"))
207 MESA_VERBOSE
|= VERBOSE_STATE
;
209 if (_mesa_strstr(debug
, "api"))
210 MESA_VERBOSE
|= VERBOSE_API
;
212 if (_mesa_strstr(debug
, "list"))
213 MESA_VERBOSE
|= VERBOSE_DISPLAY_LIST
;
215 if (_mesa_strstr(debug
, "lighting"))
216 MESA_VERBOSE
|= VERBOSE_LIGHTING
;
220 if (_mesa_strstr(debug
, "flush"))
221 MESA_DEBUG_FLAGS
|= DEBUG_ALWAYS_FLUSH
;
227 _mesa_init_debug( GLcontext
*ctx
)
231 /* For debug/development only */
232 ctx
->FirstTimeCurrent
= GL_TRUE
;
235 ctx
->NoDither
= _mesa_getenv("MESA_NO_DITHER") ? GL_TRUE
: GL_FALSE
;
237 if (_mesa_getenv("MESA_DEBUG")) {
238 _mesa_debug(ctx
, "MESA_NO_DITHER set - dithering disabled\n");
240 ctx
->Color
.DitherFlag
= GL_FALSE
;
243 c
= _mesa_getenv("MESA_DEBUG");
247 c
= _mesa_getenv("MESA_VERBOSE");