mesa: Add "shader/" path to #include statements in shader parser/lexer sources
[mesa.git] / src / mesa / state_tracker / st_debug.c
index cffd66751def92ace91edea98a8abb1d7f3d42d0..6e699ca5522477336456be0eacdeda12be9b2ef8 100644 (file)
@@ -31,9 +31,9 @@
 
 #include "pipe/p_state.h"
 #include "pipe/p_shader_tokens.h"
-#include "pipe/tgsi/util/tgsi_dump.h"
+#include "tgsi/tgsi_dump.h"
 
-#include "pipe/cso_cache/cso_cache.h"
+#include "cso_cache/cso_cache.h"
 
 #include "st_context.h"
 #include "st_debug.h"
 
 
 
+#ifdef DEBUG
+int ST_DEBUG = 0;
+
+static const struct debug_named_value st_debug_flags[] = {
+   { "mesa",     DEBUG_MESA },
+   { "tgsi",     DEBUG_TGSI },
+   { "pipe",     DEBUG_PIPE },
+   { "tex",      DEBUG_TEX },
+   { "fallback", DEBUG_FALLBACK },
+   { "screen",   DEBUG_SCREEN },
+   { "query",    DEBUG_QUERY },
+   {NULL, 0}
+};
+#endif
+
+
+void
+st_debug_init(void)
+{
+#ifdef DEBUG
+   ST_DEBUG = debug_get_flags_option("ST_DEBUG", st_debug_flags, 0 );
+#endif
+}
+
+
+
 /**
  * Print current state.  May be called from inside gdb to see currently
  * bound vertex/fragment shaders and associated constants.
@@ -50,18 +76,24 @@ st_print_current(void)
 {
    GET_CURRENT_CONTEXT(ctx);
    struct st_context *st = ctx->st;
+
+#if 0
    int i;
 
    printf("Vertex Transform Inputs:\n");
-   for (i = 0; i < st->state.vs->state.num_inputs; i++) {
+   for (i = 0; i < st->vp->state.num_inputs; i++) {
       printf("  Slot %d:  VERT_ATTRIB_%d\n", i, st->vp->index_to_input[i]);
    }
+#endif
 
-   tgsi_dump( st->state.vs->state.tokens, 0 );
+   if (st->vp->varients)
+      tgsi_dump( st->vp->varients[0].state.tokens, 0 );
    if (st->vp->Base.Base.Parameters)
       _mesa_print_parameter_list(st->vp->Base.Base.Parameters);
 
-   tgsi_dump( st->state.fs->state.tokens, 0 );
+   tgsi_dump( st->fp->state.tokens, 0 );
    if (st->fp->Base.Base.Parameters)
       _mesa_print_parameter_list(st->fp->Base.Base.Parameters);
 }
+
+