2be25feb5a0c46a15a1caf7a1e6d1d912ac30d0a
[mesa.git] / src / mesa / main / debug.c
1 /* $Id: debug.c,v 1.14 2002/10/24 23:57:20 brianp Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.5
6 *
7 * Copyright (C) 1999-2001 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
27 #include "mtypes.h"
28 #include "context.h"
29 #include "imports.h"
30 #include "debug.h"
31
32
33 void
34 _mesa_print_state( const char *msg, GLuint state )
35 {
36 _mesa_debug(NULL,
37 "%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",
38 msg,
39 state,
40 (state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "",
41 (state & _NEW_PROJECTION) ? "ctx->Projection, " : "",
42 (state & _NEW_TEXTURE_MATRIX) ? "ctx->TextureMatrix, " : "",
43 (state & _NEW_COLOR_MATRIX) ? "ctx->ColorMatrix, " : "",
44 (state & _NEW_ACCUM) ? "ctx->Accum, " : "",
45 (state & _NEW_COLOR) ? "ctx->Color, " : "",
46 (state & _NEW_DEPTH) ? "ctx->Depth, " : "",
47 (state & _NEW_EVAL) ? "ctx->Eval/EvalMap, " : "",
48 (state & _NEW_FOG) ? "ctx->Fog, " : "",
49 (state & _NEW_HINT) ? "ctx->Hint, " : "",
50 (state & _NEW_LIGHT) ? "ctx->Light, " : "",
51 (state & _NEW_LINE) ? "ctx->Line, " : "",
52 (state & _NEW_PIXEL) ? "ctx->Pixel, " : "",
53 (state & _NEW_POINT) ? "ctx->Point, " : "",
54 (state & _NEW_POLYGON) ? "ctx->Polygon, " : "",
55 (state & _NEW_POLYGONSTIPPLE) ? "ctx->PolygonStipple, " : "",
56 (state & _NEW_SCISSOR) ? "ctx->Scissor, " : "",
57 (state & _NEW_TEXTURE) ? "ctx->Texture, " : "",
58 (state & _NEW_TRANSFORM) ? "ctx->Transform, " : "",
59 (state & _NEW_VIEWPORT) ? "ctx->Viewport, " : "",
60 (state & _NEW_PACKUNPACK) ? "ctx->Pack/Unpack, " : "",
61 (state & _NEW_ARRAY) ? "ctx->Array, " : "",
62 (state & _NEW_RENDERMODE) ? "ctx->RenderMode, " : "",
63 (state & _NEW_BUFFERS) ? "ctx->Visual, ctx->DrawBuffer,, " : "");
64 }
65
66
67
68 void
69 _mesa_print_tri_caps( const char *name, GLuint flags )
70 {
71 _mesa_debug(NULL,
72 "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
73 name,
74 flags,
75 (flags & DD_FLATSHADE) ? "flat-shade, " : "",
76 (flags & DD_SEPARATE_SPECULAR) ? "separate-specular, " : "",
77 (flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : "",
78 (flags & DD_TRI_UNFILLED) ? "tri-unfilled, " : "",
79 (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "",
80 (flags & DD_TRI_OFFSET) ? "tri-offset, " : "",
81 (flags & DD_TRI_SMOOTH) ? "tri-smooth, " : "",
82 (flags & DD_LINE_SMOOTH) ? "line-smooth, " : "",
83 (flags & DD_LINE_STIPPLE) ? "line-stipple, " : "",
84 (flags & DD_LINE_WIDTH) ? "line-wide, " : "",
85 (flags & DD_POINT_SMOOTH) ? "point-smooth, " : "",
86 (flags & DD_POINT_SIZE) ? "point-size, " : "",
87 (flags & DD_POINT_ATTEN) ? "point-atten, " : "",
88 (flags & DD_TRI_CULL_FRONT_BACK) ? "cull-all, " : ""
89 );
90 }