Merge remote branch 'origin/master' into nv50-compiler
[mesa.git] / src / mesa / state_tracker / st_debug.c
index c7d26ce33cf4a35ca40ad1234e3c88d72e5b24c3..df32491d044c4966fe2985afd1df850c8e0df572 100644 (file)
@@ -27,7 +27,7 @@
 
 
 #include "main/context.h"
-#include "shader/prog_print.h"
+#include "program/prog_print.h"
 
 #include "pipe/p_state.h"
 #include "pipe/p_shader_tokens.h"
 
 
 
+#ifdef DEBUG
+int ST_DEBUG = 0;
+
+static const struct debug_named_value st_debug_flags[] = {
+   { "mesa",     DEBUG_MESA, NULL },
+   { "tgsi",     DEBUG_TGSI, NULL },
+   { "constants",DEBUG_CONSTANTS, NULL },
+   { "pipe",     DEBUG_PIPE, NULL },
+   { "tex",      DEBUG_TEX, NULL },
+   { "fallback", DEBUG_FALLBACK, NULL },
+   { "screen",   DEBUG_SCREEN, NULL },
+   { "query",    DEBUG_QUERY, NULL },
+   DEBUG_NAMED_VALUE_END
+};
+
+DEBUG_GET_ONCE_FLAGS_OPTION(st_debug, "ST_DEBUG", st_debug_flags, 0)
+#endif
+
+
+void
+st_debug_init(void)
+{
+#ifdef DEBUG
+   ST_DEBUG = debug_get_option_st_debug();
+#endif
+}
+
+
+
 /**
  * Print current state.  May be called from inside gdb to see currently
  * bound vertex/fragment shaders and associated constants.
@@ -49,7 +78,7 @@ void
 st_print_current(void)
 {
    GET_CURRENT_CONTEXT(ctx);
-   struct st_context *st = ctx->st;
+   struct st_context *st = st_context(ctx);
 
 #if 0
    int i;
@@ -60,11 +89,14 @@ st_print_current(void)
    }
 #endif
 
-   tgsi_dump( st->vp->state.tokens, 0 );
+   if (st->vp->varients)
+      tgsi_dump( st->vp->varients[0].tgsi.tokens, 0 );
    if (st->vp->Base.Base.Parameters)
       _mesa_print_parameter_list(st->vp->Base.Base.Parameters);
 
-   tgsi_dump( st->fp->state.tokens, 0 );
+   tgsi_dump( st->fp->tgsi.tokens, 0 );
    if (st->fp->Base.Base.Parameters)
       _mesa_print_parameter_list(st->fp->Base.Base.Parameters);
 }
+
+