Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendebug.c
Go to the documentation of this file.
00001 /* 00002 * Mesa 3-D graphics library 00003 * Version: 6.5 00004 * 00005 * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. 00006 * 00007 * Permission is hereby granted, free of charge, to any person obtaining a 00008 * copy of this software and associated documentation files (the "Software"), 00009 * to deal in the Software without restriction, including without limitation 00010 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00011 * and/or sell copies of the Software, and to permit persons to whom the 00012 * Software is furnished to do so, subject to the following conditions: 00013 * 00014 * The above copyright notice and this permission notice shall be included 00015 * in all copies or substantial portions of the Software. 00016 * 00017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00018 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00019 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00020 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 00021 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00022 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00023 */ 00024 00025 #include "mtypes.h" 00026 #include "context.h" 00027 #include "imports.h" 00028 #include "debug.h" 00029 #include "get.h" 00030 00034 const char *_mesa_prim_name[GL_POLYGON+4] = { 00035 "GL_POINTS", 00036 "GL_LINES", 00037 "GL_LINE_LOOP", 00038 "GL_LINE_STRIP", 00039 "GL_TRIANGLES", 00040 "GL_TRIANGLE_STRIP", 00041 "GL_TRIANGLE_FAN", 00042 "GL_QUADS", 00043 "GL_QUAD_STRIP", 00044 "GL_POLYGON", 00045 "outside begin/end", 00046 "inside unkown primitive", 00047 "unknown state" 00048 }; 00049 00050 void 00051 _mesa_print_state( const char *msg, GLuint state ) 00052 { 00053 _mesa_debug(NULL, 00054 "%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", 00055 msg, 00056 state, 00057 (state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "", 00058 (state & _NEW_PROJECTION) ? "ctx->Projection, " : "", 00059 (state & _NEW_TEXTURE_MATRIX) ? "ctx->TextureMatrix, " : "", 00060 (state & _NEW_COLOR_MATRIX) ? "ctx->ColorMatrix, " : "", 00061 (state & _NEW_ACCUM) ? "ctx->Accum, " : "", 00062 (state & _NEW_COLOR) ? "ctx->Color, " : "", 00063 (state & _NEW_DEPTH) ? "ctx->Depth, " : "", 00064 (state & _NEW_EVAL) ? "ctx->Eval/EvalMap, " : "", 00065 (state & _NEW_FOG) ? "ctx->Fog, " : "", 00066 (state & _NEW_HINT) ? "ctx->Hint, " : "", 00067 (state & _NEW_LIGHT) ? "ctx->Light, " : "", 00068 (state & _NEW_LINE) ? "ctx->Line, " : "", 00069 (state & _NEW_PIXEL) ? "ctx->Pixel, " : "", 00070 (state & _NEW_POINT) ? "ctx->Point, " : "", 00071 (state & _NEW_POLYGON) ? "ctx->Polygon, " : "", 00072 (state & _NEW_POLYGONSTIPPLE) ? "ctx->PolygonStipple, " : "", 00073 (state & _NEW_SCISSOR) ? "ctx->Scissor, " : "", 00074 (state & _NEW_TEXTURE) ? "ctx->Texture, " : "", 00075 (state & _NEW_TRANSFORM) ? "ctx->Transform, " : "", 00076 (state & _NEW_VIEWPORT) ? "ctx->Viewport, " : "", 00077 (state & _NEW_PACKUNPACK) ? "ctx->Pack/Unpack, " : "", 00078 (state & _NEW_ARRAY) ? "ctx->Array, " : "", 00079 (state & _NEW_RENDERMODE) ? "ctx->RenderMode, " : "", 00080 (state & _NEW_BUFFERS) ? "ctx->Visual, ctx->DrawBuffer,, " : ""); 00081 } 00082 00083 00084 00085 void 00086 _mesa_print_tri_caps( const char *name, GLuint flags ) 00087 { 00088 _mesa_debug(NULL, 00089 "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", 00090 name, 00091 flags, 00092 (flags & DD_FLATSHADE) ? "flat-shade, " : "", 00093 (flags & DD_SEPARATE_SPECULAR) ? "separate-specular, " : "", 00094 (flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : "", 00095 (flags & DD_TRI_TWOSTENCIL) ? "tri-twostencil, " : "", 00096 (flags & DD_TRI_UNFILLED) ? "tri-unfilled, " : "", 00097 (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "", 00098 (flags & DD_TRI_OFFSET) ? "tri-offset, " : "", 00099 (flags & DD_TRI_SMOOTH) ? "tri-smooth, " : "", 00100 (flags & DD_LINE_SMOOTH) ? "line-smooth, " : "", 00101 (flags & DD_LINE_STIPPLE) ? "line-stipple, " : "", 00102 (flags & DD_LINE_WIDTH) ? "line-wide, " : "", 00103 (flags & DD_POINT_SMOOTH) ? "point-smooth, " : "", 00104 (flags & DD_POINT_SIZE) ? "point-size, " : "", 00105 (flags & DD_POINT_ATTEN) ? "point-atten, " : "", 00106 (flags & DD_TRI_CULL_FRONT_BACK) ? "cull-all, " : "" 00107 ); 00108 } 00109 00110 00114 void _mesa_print_info( void ) 00115 { 00116 _mesa_debug(NULL, "Mesa GL_VERSION = %s\n", 00117 (char *) _mesa_GetString(GL_VERSION)); 00118 _mesa_debug(NULL, "Mesa GL_RENDERER = %s\n", 00119 (char *) _mesa_GetString(GL_RENDERER)); 00120 _mesa_debug(NULL, "Mesa GL_VENDOR = %s\n", 00121 (char *) _mesa_GetString(GL_VENDOR)); 00122 _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n", 00123 (char *) _mesa_GetString(GL_EXTENSIONS)); 00124 #if defined(THREADS) 00125 _mesa_debug(NULL, "Mesa thread-safe: YES\n"); 00126 #else 00127 _mesa_debug(NULL, "Mesa thread-safe: NO\n"); 00128 #endif 00129 #if defined(USE_X86_ASM) 00130 _mesa_debug(NULL, "Mesa x86-optimized: YES\n"); 00131 #else 00132 _mesa_debug(NULL, "Mesa x86-optimized: NO\n"); 00133 #endif 00134 #if defined(USE_SPARC_ASM) 00135 _mesa_debug(NULL, "Mesa sparc-optimized: YES\n"); 00136 #else 00137 _mesa_debug(NULL, "Mesa sparc-optimized: NO\n"); 00138 #endif 00139 } 00140 00141 00150 static void add_debug_flags( const char *debug ) 00151 { 00152 #ifdef DEBUG 00153 struct debug_option { 00154 const char *name; 00155 GLbitfield flag; 00156 }; 00157 static const struct debug_option debug_opt[] = { 00158 { "varray", VERBOSE_VARRAY }, 00159 { "tex", VERBOSE_TEXTURE }, 00160 { "imm", VERBOSE_IMMEDIATE }, 00161 { "pipe", VERBOSE_PIPELINE }, 00162 { "driver", VERBOSE_DRIVER }, 00163 { "state", VERBOSE_STATE }, 00164 { "api", VERBOSE_API }, 00165 { "list", VERBOSE_DISPLAY_LIST }, 00166 { "lighting", VERBOSE_LIGHTING }, 00167 { "disassem", VERBOSE_DISASSEM }, 00168 { "glsl", VERBOSE_GLSL }, /* report GLSL compile/link errors */ 00169 { "glsl_dump", VERBOSE_GLSL_DUMP } /* print shader GPU instructions */ 00170 }; 00171 GLuint i; 00172 00173 MESA_VERBOSE = 0x0; 00174 for (i = 0; i < Elements(debug_opt); i++) { 00175 if (_mesa_strstr(debug, debug_opt[i].name)) 00176 MESA_VERBOSE |= debug_opt[i].flag; 00177 } 00178 00179 /* Debug flag: 00180 */ 00181 if (_mesa_strstr(debug, "flush")) 00182 MESA_DEBUG_FLAGS |= DEBUG_ALWAYS_FLUSH; 00183 00184 #if defined(_FPU_GETCW) && defined(_FPU_SETCW) 00185 if (_mesa_strstr(debug, "fpexceptions")) { 00186 /* raise FP exceptions */ 00187 fpu_control_t mask; 00188 _FPU_GETCW(mask); 00189 mask &= ~(_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM 00190 | _FPU_MASK_OM | _FPU_MASK_UM); 00191 _FPU_SETCW(mask); 00192 } 00193 #endif 00194 00195 #else 00196 (void) debug; 00197 #endif 00198 } 00199 00200 00201 void 00202 _mesa_init_debug( GLcontext *ctx ) 00203 { 00204 char *c; 00205 00206 /* Dither disable */ 00207 ctx->NoDither = _mesa_getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE; 00208 if (ctx->NoDither) { 00209 if (_mesa_getenv("MESA_DEBUG")) { 00210 _mesa_debug(ctx, "MESA_NO_DITHER set - dithering disabled\n"); 00211 } 00212 ctx->Color.DitherFlag = GL_FALSE; 00213 } 00214 00215 c = _mesa_getenv("MESA_DEBUG"); 00216 if (c) 00217 add_debug_flags(c); 00218 00219 c = _mesa_getenv("MESA_VERBOSE"); 00220 if (c) 00221 add_debug_flags(c); 00222 } 00223 Generated on Sat May 26 2012 04:16:27 for ReactOS by
1.7.6.1
|