Brian Paul | ee403ff | 2001-03-29 16:50:31 +0000 | [diff] [blame^] | 1 | /* $Id: debug.c,v 1.10 2001/03/29 16:50:31 brianp Exp $ */ |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 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 | |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 27 | #include "mtypes.h" |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 28 | #include "debug.h" |
| 29 | |
Brian Paul | 0883634 | 2001-03-03 20:33:27 +0000 | [diff] [blame] | 30 | void _mesa_print_state( const char *msg, GLuint state ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 31 | { |
| 32 | fprintf(stderr, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 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%s\n", |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 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, " : "", |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 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, " : "", |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 58 | (state & _NEW_RENDERMODE) ? "ctx->RenderMode, " : "", |
| 59 | (state & _NEW_BUFFERS) ? "ctx->Visual, ctx->DrawBuffer,, " : ""); |
| 60 | } |
| 61 | |
| 62 | |
Brian Paul | 0883634 | 2001-03-03 20:33:27 +0000 | [diff] [blame] | 63 | void _mesa_print_enable_flags( const char *msg, GLuint flags ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 64 | { |
| 65 | fprintf(stderr, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 66 | "%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 Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 67 | msg, |
| 68 | flags, |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 69 | (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 Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 76 | (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 Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 80 | (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 Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 84 | (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 Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 88 | (flags & ENABLE_NORMALIZE) ? "normalize, " : "", |
| 89 | (flags & ENABLE_RESCALE) ? "rescale, " : ""); |
| 90 | } |
| 91 | |
Brian Paul | 0883634 | 2001-03-03 20:33:27 +0000 | [diff] [blame] | 92 | void _mesa_print_tri_caps( const char *name, GLuint flags ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 93 | { |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 94 | fprintf(stderr, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 95 | "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 96 | name, |
| 97 | flags, |
| 98 | (flags & DD_FEEDBACK) ? "feedback, " : "", |
| 99 | (flags & DD_SELECT) ? "select, " : "", |
| 100 | (flags & DD_FLATSHADE) ? "flat-shade, " : "", |
Brian Paul | ee403ff | 2001-03-29 16:50:31 +0000 | [diff] [blame^] | 101 | (flags & DD_SEPARATE_SPECULAR) ? "separate-specular, " : "", |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 102 | (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 Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 106 | (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 Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame] | 110 | (flags & DD_POINT_SMOOTH) ? "point-smooth, " : "", |
| 111 | (flags & DD_POINT_SIZE) ? "point-size, " : "", |
| 112 | (flags & DD_POINT_ATTEN) ? "point-atten, " : "", |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 113 | (flags & DD_TRI_CULL_FRONT_BACK) ? "cull-all, " : "", |
| 114 | (flags & DD_STENCIL) ? "stencil, " : "" |
| 115 | ); |
| 116 | } |