gallium: Use p_debug.h instead of non-portable stdio.h/assert.h functions.
authorJosé Fonseca <jrfonseca@tungstengraphics.com>
Wed, 6 Feb 2008 05:37:49 +0000 (14:37 +0900)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Wed, 6 Feb 2008 05:37:49 +0000 (14:37 +0900)
47 files changed:
src/mesa/pipe/draw/draw_prim.c
src/mesa/pipe/draw/draw_vbuf.c
src/mesa/pipe/draw/draw_vertex_fetch.c
src/mesa/pipe/draw/draw_vertex_shader.c
src/mesa/pipe/draw/draw_vertex_shader_llvm.c
src/mesa/pipe/draw/draw_vf.c
src/mesa/pipe/draw/draw_vf_generic.c
src/mesa/pipe/draw/draw_vf_sse.c
src/mesa/pipe/i915simple/i915_fpc_translate.c
src/mesa/pipe/i915simple/i915_prim_vbuf.c
src/mesa/pipe/i915simple/i915_state_derived.c
src/mesa/pipe/i915simple/i915_state_emit.c
src/mesa/pipe/i915simple/i915_state_immediate.c
src/mesa/pipe/i915simple/i915_state_sampler.c
src/mesa/pipe/i965simple/brw_cc.c
src/mesa/pipe/i965simple/brw_curbe.c
src/mesa/pipe/i965simple/brw_eu_debug.c
src/mesa/pipe/i965simple/brw_eu_emit.c
src/mesa/pipe/i965simple/brw_sf.c
src/mesa/pipe/i965simple/brw_sf_emit.c
src/mesa/pipe/i965simple/brw_state.c
src/mesa/pipe/i965simple/brw_state_cache.c
src/mesa/pipe/i965simple/brw_state_pool.c
src/mesa/pipe/i965simple/brw_urb.c
src/mesa/pipe/i965simple/brw_vs_emit.c
src/mesa/pipe/i965simple/brw_wm.c
src/mesa/pipe/i965simple/brw_wm_glsl.c
src/mesa/pipe/i965simple/brw_wm_sampler_state.c
src/mesa/pipe/p_compiler.h
src/mesa/pipe/p_format.h
src/mesa/pipe/p_util.h
src/mesa/pipe/pipebuffer/pb_buffer.h
src/mesa/pipe/pipebuffer/pb_buffer_fenced.c
src/mesa/pipe/pipebuffer/pb_buffer_fenced.h
src/mesa/pipe/pipebuffer/pb_buffer_malloc.c
src/mesa/pipe/pipebuffer/pb_bufmgr_fenced.c
src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c
src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c
src/mesa/pipe/softpipe/sp_prim_setup.c
src/mesa/pipe/softpipe/sp_quad_fs.c
src/mesa/pipe/softpipe/sp_tile_cache.c
src/mesa/pipe/tgsi/exec/tgsi_exec.c
src/mesa/pipe/tgsi/exec/tgsi_sse2.c
src/mesa/pipe/tgsi/util/tgsi_build.c
src/mesa/pipe/tgsi/util/tgsi_dump.c
src/mesa/pipe/tgsi/util/tgsi_parse.c
src/mesa/pipe/tgsi/util/tgsi_util.c

index 58400213d7698b48d603d0c955efb8d9342b82e3..51e2242719a194738a1d54bc6904e5706a0e2d5d 100644 (file)
@@ -30,6 +30,8 @@
   *   Keith Whitwell <keith@tungstengraphics.com>
   */
 
+#include "pipe/p_debug.h"
+
 #include "draw_private.h"
 #include "draw_context.h"
 
@@ -60,8 +62,8 @@ static void draw_prim_queue_flush( struct draw_context *draw )
    unsigned i;
 
    if (0)
-      fprintf(stdout,"Flushing with %d prims, %d verts\n",
-             draw->pq.queue_nr, draw->vs.queue_nr);
+      debug_printf("Flushing with %d prims, %d verts\n",
+                   draw->pq.queue_nr, draw->vs.queue_nr);
 
    assert (draw->pq.queue_nr != 0);
 
