From b7a4304f70c498ff68fceaf584b579ea2df91acb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 30 Nov 1999 20:34:51 +0000 Subject: [PATCH] print debug info in gl_make_current() if MESA_INFO env var set --- src/mesa/main/context.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index e41afe15cee..408fe0aa198 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.23 1999/11/24 18:48:31 brianp Exp $ */ +/* $Id: context.c,v 1.24 1999/11/30 20:34:51 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -50,6 +50,7 @@ #include "enums.h" #include "extensions.h" #include "fog.h" +#include "get.h" #include "glapi.h" #include "hash.h" #include "light.h" @@ -1017,6 +1018,7 @@ static void initialize_context( GLcontext *ctx ) /* For debug/development only */ ctx->NoRaster = getenv("MESA_NO_RASTER") ? GL_TRUE : GL_FALSE; + ctx->FirstTimeCurrent = GL_TRUE; /* Dither disable */ ctx->NoDither = getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE; @@ -1279,6 +1281,7 @@ GLcontext *gl_create_context( GLvisual *visual, ctx->Driver.ReadDepthSpanFloat = gl_read_depth_span_float; ctx->Driver.ReadDepthSpanInt = gl_read_depth_span_int; + #ifdef PROFILE init_timings( ctx ); #endif @@ -1531,6 +1534,21 @@ void gl_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer, newCtx->NewState = NEW_ALL; /* just to be safe */ gl_update_state( newCtx ); } + + /* We can use this to help debug user's problems. Tell the to set + * the MESA_INFO env variable before running their app. Then the + * first time each context is made current we'll print some useful + * information. + */ + if (newCtx->FirstTimeCurrent) { + if (getenv("MESA_INFO")) { + fprintf(stderr, "Mesa GL_VERSION = %s\n", (char *) _mesa_GetString(GL_VERSION)); + fprintf(stderr, "Mesa GL_RENDERER = %s\n", (char *) _mesa_GetString(GL_RENDERER)); + fprintf(stderr, "Mesa GL_VENDOR = %s\n", (char *) _mesa_GetString(GL_VENDOR)); + fprintf(stderr, "Mesa GL_EXTENSIONS = %s\n", (char *) _mesa_GetString(GL_EXTENSIONS)); + } + newCtx->FirstTimeCurrent = GL_FALSE; + } }