mesa/gallium: automatically lower alpha-testing
[mesa.git] / src / mesa / state_tracker / st_debug.c
index 9eb3b53b2304bbfd002bab4adf68e93611e34c08..7faffb581ef1b426e8c2fb9ed1e85eeaa26c6c63 100644 (file)
@@ -27,6 +27,7 @@
 
 
 #include "main/context.h"
+#include "main/debug_output.h"
 #include "program/prog_print.h"
 
 #include "pipe/p_state.h"
@@ -41,7 +42,6 @@
 
 
 
-#ifdef DEBUG
 int ST_DEBUG = 0;
 
 static const struct debug_named_value st_debug_flags[] = {
@@ -58,19 +58,17 @@ static const struct debug_named_value st_debug_flags[] = {
    { "wf",       DEBUG_WIREFRAME, NULL },
    { "precompile",  DEBUG_PRECOMPILE, NULL },
    { "gremedy",  DEBUG_GREMEDY, "Enable GREMEDY debug extensions" },
+   { "noreadpixcache", DEBUG_NOREADPIXCACHE, 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
 }
 
 
@@ -96,12 +94,12 @@ st_print_current(void)
 
    if (st->vp->variants)
       tgsi_dump( st->vp->variants[0].tgsi.tokens, 0 );
-   if (st->vp->Base.Base.Parameters)
-      _mesa_print_parameter_list(st->vp->Base.Base.Parameters);
+   if (st->vp->Base.Parameters)
+      _mesa_print_parameter_list(st->vp->Base.Parameters);
 
    tgsi_dump(st->fp->tgsi.tokens, 0);
-   if (st->fp->Base.Base.Parameters)
-      _mesa_print_parameter_list(st->fp->Base.Base.Parameters);
+   if (st->fp->Base.Parameters)
+      _mesa_print_parameter_list(st->fp->Base.Parameters);
 }
 
 
@@ -159,19 +157,23 @@ st_debug_message(void *data,
    default:
       unreachable("invalid debug type");
    }
-   _mesa_gl_vdebug(st->ctx, id, source, type, severity, fmt, args);
+   _mesa_gl_vdebugf(st->ctx, id, source, type, severity, fmt, args);
 }
 
 void
-st_enable_debug_output(struct st_context *st, boolean enable)
+st_update_debug_callback(struct st_context *st)
 {
    struct pipe_context *pipe = st->pipe;
 
    if (!pipe->set_debug_callback)
       return;
 
-   if (enable) {
-      struct pipe_debug_callback cb = { st_debug_message, st };
+   if (_mesa_get_debug_state_int(st->ctx, GL_DEBUG_OUTPUT)) {
+      struct pipe_debug_callback cb;
+      memset(&cb, 0, sizeof(cb));
+      cb.async = !_mesa_get_debug_state_int(st->ctx, GL_DEBUG_OUTPUT_SYNCHRONOUS);
+      cb.debug_message = st_debug_message;
+      cb.data = st;
       pipe->set_debug_callback(pipe, &cb);
    } else {
       pipe->set_debug_callback(pipe, NULL);