blob: f0e1e6ce2b98b58c7034e81744beb57f4b5e19de [file] [log] [blame]
Brian Paulee403ff2001-03-29 16:50:31 +00001/* $Id: debug.c,v 1.10 2001/03/29 16:50:31 brianp Exp $ */
Gareth Hughes22144ab2001-03-12 00:48:37 +00002
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
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +000027#include "mtypes.h"
Keith Whitwell23caf202000-11-16 21:05:34 +000028#include "debug.h"
29
Brian Paul08836342001-03-03 20:33:27 +000030void _mesa_print_state( const char *msg, GLuint state )
Keith Whitwell23caf202000-11-16 21:05:34 +000031{
32 fprintf(stderr,
Keith Whitwellcab974c2000-12-26 05:09:27 +000033 "%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%s\n",
Keith Whitwell23caf202000-11-16 21:05:34 +000034 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, " : "",
Keith Whitwell23caf202000-11-16 21:05:34 +000048 (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, " : "",
Keith Whitwell23caf202000-11-16 21:05:34 +000058 (state & _NEW_RENDERMODE) ? "ctx->RenderMode, " : "",
59 (state & _NEW_BUFFERS) ? "ctx->Visual, ctx->DrawBuffer,, " : "");
60}
61
62
Brian Paul08836342001-03-03 20:33:27 +000063void _mesa_print_enable_flags( const char *msg, GLuint flags )
Keith Whitwell23caf202000-11-16 21:05:34 +000064{
65 fprintf(stderr,
Keith Whitwellcab974c2000-12-26 05:09:27 +000066 "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
Keith Whitwell23caf202000-11-16 21:05:34 +000067 msg,
68 flags,
Keith Whitwell23caf202000-11-16 21:05:34 +000069 (flags & ENABLE_LIGHT) ? "light, " : "",
70 (flags & ENABLE_FOG) ? "fog, " : "",
71 (flags & ENABLE_USERCLIP) ? "userclip, " : "",
72 (flags & ENABLE_TEXGEN0) ? "tex-gen-0, " : "",
73 (flags & ENABLE_TEXGEN1) ? "tex-gen-1, " : "",
74 (flags & ENABLE_TEXGEN2) ? "tex-gen-2, " : "",
75 (flags & ENABLE_TEXGEN3) ? "tex-gen-3, " : "",
Keith Whitwellcab974c2000-12-26 05:09:27 +000076 (flags & ENABLE_TEXGEN4) ? "tex-gen-4, " : "",
77 (flags & ENABLE_TEXGEN5) ? "tex-gen-5, " : "",
78 (flags & ENABLE_TEXGEN6) ? "tex-gen-6, " : "",
79 (flags & ENABLE_TEXGEN7) ? "tex-gen-7, " : "",
Keith Whitwell23caf202000-11-16 21:05:34 +000080 (flags & ENABLE_TEXMAT0) ? "tex-mat-0, " : "",
81 (flags & ENABLE_TEXMAT1) ? "tex-mat-1, " : "",
82 (flags & ENABLE_TEXMAT2) ? "tex-mat-2, " : "",
83 (flags & ENABLE_TEXMAT3) ? "tex-mat-3, " : "",
Keith Whitwellcab974c2000-12-26 05:09:27 +000084 (flags & ENABLE_TEXMAT4) ? "tex-mat-4, " : "",
85 (flags & ENABLE_TEXMAT5) ? "tex-mat-5, " : "",
86 (flags & ENABLE_TEXMAT6) ? "tex-mat-6, " : "",
87 (flags & ENABLE_TEXMAT7) ? "tex-mat-7, " : "",
Keith Whitwell23caf202000-11-16 21:05:34 +000088 (flags & ENABLE_NORMALIZE) ? "normalize, " : "",
89 (flags & ENABLE_RESCALE) ? "rescale, " : "");
90}
91
Brian Paul08836342001-03-03 20:33:27 +000092void _mesa_print_tri_caps( const char *name, GLuint flags )
Keith Whitwell23caf202000-11-16 21:05:34 +000093{
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +000094 fprintf(stderr,
Keith Whitwellcab974c2000-12-26 05:09:27 +000095 "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
Keith Whitwell23caf202000-11-16 21:05:34 +000096 name,
97 flags,
98 (flags & DD_FEEDBACK) ? "feedback, " : "",
99 (flags & DD_SELECT) ? "select, " : "",
100 (flags & DD_FLATSHADE) ? "flat-shade, " : "",
Brian Paulee403ff2001-03-29 16:50:31 +0000101 (flags & DD_SEPARATE_SPECULAR) ? "separate-specular, " : "",
Keith Whitwell23caf202000-11-16 21:05:34 +0000102 (flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : "",
103 (flags & DD_TRI_UNFILLED) ? "tri-unfilled, " : "",
104 (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "",
105 (flags & DD_TRI_OFFSET) ? "tri-offset, " : "",
Keith Whitwell23caf202000-11-16 21:05:34 +0000106 (flags & DD_TRI_SMOOTH) ? "tri-smooth, " : "",
107 (flags & DD_LINE_SMOOTH) ? "line-smooth, " : "",
108 (flags & DD_LINE_STIPPLE) ? "line-stipple, " : "",
109 (flags & DD_LINE_WIDTH) ? "line-wide, " : "",
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000110 (flags & DD_POINT_SMOOTH) ? "point-smooth, " : "",
111 (flags & DD_POINT_SIZE) ? "point-size, " : "",
112 (flags & DD_POINT_ATTEN) ? "point-atten, " : "",
Keith Whitwell23caf202000-11-16 21:05:34 +0000113 (flags & DD_TRI_CULL_FRONT_BACK) ? "cull-all, " : "",
114 (flags & DD_STENCIL) ? "stencil, " : ""
115 );
116}