@@ -120,9 +122,9 @@ static void draw_prim_queue_flush( struct draw_context *draw )
 void draw_do_flush( struct draw_context *draw, unsigned flags )
 {
    if (0)
-      fprintf(stdout,"Flushing with %d verts, %d prims\n",
-             draw->vs.queue_nr,
-             draw->pq.queue_nr );
+      debug_printf("Flushing with %d verts, %d prims\n",
+                   draw->vs.queue_nr,
+                   draw->pq.queue_nr );
 
 
    if (flags >= DRAW_FLUSH_SHADER_QUEUE) {
@@ -157,11 +159,11 @@ static struct prim_header *get_queued_prim( struct draw_context *draw,
                                            unsigned nr_verts )
 {
    if (!draw_vertex_cache_check_space( draw, nr_verts )) {
-//      fprintf(stderr, "v");
+//      debug_printf("v");
       draw_do_flush( draw, DRAW_FLUSH_VERTEX_CACHE );
    }
    else if (draw->pq.queue_nr == PRIM_QUEUE_LENGTH) {
-//      fprintf(stderr, "p");
+//      debug_printf("p");
       draw_do_flush( draw, DRAW_FLUSH_PRIM_QUEUE );
    }
 
@@ -283,7 +285,7 @@ draw_prim( struct draw_context *draw,
    boolean unfilled = (draw->rasterizer->fill_cw != PIPE_POLYGON_MODE_FILL ||
                       draw->rasterizer->fill_ccw != PIPE_POLYGON_MODE_FILL);
 
-//   _mesa_printf("%s (%d) %d/%d\n", __FUNCTION__, draw->prim, start, count );
+//   debug_printf("%s (%d) %d/%d\n", __FUNCTION__, draw->prim, start, count );
 
    switch (prim) {
    case PIPE_PRIM_POINTS:
index ac03001d8f35c61641d44351152914b533069702..be96c8fdeb1b4673de86c4ea8129e10c1b2ec9d9 100644 (file)
@@ -34,8 +34,7 @@
  */
 
 
-#include <assert.h>
-
+#include "pipe/p_debug.h"
 #include "pipe/p_util.h"
 
 #include "draw_vbuf.h"
@@ -125,55 +124,55 @@ dump_emitted_vertex(const struct vertex_info *vinfo, const uint8_t *data)
       j = vinfo->src_index[i];
       switch (vinfo->emit[i]) {
       case EMIT_OMIT:
-         fprintf(stderr, "EMIT_OMIT:");
+         debug_printf("EMIT_OMIT:");
          break;
       case EMIT_ALL:
          assert(i == 0);
          assert(j == 0);
-         fprintf(stderr, "EMIT_ALL:\t");
+         debug_printf("EMIT_ALL:\t");
          for(k = 0; k < vinfo->size*4; ++k)
-            fprintf(stderr, "%02x ", *data++);
+            debug_printf("%02x ", *data++);
          break;
       case EMIT_1F:
-         fprintf(stderr, "EMIT_1F:\t");
-         fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
+         debug_printf("EMIT_1F:\t");
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
          break;
       case EMIT_1F_PSIZE:
-         fprintf(stderr, "EMIT_1F_PSIZE:\t");
-         fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
+         debug_printf("EMIT_1F_PSIZE:\t");
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
          break;
       case EMIT_2F:
-         fprintf(stderr, "EMIT_2F:\t");
-         fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
-         fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
+         debug_printf("EMIT_2F:\t");
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
          break;
       case EMIT_3F:
-         fprintf(stderr, "EMIT_3F:\t");
-         fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
-         fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
-         fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
+         debug_printf("EMIT_3F:\t");
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
          data += sizeof(float);
          break;
       case EMIT_4F:
-         fprintf(stderr, "EMIT_4F:\t");
-         fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
-         fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
-         fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
-         fprintf(stderr, "%f ", *(float *)data); data += sizeof(float);
+         debug_printf("EMIT_4F:\t");
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
+         debug_printf("%f ", *(float *)data); data += sizeof(float);
          break;
       case EMIT_4UB:
-         fprintf(stderr, "EMIT_4UB:\t");
-         fprintf(stderr, "%u ", *data++);
-         fprintf(stderr, "%u ", *data++);
-         fprintf(stderr, "%u ", *data++);
-         fprintf(stderr, "%u ", *data++);
+         debug_printf("EMIT_4UB:\t");
+         debug_printf("%u ", *data++);
+         debug_printf("%u ", *data++);
+         debug_printf("%u ", *data++);
+         debug_printf("%u ", *data++);
          break;
       default:
          assert(0);
       }
-      fprintf(stderr, "\n");
+      debug_printf("\n");
    }
-   fprintf(stderr, "\n");
+   debug_printf("\n");
 }
 #endif
 
@@ -190,7 +189,7 @@ emit_vertex( struct vbuf_stage *vbuf,
              struct vertex_header *vertex )
 {
 #if 0
-   fprintf(stderr, "emit vertex %d to %p\n", 
+   debug_printf("emit vertex %d to %p\n", 
            vbuf->nr_vertices, vbuf->vertex_ptr);
 #endif
 
@@ -198,7 +197,7 @@ emit_vertex( struct vbuf_stage *vbuf,
       if(vertex->vertex_id < vbuf->nr_vertices)
         return;
       else
-        fprintf(stderr, "Bad vertex id 0x%04x (>= 0x%04x)\n", 
+        debug_printf("Bad vertex id 0x%04x (>= 0x%04x)\n", 
                 vertex->vertex_id, vbuf->nr_vertices);
       return;
    }
@@ -269,9 +268,9 @@ emit_vertex( struct vbuf_stage *vbuf,
         static float data[256]; 
         draw_vf_emit_vertex(vbuf->vf, vertex, data);
         if(memcmp((uint8_t *)vbuf->vertex_ptr - vbuf->vertex_size, data, vbuf->vertex_size)) {
-            fprintf(stderr, "With VF:\n");
+            debug_printf("With VF:\n");
             dump_emitted_vertex(vbuf->vinfo, (uint8_t *)data);
-           fprintf(stderr, "Without VF:\n");
+           debug_printf("Without VF:\n");
            dump_emitted_vertex(vbuf->vinfo, (uint8_t *)vbuf->vertex_ptr - vbuf->vertex_size);
            assert(0);
         }
index b23f487e7416f6460100465f6eb724bc2f218f9f..e13df04605c7639df82fc533066c7505a3e47f2b 100644 (file)
@@ -162,7 +162,7 @@ static fetch_func get_fetch_func( enum pipe_format format )
    {
       char tmp[80];
       pf_sprint_name(tmp, format);
-      _mesa_printf("%s: %s\n", __FUNCTION__, tmp);
+      debug_printf("%s: %s\n", __FUNCTION__, tmp);
    }
 #endif
 
@@ -332,7 +332,7 @@ static void fetch_xyz_rgb( struct draw_context *draw,
 
    assert(count <= 4);
 
-//   _mesa_printf("%s\n", __FUNCTION__);
+//   debug_printf("%s\n", __FUNCTION__);
 
    /* loop over vertex attributes (vertex shader inputs)
     */
@@ -421,7 +421,7 @@ static void generic_vertex_fetch( struct draw_context *draw,
 
    assert(count <= 4);
 
-//   _mesa_printf("%s %d\n", __FUNCTION__, count);
+//   debug_printf("%s %d\n", __FUNCTION__, count);
 
    /* loop over vertex attributes (vertex shader inputs)
     */
@@ -467,7 +467,7 @@ void draw_update_vertex_fetch( struct draw_context *draw )
 {
    unsigned nr_attrs, i;
 
-//   _mesa_printf("%s\n", __FUNCTION__);
+//   debug_printf("%s\n", __FUNCTION__);
    
    /* this may happend during context init */
    if (!draw->vertex_shader)
index b851da845f00dff65b7880281466b57307229915..e6590eafcc8a97d95e11f1b72236f32dc5bec2e5 100644 (file)
@@ -166,7 +166,7 @@ run_vertex_program(struct draw_context *draw,
       vOut[j]->data[0][3] = w;
 
 #if DBG_VS
-      printf("output[%d]win: %f %f %f %f\n", j,
+      debug_printf("output[%d]win: %f %f %f %f\n", j,
              vOut[j]->data[0][0],
              vOut[j]->data[0][1],
              vOut[j]->data[0][2],
@@ -181,7 +181,7 @@ run_vertex_program(struct draw_context *draw,
          vOut[j]->data[slot][2] = machine->Outputs[slot].xyzw[2].f[j];
          vOut[j]->data[slot][3] = machine->Outputs[slot].xyzw[3].f[j];
 #if DBG_VS
-         printf("output[%d][%d]: %f %f %f %f\n", j, slot,
+         debug_printf("output[%d][%d]: %f %f %f %f\n", j, slot,
                 vOut[j]->data[slot][0],
                 vOut[j]->data[slot][1],
                 vOut[j]->data[slot][2],
@@ -207,7 +207,7 @@ draw_vertex_shader_queue_flush(struct draw_context *draw)
     */
    draw_update_vertex_fetch( draw );
 
-//   fprintf(stderr, " q(%d) ", draw->vs.queue_nr );
+//   debug_printf( " q(%d) ", draw->vs.queue_nr );
 #ifdef MESA_LLVM
    if (draw->vertex_shader->llvm_prog) {
       draw_vertex_shader_queue_flush_llvm(draw);
index 4228c4f3889669756638f08147a1bd7cf3140bf6..63551c993e716b8fce5e434d5c4269f158776ef4 100644 (file)
@@ -152,7 +152,7 @@ void draw_vertex_shader_queue_flush_llvm(struct draw_context *draw)
       z = vOut->clip[2] = dests[0][2];
       w = vOut->clip[3] = dests[0][3];
 #if DBG
-      printf("output %d: %f %f %f %f\n", 0, x, y, z, w);
+      debug_printf("output %d: %f %f %f %f\n", 0, x, y, z, w);
 #endif
 
       vOut->clipmask = compute_clipmask(vOut->clip, draw->plane, draw->nr_planes);
@@ -179,7 +179,7 @@ void draw_vertex_shader_queue_flush_llvm(struct draw_context *draw)
          vOut->data[slot][3] = dests[slot][3];
 
 #if DBG
-         printf("output %d: %f %f %f %f\n", slot,
+         debug_printf("output %d: %f %f %f %f\n", slot,
                 vOut->data[slot][0],
                 vOut->data[slot][1],
                 vOut->data[slot][2],
index 0da8e59ad68b4532a4d9ec6ecbfa2850d6e9b6bc..f23d7fcec5c827be38d1914be0a72d197fa16b10 100644 (file)
@@ -168,7 +168,7 @@ draw_vf_set_vertex_attributes( struct draw_vertex_fetch *vf,
       const unsigned format = map[i].format;
       if (format == DRAW_EMIT_PAD) {
 #if (DRAW_VF_DBG)
-           _mesa_printf("%d: pad %d, offset %d\n", i,  
+           debug_printf("%d: pad %d, offset %d\n", i,  
                         map[i].offset, offset);  
 #endif
 
@@ -186,7 +186,7 @@ draw_vf_set_vertex_attributes( struct draw_vertex_fetch *vf,
            memcpy(vf->attr[j].data, &map[i].data, vf->attr[j].vertattrsize);
         
 #if (DRAW_VF_DBG)
-           _mesa_printf("%d: %s, offset %d\n", i,  
+           debug_printf("%d: %s, offset %d\n", i,  
                         draw_vf_format_info[format].name,
                         vf->attr[j].vertoffset);   
 #endif
index 7f5f56ef9ccdbcd05eda025c06db56d70a11056f..7a60a9db9c314674a2ed2849c8d9e4a3459d8ea6 100644 (file)
@@ -27,9 +27,8 @@
  */
 
 
-#include <assert.h>
-
 #include "pipe/p_compiler.h"
+#include "pipe/p_debug.h"
 #include "pipe/p_util.h"
 
 #include "draw_vf.h"
index 1389e6cfb9c57cad2197ce8a326457a9399eccc5..1ad2ae756ddf9e20c05e02cce45a689b81936d76 100644 (file)
@@ -453,7 +453,7 @@ static boolean build_vertex_emit( struct x86_program *p )
            update_src_ptr(p, srcECX, vfESI, a);
         }
         else {
-           fprintf(stderr, "Can't emit 1ub %x %x %d\n", 
+           debug_printf("Can't emit 1ub %x %x %d\n", 
                    a->vertoffset, a[-1].vertoffset, a[-1].vertattrsize );
            return FALSE;
         }
@@ -499,7 +499,7 @@ static boolean build_vertex_emit( struct x86_program *p )
            j++;                /* NOTE: two attrs consumed */
         }
         else {
-           fprintf(stderr, "Can't emit 3ub\n");
+           debug_printf("Can't emit 3ub\n");
         }
         return FALSE;  /* add this later */
         break;
@@ -532,7 +532,7 @@ static boolean build_vertex_emit( struct x86_program *p )
         update_src_ptr(p, srcECX, vfESI, a);
         break;
       default:
-        fprintf(stderr, "unknown a[%d].format %d\n", j, a->format);
+        debug_printf("unknown a[%d].format %d\n", j, a->format);
         return FALSE;  /* catch any new opcodes */
       }
       
index 0185512aeb8df29c50a44aa380dbaa135bff92d1..868f0c7e046bc54f4b1de08ad5eb0b4fb2f9ce08 100644 (file)
@@ -100,7 +100,7 @@ negate(int reg, int x, int y, int z, int w)
 static void
 i915_use_passthrough_shader(struct i915_context *i915)
 {
-   fprintf(stderr, "**** Using i915 pass-through fragment shader\n");
+   debug_printf("**** Using i915 pass-through fragment shader\n");
 
    i915->current.program = (uint *) MALLOC(sizeof(passthrough));
    if (i915->current.program) {
@@ -119,12 +119,12 @@ i915_program_error(struct i915_fp_compile *p, const char *msg, ...)
    va_list args;
    char buffer[1024];
 
-   fprintf(stderr, "i915_program_error: ");
+   debug_printf("i915_program_error: ");
    va_start( args, msg );  
    vsprintf( buffer, msg, args );
    va_end( args );
-   fprintf(stderr, buffer);
-   fprintf(stderr, "\n");
+   debug_printf(buffer);
+   debug_printf("\n");
 
    p->error = 1;
 }
@@ -169,7 +169,7 @@ src_vector(struct i915_fp_compile *p,
 
       switch (sem_name) {
       case TGSI_SEMANTIC_POSITION:
-         fprintf(stderr, "SKIP SEM POS\n");
+         debug_printf("SKIP SEM POS\n");
          /*
          assert(p->wpos_tex != -1);
          src = i915_emit_decl(p, REG_TYPE_T, p->wpos_tex, D0_CHANNEL_ALL);
@@ -913,7 +913,7 @@ i915_translate_instructions(struct i915_fp_compile *p,
             ind = parse.FullToken.FullDeclaration.u.DeclarationRange.First;
             sem = parse.FullToken.FullDeclaration.Semantic.SemanticName;
             semi = parse.FullToken.FullDeclaration.Semantic.SemanticIndex;
-            /*printf("FS Input DECL [%u] sem %u\n", ind, sem);*/
+            /*debug_printf("FS Input DECL [%u] sem %u\n", ind, sem);*/
             p->input_semantic_name[ind] = sem;
             p->input_semantic_index[ind] = semi;
          }
@@ -924,7 +924,7 @@ i915_translate_instructions(struct i915_fp_compile *p,
             ind = parse.FullToken.FullDeclaration.u.DeclarationRange.First;
             sem = parse.FullToken.FullDeclaration.Semantic.SemanticName;
             semi = parse.FullToken.FullDeclaration.Semantic.SemanticIndex;
-            /*printf("FS Output DECL [%u] sem %u\n", ind, sem);*/
+            /*debug_printf("FS Output DECL [%u] sem %u\n", ind, sem);*/
             p->output_semantic_name[ind] = sem;
             p->output_semantic_index[ind] = semi;
          }
index 39154b2488baa23c3b1b612487f1c90a862277b5..e069773fd4e993c78abbb3d5c8499a5721d30ce4 100644 (file)
@@ -38,9 +38,8 @@
  */
 
 
-#include <assert.h>
-
 #include "pipe/draw/draw_vbuf.h"
+#include "pipe/p_debug.h"
 #include "pipe/p_util.h"
 #include "pipe/p_inlines.h"
 #include "pipe/p_winsys.h"
index 62741e30f8026ec97d1a9386398fc3e3dd5fbbea..653983e4a9922fe3e1eb348a58dae9dc9525b6bc 100644 (file)
@@ -87,7 +87,7 @@ static void calculate_vertex_layout( struct i915_context *i915 )
          }
          break;
       case TGSI_SEMANTIC_FOG:
-         fprintf(stderr, "i915 fogcoord not implemented yet\n");
+         debug_printf("i915 fogcoord not implemented yet\n");
          draw_emit_vertex_attr(&vinfo, EMIT_1F, INTERP_PERSPECTIVE, src++);
          break;
       default:
index 657f5238938cb72bc2610a28a56763ac72c64b52..3339287f498b89653ad30630548f2e66690b84bf 100644 (file)
@@ -107,7 +107,7 @@ i915_emit_hardware_state(struct i915_context *i915 )
                            ) * 3/2; /* plus 50% margin */
 
 #if 0
-   fprintf (stderr, "i915_emit_hardware_state: %d dwords, %d relocs\n", dwords, relocs);
+   debug_printf("i915_emit_hardware_state: %d dwords, %d relocs\n", dwords, relocs);
 #endif
    
    if(!BEGIN_BATCH(dwords, relocs)) {
index 752d25f2331612d6f7712bef8634a2a9f9f62e39..07031fc6c5ba6d6962119734e60f9b2459388ba7 100644 (file)
@@ -97,7 +97,7 @@ static void upload_S2S4(struct i915_context *i915)
       LIS2 = i915->current.vertex_info.hwfmt[1];
       LIS4 = i915->current.vertex_info.hwfmt[0];
       /*
-      printf("LIS2: 0x%x  LIS4: 0x%x\n", LIS2, LIS4);
+      debug_printf("LIS2: 0x%x  LIS4: 0x%x\n", LIS2, LIS4);
       */
       assert(LIS4); /* should never be zero? */
    }
index 59408b6ba06660754448908ba837c5555bef6335..0dbbc5241d5371a864e6650df388b6dfa950bc2d 100644 (file)
@@ -169,7 +169,7 @@ translate_texture_format(enum pipe_format pipeFormat)
    case PIPE_FORMAT_S8Z24_UNORM:
       return (MAPSURF_32BIT | MT_32BIT_xL824);
    default:
-      fprintf(stderr, "i915: translate_texture_format() bad image format %x\n",
+      debug_printf("i915: translate_texture_format() bad image format %x\n",
               pipeFormat);
       assert(0);
       return 0;
index dcee7318958d5d5e557711ea58ce7a0f27b304bf..337e4f95f692ba3c216d8db954cfa0ba70815783 100644 (file)
@@ -58,7 +58,7 @@ static int brw_translate_compare_func(int func)
       return BRW_COMPAREFUNCTION_ALWAYS;
    }
 
-   fprintf(stderr, "Unknown value in %s: %x\n", __FUNCTION__, func);
+   debug_printf("Unknown value in %s: %x\n", __FUNCTION__, func);
    return BRW_COMPAREFUNCTION_ALWAYS;
 }
 
index 2733eb4e75c9bc5f06033dfc58a6e5b097c1c854..52bbd525c16d72e8a089d6f07808c14643d2ee33 100644 (file)
@@ -273,10 +273,10 @@ static void upload_constant_buffer(struct brw_context *brw)
 
    if (1) {
       for (i = 0; i < sz; i+=4)
-        _mesa_printf("curbe %d.%d: %f %f %f %f\n", i/8, i&4,
+        debug_printf("curbe %d.%d: %f %f %f %f\n", i/8, i&4,
                      buf[i+0], buf[i+1], buf[i+2], buf[i+3]);
 
-      _mesa_printf("last_buf %p buf %p sz %d/%d cmp %d\n",
+      debug_printf("last_buf %p buf %p sz %d/%d cmp %d\n",
                   brw->curbe.last_buf, buf,
                   bufsz, brw->curbe.last_bufsz,
                   brw->curbe.last_buf ? memcmp(buf, brw->curbe.last_buf, bufsz) : -1);
@@ -299,7 +299,7 @@ static void upload_constant_buffer(struct brw_context *brw)
                          bufsz,
                          1 << 6,
                          &brw->curbe.gs_offset)) {
-        _mesa_printf("out of GS memory for curbe\n");
+        debug_printf("out of GS memory for curbe\n");
         assert(0);
         return;
       }
index be692f65022817d053598dbe0c2311e5b8eae558..4a94ddefa6a17731acc2e7ae5c52c1b8b14018f4 100644 (file)
@@ -30,6 +30,8 @@
   */
     
 
+#include "pipe/p_debug.h"
+
 #include "brw_eu.h"
 
 void brw_print_reg( struct brw_reg hwreg )
@@ -52,7 +54,7 @@ void brw_print_reg( struct brw_reg hwreg )
       "f"
    };
 
-   _mesa_printf("%s%s", 
+   debug_printf("%s%s", 
                hwreg.abs ? "abs/" : "",
                hwreg.negate ? "-" : "");
      
@@ -63,17 +65,17 @@ void brw_print_reg( struct brw_reg hwreg )
        hwreg.width == BRW_WIDTH_8 &&
        hwreg.hstride == BRW_HORIZONTAL_STRIDE_1 &&
        hwreg.type == BRW_REGISTER_TYPE_F) {
-      _mesa_printf("vec%d", hwreg.nr);
+      debug_printf("vec%d", hwreg.nr);
    }
    else if (hwreg.file == BRW_GENERAL_REGISTER_FILE &&
            hwreg.vstride == BRW_VERTICAL_STRIDE_0 &&
            hwreg.width == BRW_WIDTH_1 &&
            hwreg.hstride == BRW_HORIZONTAL_STRIDE_0 &&
            hwreg.type == BRW_REGISTER_TYPE_F) {      
-      _mesa_printf("scl%d.%d", hwreg.nr, hwreg.subnr / 4);
+      debug_printf("scl%d.%d", hwreg.nr, hwreg.subnr / 4);
    }
    else {
-      _mesa_printf("%s%d.%d<%d;%d,%d>:%s", 
+      debug_printf("%s%d.%d<%d;%d,%d>:%s", 
                   file[hwreg.file],
                   hwreg.nr,
                   hwreg.subnr / type_sz(hwreg.type),
index 2423536dd19d6f8319b7b55bfe41594e481563ff..400a80b6fbaf50f91536bce2a8dcf9cb010ce958 100644 (file)
@@ -953,7 +953,7 @@ void brw_SAMPLE(struct brw_compile *p,
    boolean need_stall = 0;
 
    if(writemask == 0) {
-/*       _mesa_printf("%s: zero writemask??\n", __FUNCTION__); */
+/*       debug_printf("%s: zero writemask??\n", __FUNCTION__); */
       return;
    }
 
@@ -985,7 +985,7 @@ void brw_SAMPLE(struct brw_compile *p,
 
       if (newmask != writemask) {
         need_stall = 1;
-/*      _mesa_printf("need stall %x %x\n", newmask , writemask); */
+/*      debug_printf("need stall %x %x\n", newmask , writemask); */
       }
       else {
         struct brw_reg m1 = brw_message_reg(msg_reg_nr);
index b89b2e408754357d5f2d2d93167d48c73ac74e21..7c83b81c858f2fb619967048d1ef86adcdcbbd95 100644 (file)
@@ -175,7 +175,7 @@ static void upload_sf_prog( struct brw_context *brw )
            //int semantic = parse.FullToken.FullDeclaration.Semantic.SemanticName;
            //int semantic_index = parse.FullToken.FullDeclaration.Semantic.SemanticIndex;
 
-           fprintf(stderr, "fs input %d..%d interp mode %d\n", first, last, interp_mode);
+           debug_printf("fs input %d..%d interp mode %d\n", first, last, interp_mode);
            
            switch (interp_mode) {
            case TGSI_INTERPOLATE_CONSTANT:
@@ -213,9 +213,9 @@ static void upload_sf_prog( struct brw_context *brw )
    key.linear_mask |= 1;
    key.const_mask <<= 1;
 
-   fprintf(stderr, "key.persp_mask: %x\n", key.persp_mask);
-   fprintf(stderr, "key.linear_mask: %x\n", key.linear_mask);
-   fprintf(stderr, "key.const_mask: %x\n", key.const_mask);
+   debug_printf("key.persp_mask: %x\n", key.persp_mask);
+   debug_printf("key.linear_mask: %x\n", key.linear_mask);
+   debug_printf("key.const_mask: %x\n", key.const_mask);
 
 
 //   key.do_point_sprite = brw->attribs.Point->PointSprite;
index 6ff5254ff732973f3198381dd35cb07211e4195e..78d6fa5e9e55da626a3953fd122d5bbb035a3852 100644 (file)
@@ -137,8 +137,8 @@ static boolean calculate_masks( struct brw_sf_compile *c,
    unsigned persp_mask = c->key.persp_mask;
    unsigned linear_mask = c->key.linear_mask;
 
-   fprintf(stderr, "persp_mask: %x\n", persp_mask);
-   fprintf(stderr, "linear_mask: %x\n", linear_mask);
+   debug_printf("persp_mask: %x\n", persp_mask);
+   debug_printf("linear_mask: %x\n", linear_mask);
 
    *pc_persp = 0;
    *pc_linear = 0;
@@ -162,9 +162,9 @@ static boolean calculate_masks( struct brw_sf_compile *c,
         *pc_linear |= 0xf0;
    }
 
-   fprintf(stderr, "pc: %x\n", *pc);
-   fprintf(stderr, "pc_persp: %x\n", *pc_persp);
-   fprintf(stderr, "pc_linear: %x\n", *pc_linear);
+   debug_printf("pc: %x\n", *pc);
+   debug_printf("pc_persp: %x\n", *pc_persp);
+   debug_printf("pc_linear: %x\n", *pc_linear);
    
 
    return is_last_attr;
@@ -177,7 +177,7 @@ void brw_emit_tri_setup( struct brw_sf_compile *c )
    struct brw_compile *p = &c->func;
    unsigned i;
 
-   fprintf(stderr, "%s START ==============\n", __FUNCTION__);
+   debug_printf("%s START ==============\n", __FUNCTION__);
 
    c->nr_verts = 3;
    alloc_regs(c);
@@ -250,7 +250,7 @@ void brw_emit_tri_setup( struct brw_sf_compile *c )
       }
    }
 
-   fprintf(stderr, "%s DONE ==============\n", __FUNCTION__);
+   debug_printf("%s DONE ==============\n", __FUNCTION__);
 
 }
 
index daf14ff4ff2d0ad31cd629730645ae1fc79a9b6e..95dfce88e4a7bfcf29a6642085b24861d24672d8 100644 (file)
@@ -225,7 +225,7 @@ static void brw_bind_vs_state(struct pipe_context *pipe, void *vs)
    brw->attribs.VertexProgram = (struct brw_vertex_program *)vs;
    brw->state.dirty.brw |= BRW_NEW_VS;
 
-   printf("YYYYYYYYYYYYY BINDING VERTEX SHADER\n");
+   debug_printf("YYYYYYYYYYYYY BINDING VERTEX SHADER\n");
 }
 
 static void brw_delete_vs_state(struct pipe_context *pipe, void *shader)
index c5738733f4e736ddfb73495b472c56f19251919a..b3a5124461d6e3591e8f807e0a1160fb7a2ac426 100644 (file)
@@ -149,7 +149,7 @@ unsigned brw_upload_cache( struct brw_cache *cache,
    if (!brw_pool_alloc(cache->pool, data_size, 1 << 6, &offset)) {
       /* Should not be possible:
        */
-      printf("brw_pool_alloc failed\n");
+      debug_printf("brw_pool_alloc failed\n");
       exit(1);
    }
 
@@ -177,7 +177,7 @@ unsigned brw_upload_cache( struct brw_cache *cache,
    }
 
    if (BRW_DEBUG & DEBUG_STATE)
-      printf("upload %s: %d bytes to pool buffer %p offset %x\n",
+      debug_printf("upload %s: %d bytes to pool buffer %p offset %x\n",
              cache->name, 
             data_size,
              (void*)cache->pool->buffer,
@@ -416,7 +416,7 @@ void brw_clear_all_caches( struct brw_context *brw )
    int i;
 
    if (BRW_DEBUG & DEBUG_STATE)
-      fprintf(stderr, "%s\n", __FUNCTION__);
+      debug_printf("%s\n", __FUNCTION__);
 
    for (i = 0; i < BRW_MAX_CACHE; i++)
       clear_cache(&brw->cache[i]);
index 7c67f0ee25db8c1853ffcf1ba45700070eef228e..f3174bfe0aede2256495295dd888cc3771546477 100644 (file)
@@ -58,7 +58,7 @@ boolean brw_pool_alloc( struct brw_mem_pool *pool,
    size = align(size, 4);
 
    if (pool->offset + fixup + size >= pool->size) {
-      printf("%s failed\n", __FUNCTION__);
+      debug_printf("%s failed\n", __FUNCTION__);
       assert(0);
       exit(0);
    }
@@ -74,7 +74,7 @@ static
 void brw_invalidate_pool( struct brw_mem_pool *pool )
 {
    if (BRW_DEBUG & DEBUG_STATE)
-      printf("\n\n\n %s \n\n\n", __FUNCTION__);
+      debug_printf("\n\n\n %s \n\n\n", __FUNCTION__);
 
    pool->offset = 0;
 
index b284526aa6e9ee31e70f973122348c8636002e96..101a4367b9091a3ff179ce425aeb9128a18e40f7 100644 (file)
@@ -120,18 +120,18 @@ static void recalculate_urb_fence( struct brw_context *brw )
             * entries and the values for minimum nr of entries
             * provided above.
             */
-           fprintf(stderr, "couldn't calculate URB layout!\n");
+           debug_printf("couldn't calculate URB layout!\n");
            exit(1);
         }
 
         if (BRW_DEBUG & (DEBUG_URB|DEBUG_FALLBACKS))
-           printf("URB CONSTRAINED\n");
+           debug_printf("URB CONSTRAINED\n");
       }
       else
         brw->urb.constrained = 0;
 
       if (BRW_DEBUG & DEBUG_URB)
-        printf("URB fence: %d ..VS.. %d ..GS.. %d ..CLP.. %d ..SF.. %d ..CS.. %d\n",
+        debug_printf("URB fence: %d ..VS.. %d ..GS.. %d ..CLP.. %d ..SF.. %d ..CS.. %d\n",
                      brw->urb.vs_start,
                      brw->urb.gs_start,
                      brw->urb.clip_start,
index b32c233dd22d725371d74ca4a166fc02282a9341..98915ba1016a101bd7e93d7c18fd36ce80060756 100644 (file)
@@ -1228,7 +1228,7 @@ static void process_instruction(struct brw_vs_compile *c,
    case TGSI_OPCODE_ENDSUB:
       break;
    default:
-      printf("Unsupport opcode %d in vertex shader\n", inst->Instruction.Opcode);
+      debug_printf("Unsupport opcode %d in vertex shader\n", inst->Instruction.Opcode);
       break;
    }
 
index 0ee0fbed5112985688126a1c299bd86428d536b2..539b17074441e1507d07af1cccdfb8c3e17788f8 100644 (file)
@@ -57,7 +57,7 @@ static void do_wm_prog( struct brw_context *brw,
    c->pixel_w = brw_null_reg();
 
 
-   fprintf(stderr, "XXXXXXXX FP\n");
+   debug_printf("XXXXXXXX FP\n");
    
    brw_wm_glsl_emit(c);
 
index f4b5c13c069897a0d940c2b25073587e1ee0c3ff..d95645d10853f676a069097bd29f43c0e22775fe 100644 (file)
@@ -982,7 +982,7 @@ static void brw_wm_emit_instruction( struct brw_wm_compile *c,
       break;
 
    default:
-      _mesa_printf("unsupported IR in fragment shader %d\n",
+      debug_printf("unsupported IR in fragment shader %d\n",
                   inst->Instruction.Opcode);
    }
 #if 0
index cfb430eb09ca626a1f24a741eaea038292abc607..de42ffc5b1e528c5489203144d94d32071e31c47 100644 (file)
@@ -71,7 +71,7 @@ static int intel_translate_shadow_compare_func(unsigned func)
        return COMPAREFUNC_NEVER;
    }
 
-   fprintf(stderr, "Unknown value in %s: %x\n", __FUNCTION__, func);
+   debug_printf("Unknown value in %s: %x\n", __FUNCTION__, func);
    return COMPAREFUNC_NEVER;
 }
 
index e939d9cd9b9f74fffe985817a27da89d5ece884e..30cd729c564d22b0a9b72c56d290afa136d04841 100644 (file)
 #ifndef P_COMPILER_H
 #define P_COMPILER_H
 
-#include <assert.h>
+
 #include <stdlib.h>
 #include <string.h>
-#include <stdio.h>
 
 
 #if defined(_WIN32) && !defined(__WIN32__)
index 9f60cdbb04dc589eb97e1895eece2a92809b47a6..c9ad3243158570abef010055bfab2d694d99a584 100644 (file)
 #ifndef PIPE_FORMAT_H
 #define PIPE_FORMAT_H
 
+#include <stdio.h> // for sprintf
+
 #include "p_compiler.h"
+#include "p_debug.h"
 
 /**
  * The PIPE_FORMAT is a 32-bit wide bitfield that encodes all the information
index 059528787d623a0e50df98e4af5e22fe9896c5f0..4780ed7818446372fcfa8e930cd8b801198eaeae 100644 (file)
@@ -381,10 +381,6 @@ static INLINE int align(int value, int alignment)
    return (value + alignment - 1) & ~(alignment - 1);
 }
 
-/* Convenient...
- */
-extern void _mesa_printf(const char *str, ...);
-
 
 /* util/p_util.c
  */
index 17551b3b50e000b350112859adbf4da21559dbc9..97beb5f72a9f39822a3482c3ed3d1c7961c71128 100644 (file)
 #define PB_BUFFER_H_
 
 
-#include <assert.h>
-#include <stdlib.h>
-
 #include "pipe/p_compiler.h"
+#include "pipe/p_debug.h"
 #include "pipe/p_state.h"
 #include "pipe/p_inlines.h"
 
index 4cf4222db9de8d013049c7bdaf8ec9b77c6f32ef..f4fc3f6d714efd6e2d709186e742b7aed3666b4e 100644 (file)
  */
 
 
-#include <assert.h>
-#include <stdlib.h>
-
 #include "linked_list.h"
 
 #include "p_compiler.h"
+#include "p_debug.h"
 #include "p_winsys.h"
 #include "p_thread.h"
 #include "p_util.h"
index 09082a539094ad888d2794897728f78ce5655091..c40b9c75e181432270b321ab25b7f29fc2c98ea5 100644 (file)
@@ -51,7 +51,7 @@
 #define PB_BUFFER_FENCED_H_
 
 
-#include <assert.h>
+#include "pipe/p_debug.h"
 
 
 struct pipe_winsys;
index 2151f1d691e3308c961ae80e419912bbb2253275..c1b7759874c6a3b3e555ff2223d812f7d240eba2 100644 (file)
@@ -34,9 +34,7 @@
  */
 
 
-#include <assert.h>
-#include <stdlib.h>
-
+#include "pipe/p_debug.h"
 #include "pipe/p_util.h"
 #include "pb_buffer.h"
 
index 3b341c64c280c07a30fe87d71e16620735f6707a..c535d3276c9068c3a789aa363d629cd123cd9458 100644 (file)
@@ -34,9 +34,7 @@
  */
 
 
-#include <assert.h>
-#include <stdlib.h>
-
+#include "p_debug.h"
 #include "p_util.h"
 
 #include "pb_buffer.h"
index b6af7cdedc2591d279af135d006e5e8d33e7d104..8b1b51c0e2873d89ba45da3d374e35b137e56675 100644 (file)
  */
 
 
-#include <assert.h>
-
 #include "linked_list.h"
 
 #include "p_defines.h"
+#include "p_debug.h"
 #include "p_thread.h"
 #include "p_util.h"
 #include "pb_buffer.h"
@@ -69,28 +68,28 @@ struct mem_block
 static void
 mmDumpMemInfo(const struct mem_block *heap)
 {
-   fprintf(stderr, "Memory heap %p:\n", (void *)heap);
+   debug_printf("Memory heap %p:\n", (void *)heap);
    if (heap == 0) {
-      fprintf(stderr, "  heap == 0\n");
+      debug_printf("  heap == 0\n");
    } else {
       const struct mem_block *p;
 
       for(p = heap->next; p != heap; p = p->next) {
-        fprintf(stderr, "  Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
+        debug_printf("  Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
                 p->free ? 'F':'.',
                 p->reserved ? 'R':'.');
       }
 
-      fprintf(stderr, "\nFree list:\n");
+      debug_printf("\nFree list:\n");
 
       for(p = heap->next_free; p != heap; p = p->next_free) {
-        fprintf(stderr, " FREE Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
+        debug_printf(" FREE Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
                 p->free ? 'F':'.',
                 p->reserved ? 'R':'.');
       }
 
    }
-   fprintf(stderr, "End of memory blocks\n");
+   debug_printf("End of memory blocks\n");
 }
 #endif
 
@@ -308,11 +307,11 @@ mmFreeMem(struct mem_block *b)
       return 0;
 
    if (b->free) {
-      fprintf(stderr, "block already free\n");
+      debug_printf("block already free\n");
       return -1;
    }
    if (b->reserved) {
-      fprintf(stderr, "block is reserved\n");
+      debug_printf("block is reserved\n");
       return -1;
    }
 
@@ -479,7 +478,7 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr,
    
    mm_buf->block = mmAllocMem(mm->heap, size, mm->align2, 0);
    if(!mm_buf->block) {
-      fprintf(stderr, "warning: heap full\n");
+      debug_printf("warning: heap full\n");
 #if 0
       mmDumpMemInfo(mm->heap);
 #endif
index f80c7e34c071ed2eae7e7e0c8e893162ac8c62ea..bcd4b3e2571d092b7864a85c5dce337834d3f09d 100644 (file)
  */
 
 
-#include <assert.h>
-#include <stdlib.h>
-
 #include "linked_list.h"
 
 #include "p_compiler.h"
+#include "p_debug.h"
 #include "p_thread.h"
 #include "p_defines.h"
 #include "p_util.h"
@@ -178,7 +176,7 @@ pool_bufmgr_create_buffer(struct pb_manager *mgr,
 
    if (pool->numFree == 0) {
       _glthread_UNLOCK_MUTEX(pool->mutex);
-      fprintf(stderr, "warning: out of fixed size buffer objects\n");
+      debug_printf("warning: out of fixed size buffer objects\n");
       return NULL;
    }
 
@@ -186,7 +184,7 @@ pool_bufmgr_create_buffer(struct pb_manager *mgr,
 
    if (item == &pool->free) {
       _glthread_UNLOCK_MUTEX(pool->mutex);
-      fprintf(stderr, "error: fixed size buffer pool corruption\n");
+      debug_printf("error: fixed size buffer pool corruption\n");
       return NULL;
    }
 
index b17801d13da6d82fdf982592344386f6cd2b2d98..7478b2336b6eac88d5dbd194ba7b2f23cbd5ff65 100644 (file)
@@ -251,9 +251,9 @@ static void print_vertex(const struct setup_stage *setup,
                          const struct vertex_header *v)
 {
    int i;
-   fprintf(stderr, "Vertex: (%p)\n", v);
+   debug_printf("Vertex: (%p)\n", v);
    for (i = 0; i < setup->quad.nr_attrs; i++) {
-      fprintf(stderr, "  %d: %f %f %f %f\n",  i, 
+      debug_printf("  %d: %f %f %f %f\n",  i, 
               v->data[i][0], v->data[i][1], v->data[i][2], v->data[i][3]);
    }
 }
@@ -267,7 +267,7 @@ static boolean setup_sort_vertices( struct setup_stage *setup,
    const struct vertex_header *v2 = prim->v[2];
 
 #if DEBUG_VERTS
-   fprintf(stderr, "Triangle:\n");
+   debug_printf("Triangle:\n");
    print_vertex(setup, v0);
    print_vertex(setup, v1);
    print_vertex(setup, v2);
@@ -345,7 +345,7 @@ static boolean setup_sort_vertices( struct setup_stage *setup,
 
       setup->oneoverarea = 1.0f / area;
       /*
-      _mesa_printf("%s one-over-area %f  area %f  det %f\n",
+      debug_printf("%s one-over-area %f  area %f  det %f\n",
                    __FUNCTION__, setup->oneoverarea, area, prim->det );
       */
    }
@@ -419,7 +419,7 @@ static void tri_linear_coeff( struct setup_stage *setup,
                    dady * (setup->vmin->data[0][1] - 0.5f)));
 
    /*
-   _mesa_printf("attr[%d].%c: %f dx:%f dy:%f\n",
+   debug_printf("attr[%d].%c: %f dx:%f dy:%f\n",
                slot, "xyzw"[i], 
                setup->coef[slot].a0[i],
                setup->coef[slot].dadx[i],
@@ -453,10 +453,10 @@ static void tri_persp_coeff( struct setup_stage *setup,
    float dady = b * setup->oneoverarea;
       
    /*
-   printf("tri persp %d,%d: %f %f %f\n", vertSlot, i,
-          setup->vmin->data[vertSlot][i],
-          setup->vmid->data[vertSlot][i],
-          setup->vmax->data[vertSlot][i]
+   debug_printf("tri persp %d,%d: %f %f %f\n", vertSlot, i,
+               setup->vmin->data[vertSlot][i],
+               setup->vmid->data[vertSlot][i],
+                       setup->vmax->data[vertSlot][i]
           );
    */
    assert(i <= 3);
@@ -619,7 +619,7 @@ static void subtriangle( struct setup_stage *setup,
    finish_y -= sy;
 
    /*
-   _mesa_printf("%s %d %d\n", __FUNCTION__, start_y, finish_y);  
+   debug_printf("%s %d %d\n", __FUNCTION__, start_y, finish_y);  
    */
 
    for (y = start_y; y < finish_y; y++) {
@@ -671,7 +671,7 @@ static void setup_tri( struct draw_stage *stage,
    struct setup_stage *setup = setup_stage( stage );
 
    /*
-   _mesa_printf("%s\n", __FUNCTION__ );
+   debug_printf("%s\n", __FUNCTION__ );
    */
 
    setup_sort_vertices( setup, prim );
@@ -1124,7 +1124,7 @@ setup_point(struct draw_stage *stage, struct prim_header *prim)
          int ix, iy;
 
          /*
-         printf("(%f, %f) -> X:%d..%d Y:%d..%d\n", x, y, xmin, xmax,ymin,ymax);
+         debug_printf("(%f, %f) -> X:%d..%d Y:%d..%d\n", x, y, xmin, xmax,ymin,ymax);
          */
          for (iy = iymin; iy <= iymax; iy += 2) {
             uint rowMask = 0xf;
index 90691c6065d1cbdb25f8618ee207588eae385c73..b5d7dfca1ca4b081f93d530342677327d6af2525 100644 (file)
@@ -223,13 +223,13 @@ shade_quad_llvm(struct quad_stage *qs,
    inputs[2][0][1] = fy + 1.0f;
    inputs[3][0][1] = fy + 1.0f;
 #if DLLVM
-   printf("MASK = %d\n", quad->mask);
+   debug_printf("MASK = %d\n", quad->mask);
 #endif
    gallivm_prog_inputs_interpolate(llvm, inputs, quad->coef);
 #if DLLVM
    for (int i = 0; i < 4; ++i) {
       for (int j = 0; j < 2; ++j) {
-         printf("IN(%d,%d) [%f %f %f %f]\n", i, j, 
+         debug_printf("IN(%d,%d) [%f %f %f %f]\n", i, j, 
                 inputs[i][j][0], inputs[i][j][1], inputs[i][j][2], inputs[i][j][3]);
       }
    }
@@ -240,7 +240,7 @@ shade_quad_llvm(struct quad_stage *qs,
                                    softpipe->mapped_constants[PIPE_SHADER_FRAGMENT],
                                    qss->samplers);
 #if DLLVM
-   printf("OUT LLVM = 1[%f %f %f %f], 2[%f %f %f %f]\n",
+   debug_printf("OUT LLVM = 1[%f %f %f %f], 2[%f %f %f %f]\n",
           dests[0][0][0], dests[0][0][1], dests[0][0][2], dests[0][0][3], 
           dests[0][1][0], dests[0][1][1], dests[0][1][2], dests[0][1][3]);
 #endif
@@ -260,7 +260,7 @@ shade_quad_llvm(struct quad_stage *qs,
    }
 #if DLLVM
    for (int i = 0; i < QUAD_SIZE; ++i) {
-      printf("QLLVM%d(%d) [%f, %f, %f, %f]\n", i, qss->colorOutSlot,
+      debug_printf("QLLVM%d(%d) [%f, %f, %f, %f]\n", i, qss->colorOutSlot,
              quad->outputs.color[0][i],
              quad->outputs.color[1][i],
              quad->outputs.color[2][i],
@@ -284,7 +284,7 @@ shade_quad_llvm(struct quad_stage *qs,
       }
    }
 #if DLLVM
-   printf("D [%f, %f, %f, %f] mask = %d\n",
+   debug_printf("D [%f, %f, %f, %f] mask = %d\n",
              quad->outputs.depth[0],
              quad->outputs.depth[1],
              quad->outputs.depth[2],
index ccf367a5e4f42eb5d24cd096c8e758d40b375622..1597361b82f5b3359b6a8cce8b26a63b6d790c2d 100644 (file)
@@ -341,7 +341,7 @@ sp_tile_cache_flush_clear(struct pipe_context *pipe,
       }
    }
 #if 0
-   printf("num cleared: %u\n", numCleared);
+   debug_printf("num cleared: %u\n", numCleared);
 #endif
 }
 
@@ -384,7 +384,7 @@ sp_flush_tile_cache(struct softpipe_context *softpipe,
 #endif
 
 #if 0
-   printf("flushed tiles in use: %d\n", inuse);
+   debug_printf("flushed tiles in use: %d\n", inuse);
 #endif
 }
 
index dcc39362a9bf99c50020bab3a535b8ae46b24dcf..463ff0d9dab77685aadc2747b26e3f1c4c9824aa 100644 (file)
@@ -143,7 +143,7 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach )
 
    k = tgsi_parse_init( &parse, mach->Tokens );
    if (k != TGSI_PARSE_OK) {
-      fprintf(stderr, "Problem parsing!\n");
+      debug_printf("Problem parsing!\n");
       return;
    }
 
@@ -249,7 +249,7 @@ tgsi_exec_machine_init(
 
    k = tgsi_parse_init (&parse, mach->Tokens);
    if (k != TGSI_PARSE_OK) {
-      fprintf( stderr, "Problem parsing!\n" );
+      debug_printf( "Problem parsing!\n" );
       return;
    }
 
@@ -1236,7 +1236,7 @@ exec_tex(struct tgsi_exec_machine *mach,
    uint chan_index;
    float lodBias;
 
-   /*   printf("Sampler %u unit %u\n", sampler, unit); */
+   /*   debug_printf("Sampler %u unit %u\n", sampler, unit); */
 
    switch (inst->InstructionExtTexture.Texture) {
    case TGSI_TEXTURE_1D:
index df0c69830137f8ef76a0960bc08b15ec0984f63f..f2180082f1513c6d6065b446960a37336f325e14 100755 (executable)
@@ -48,28 +48,28 @@ _print_reg(
    case file_REG32:
       switch( reg.idx ) {
       case reg_AX:
-         printf( "EAX" );
+         debug_printf( "EAX" );
          break;
       case reg_CX:
-         printf( "ECX" );
+         debug_printf( "ECX" );
          break;
       case reg_DX:
-         printf( "EDX" );
+         debug_printf( "EDX" );
          break;
       case reg_BX:
-         printf( "EBX" );
+         debug_printf( "EBX" );
          break;
       case reg_SP:
-         printf( "ESP" );
+         debug_printf( "ESP" );
          break;
       case reg_BP:
-         printf( "EBP" );
+         debug_printf( "EBP" );
          break;
       case reg_SI:
-         printf( "ESI" );
+         debug_printf( "ESI" );
          break;
       case reg_DI:
-         printf( "EDI" );
+         debug_printf( "EDI" );
          break;
       }
       break;
@@ -77,7 +77,7 @@ _print_reg(
       assert( 0 );
       break;
    case file_XMM:
-      printf( "XMM%u", reg.idx );
+      debug_printf( "XMM%u", reg.idx );
       break;
    case file_x87:
       assert( 0 );
@@ -92,35 +92,35 @@ _fill(
    unsigned count = 10 - strlen( op );
 
    while( count-- ) {
-      printf( " " );
+      debug_printf( " " );
    }
 }
 
-#define DUMP_START() printf( "\nsse-dump start ----------------" )
-#define DUMP_END() printf( "\nsse-dump end ----------------\n" )
-#define DUMP( OP ) printf( "\n%s", OP )
+#define DUMP_START() debug_printf( "\nsse-dump start ----------------" )
+#define DUMP_END() debug_printf( "\nsse-dump end ----------------\n" )
+#define DUMP( OP ) debug_printf( "\n%s", OP )
 #define DUMP_I( OP, I ) do {\
-   printf( "\n%s", OP );\
+   debug_printf( "\n%s", OP );\
    _fill( OP );\
-   printf( "%u", I ); } while( 0 )
+   debug_printf( "%u", I ); } while( 0 )
 #define DUMP_R( OP, R0 ) do {\
-   printf( "\n%s", OP );\
+   debug_printf( "\n%s", OP );\
    _fill( OP );\
    _print_reg( R0 ); } while( 0 )
 #define DUMP_RR( OP, R0, R1 ) do {\
-   printf( "\n%s", OP );\
+   debug_printf( "\n%s", OP );\
    _fill( OP );\
    _print_reg( R0 );\
-   printf( ", " );\
+   debug_printf( ", " );\
    _print_reg( R1 ); } while( 0 )
 #define DUMP_RRI( OP, R0, R1, I ) do {\
-   printf( "\n%s", OP );\
+   debug_printf( "\n%s", OP );\
    _fill( OP );\
    _print_reg( R0 );\
-   printf( ", " );\
+   debug_printf( ", " );\
    _print_reg( R1 );\
-   printf( ", " );\
-   printf( "%u", I ); } while( 0 )
+   debug_printf( ", " );\
+   debug_printf( "%u", I ); } while( 0 )
 
 #else
 
index 67f7d2c2c28b454e791d12b7a9c983acb09ff9ae..a00ff1c2a5f81c04d93ca2f92016599f39e03551 100644 (file)
@@ -1,3 +1,4 @@
+#include "pipe/p_debug.h"
 #include "pipe/p_util.h"
 #include "pipe/p_shader_tokens.h"
 #include "tgsi_build.h"
index cdbc0dbc9cab4fc370d54fad4c9bcaec4b43ccd2..b5c54847e0bef7dbec96cdbdc36bbd223baffab6 100644 (file)
@@ -25,6 +25,9 @@
  * 
  **************************************************************************/
 
+#include <stdio.h> 
+
+#include "pipe/p_debug.h"
 #include "pipe/p_util.h"
 #include "pipe/p_shader_tokens.h"
 #include "tgsi_dump.h"
index f0f8d44ac2060a6ccea0439a200fc3ae7d989e6d..bf6b89ce56434b496d22067006b06436897c9d70 100644 (file)
@@ -25,6 +25,7 @@
  * 
  **************************************************************************/
 
+#include "pipe/p_debug.h"
 #include "pipe/p_util.h"
 #include "pipe/p_shader_tokens.h"
 #include "tgsi_parse.h"
index 1e76b0f133aaf0f01e8261d49095e421b19c6b92..4cdd89182ad21da9445b0034a82e82cda3835cd1 100644 (file)
@@ -1,3 +1,4 @@
+#include "pipe/p_debug.h"
 #include "pipe/p_util.h"
 #include "pipe/p_shader_tokens.h"
 #include "tgsi_parse.h"