debug.c revision ed39a43b8cb2e1cf69b097fc89365cde470ebf51
1/* $Id: debug.c,v 1.12 2001/03/29 21:16:25 keithw 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 "debug.h"
29
30void _mesa_print_state( const char *msg, GLuint state )
31{
32   fprintf(stderr,
33	   "%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",
34	   msg,
35	   state,
36	   (state & _NEW_MODELVIEW)       ? "ctx->ModelView, " : "",
37	   (state & _NEW_PROJECTION)      ? "ctx->Projection, " : "",
38	   (state & _NEW_TEXTURE_MATRIX)  ? "ctx->TextureMatrix, " : "",
39	   (state & _NEW_COLOR_MATRIX)    ? "ctx->ColorMatrix, " : "",
40	   (state & _NEW_ACCUM)           ? "ctx->Accum, " : "",
41	   (state & _NEW_COLOR)           ? "ctx->Color, " : "",
42	   (state & _NEW_DEPTH)           ? "ctx->Depth, " : "",
43	   (state & _NEW_EVAL)            ? "ctx->Eval/EvalMap, " : "",
44	   (state & _NEW_FOG)             ? "ctx->Fog, " : "",
45	   (state & _NEW_HINT)            ? "ctx->Hint, " : "",
46	   (state & _NEW_LIGHT)           ? "ctx->Light, " : "",
47	   (state & _NEW_LINE)            ? "ctx->Line, " : "",
48	   (state & _NEW_PIXEL)           ? "ctx->Pixel, " : "",
49	   (state & _NEW_POINT)           ? "ctx->Point, " : "",
50	   (state & _NEW_POLYGON)         ? "ctx->Polygon, " : "",
51	   (state & _NEW_POLYGONSTIPPLE)  ? "ctx->PolygonStipple, " : "",
52	   (state & _NEW_SCISSOR)         ? "ctx->Scissor, " : "",
53	   (state & _NEW_TEXTURE)         ? "ctx->Texture, " : "",
54	   (state & _NEW_TRANSFORM)       ? "ctx->Transform, " : "",
55	   (state & _NEW_VIEWPORT)        ? "ctx->Viewport, " : "",
56	   (state & _NEW_PACKUNPACK)      ? "ctx->Pack/Unpack, " : "",
57	   (state & _NEW_ARRAY)           ? "ctx->Array, " : "",
58	   (state & _NEW_RENDERMODE)      ? "ctx->RenderMode, " : "",
59	   (state & _NEW_BUFFERS)         ? "ctx->Visual, ctx->DrawBuffer,, " : "");
60}
61
62
63
64void _mesa_print_tri_caps( const char *name, GLuint flags )
65{
66   fprintf(stderr,
67	   "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
68	   name,
69	   flags,
70	   (flags & DD_FLATSHADE)           ? "flat-shade, " : "",
71	   (flags & DD_SEPARATE_SPECULAR)   ? "separate-specular, " : "",
72	   (flags & DD_TRI_LIGHT_TWOSIDE)   ? "tri-light-twoside, " : "",
73	   (flags & DD_TRI_UNFILLED)        ? "tri-unfilled, " : "",
74	   (flags & DD_TRI_STIPPLE)         ? "tri-stipple, " : "",
75	   (flags & DD_TRI_OFFSET)          ? "tri-offset, " : "",
76	   (flags & DD_TRI_SMOOTH)          ? "tri-smooth, " : "",
77	   (flags & DD_LINE_SMOOTH)         ? "line-smooth, " : "",
78	   (flags & DD_LINE_STIPPLE)        ? "line-stipple, " : "",
79	   (flags & DD_LINE_WIDTH)          ? "line-wide, " : "",
80	   (flags & DD_POINT_SMOOTH)        ? "point-smooth, " : "",
81	   (flags & DD_POINT_SIZE)          ? "point-size, " : "",
82	   (flags & DD_POINT_ATTEN)         ? "point-atten, " : "",
83	   (flags & DD_TRI_CULL_FRONT_BACK) ? "cull-all, " : ""
84      );
85}
86