i965: Settle on printing our program debug to stdout.
authorEric Anholt <eric@anholt.net>
Thu, 5 Aug 2010 02:55:52 +0000 (19:55 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 5 Aug 2010 03:52:33 +0000 (20:52 -0700)
Mixing stderr (_mesa_print_program, _mesa_print_instruction,
_mesa_print_alu) with stdout means that when writing both to a file,
there isn't a consistent ordering between the two.

src/mesa/drivers/dri/i965/brw_vs.c
src/mesa/drivers/dri/i965/brw_vs_emit.c
src/mesa/drivers/dri/i965/brw_wm_fp.c
src/mesa/program/prog_print.c
src/mesa/program/prog_print.h

index 9a832af9a9702d739ab729c43d0f428fc118e032..9f90e1e5e5c818182ec326d15737a4972f642f01 100644 (file)
@@ -75,10 +75,10 @@ static void do_vs_prog( struct brw_context *brw,
         c.prog_data.outputs_written |= BITFIELD64_BIT(VERT_RESULT_TEX0 + i);
    }
 
-   if (0)
-      _mesa_print_program(&c.vp->program.Base);
-
-
+   if (0) {
+      _mesa_fprint_program_opt(stdout, &c.vp->program.Base, PROG_PRINT_DEBUG,
+                              GL_TRUE);
+   }
 
    /* Emit GEN4 code.
     */
index c1d6525e9b7f8944f43d7b6464d97041217d65d5..d2bd2c7f797b8019d219e9f180adf6fbc7046d60 100644 (file)
@@ -1564,7 +1564,8 @@ void brw_vs_emit(struct brw_vs_compile *c )
 
    if (INTEL_DEBUG & DEBUG_VS) {
       printf("vs-mesa:\n");
-      _mesa_print_program(&c->vp->program.Base); 
+      _mesa_fprint_program_opt(stdout, &c->vp->program.Base, PROG_PRINT_DEBUG,
+                              GL_TRUE);
       printf("\n");
    }
 
index df9e54c6b4e9d878c3490c9313168374c0d0ceaf..3870bf10fcb75fca0abc7247da92645effcf0c1a 100644 (file)
@@ -1037,13 +1037,12 @@ static void print_insns( const struct prog_instruction *insn,
    for (i = 0; i < nr; i++, insn++) {
       printf("%3d: ", i);
       if (insn->Opcode < MAX_OPCODE)
-        _mesa_print_instruction(insn);
+        _mesa_fprint_instruction_opt(stdout, insn, 0, PROG_PRINT_DEBUG, NULL);
       else if (insn->Opcode < MAX_WM_OPCODE) {
         GLuint idx = insn->Opcode - MAX_OPCODE;
 
-        _mesa_print_alu_instruction(insn,
-                                    wm_opcode_strings[idx],
-                                    3);
+        _mesa_fprint_alu_instruction(stdout, insn, wm_opcode_strings[idx],
+                                     3, PROG_PRINT_DEBUG, NULL);
       }
       else 
         printf("965 Opcode %d\n", insn->Opcode);
@@ -1062,7 +1061,8 @@ void brw_wm_pass_fp( struct brw_wm_compile *c )
 
    if (INTEL_DEBUG & DEBUG_WM) {
       printf("pre-fp:\n");
-      _mesa_print_program(&fp->program.Base); 
+      _mesa_fprint_program_opt(stdout, &fp->program.Base, PROG_PRINT_DEBUG,
+                              GL_TRUE);
       printf("\n");
    }
 
index b66d709d50fece29f7bca79fd915fca6f70c23ed..1ce1bf2f4ed3cae67ac74c917d172ebb070b2210 100644 (file)
@@ -540,12 +540,12 @@ fprint_comment(FILE *f, const struct prog_instruction *inst)
 }
 
 
-static void
-fprint_alu_instruction(FILE *f,
-                       const struct prog_instruction *inst,
-                       const char *opcode_string, GLuint numRegs,
-                       gl_prog_print_mode mode,
-                       const struct gl_program *prog)
+void
+_mesa_fprint_alu_instruction(FILE *f,
+                            const struct prog_instruction *inst,
+                            const char *opcode_string, GLuint numRegs,
+                            gl_prog_print_mode mode,
+                            const struct gl_program *prog)
 {
    GLuint j;
 
@@ -582,8 +582,8 @@ void
 _mesa_print_alu_instruction(const struct prog_instruction *inst,
                             const char *opcode_string, GLuint numRegs)
 {
-   fprint_alu_instruction(stderr, inst, opcode_string,
-                          numRegs, PROG_PRINT_DEBUG, NULL);
+   _mesa_fprint_alu_instruction(stderr, inst, opcode_string,
+                               numRegs, PROG_PRINT_DEBUG, NULL);
 }
 
 
@@ -791,16 +791,16 @@ _mesa_fprint_instruction_opt(FILE *f,
    default:
       if (inst->Opcode < MAX_OPCODE) {
          /* typical alu instruction */
-         fprint_alu_instruction(f, inst,
-                                _mesa_opcode_string(inst->Opcode),
-                                _mesa_num_inst_src_regs(inst->Opcode),
-                                mode, prog);
+         _mesa_fprint_alu_instruction(f, inst,
+                                     _mesa_opcode_string(inst->Opcode),
+                                     _mesa_num_inst_src_regs(inst->Opcode),
+                                     mode, prog);
       }
       else {
-         fprint_alu_instruction(f, inst,
-                                _mesa_opcode_string(inst->Opcode),
-                                3/*_mesa_num_inst_src_regs(inst->Opcode)*/,
-                                mode, prog);
+         _mesa_fprint_alu_instruction(f, inst,
+                                     _mesa_opcode_string(inst->Opcode),
+                                     3/*_mesa_num_inst_src_regs(inst->Opcode)*/,
+                                     mode, prog);
       }
       break;
    }
index 9ab745601693572aafd601f2f8357d7ad63d3b06..4ffd5ab96c6f21cdd3f9040c68bdfdf4e60deabd 100644 (file)
@@ -55,6 +55,13 @@ _mesa_writemask_string(GLuint writeMask);
 extern void
 _mesa_print_swizzle(GLuint swizzle);
 
+extern void
+_mesa_fprint_alu_instruction(FILE *f,
+                            const struct prog_instruction *inst,
+                            const char *opcode_string, GLuint numRegs,
+                            gl_prog_print_mode mode,
+                            const struct gl_program *prog);
+
 extern void
 _mesa_print_alu_instruction(const struct prog_instruction *inst,
                             const char *opcode_string, GLuint numRegs);