i965: Fix "vertex" vs. "geometry" and "VS" vs. "GS" in debug output.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 13 Jan 2015 22:56:54 +0000 (14:56 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 15 Jan 2015 00:55:43 +0000 (16:55 -0800)
We were happily printing "Native code for unnamed vertex shader" and
"VS vec4" program for geometry shaders in our INTEL_DEBUG=gs output,
as well as the KHR_debug output used by shader-db.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_vec4.cpp
src/mesa/drivers/dri/i965/brw_vec4.h
src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp

index 0089bd0827c6ac42b402fa6f0e8d36102825eda2..33d5fdc17fa22797fb6b5b6f01488c18b2c10398 100644 (file)
@@ -1925,7 +1925,7 @@ brw_vs_emit(struct brw_context *brw,
       }
 
       vec4_generator g(brw, prog, &c->vp->program.Base, &prog_data->base,
-                       mem_ctx, INTEL_DEBUG & DEBUG_VS);
+                       mem_ctx, INTEL_DEBUG & DEBUG_VS, "vertex", "VS");
       assembly = g.generate_assembly(v.cfg, final_assembly_size);
    }
 
index 75ecaf1a37def5f09aacf3ba40bbd6b0223a91dc..980544d3dbeaa1b1c4be5dc8efc39329a4a32f99 100644 (file)
@@ -591,7 +591,9 @@ public:
                   struct gl_program *prog,
                   struct brw_vue_prog_data *prog_data,
                   void *mem_ctx,
-                  bool debug_flag);
+                  bool debug_flag,
+                  const char *stage_name,
+                  const char *stage_abbrev);
    ~vec4_generator();
 
    const unsigned *generate_assembly(const cfg_t *cfg, unsigned *asm_size);
@@ -684,6 +686,8 @@ private:
    struct brw_vue_prog_data *prog_data;
 
    void *mem_ctx;
+   const char *stage_name;
+   const char *stage_abbrev;
    const bool debug_flag;
 };
 
index f900bf7f300c58a44c901f7f2bce404dbf508180..fd37a0587d95acf796a430891eb4a38c7b55be39 100644 (file)
@@ -20,6 +20,7 @@
  * IN THE SOFTWARE.
  */
 
+#include <ctype.h>
 #include "brw_vec4.h"
 #include "brw_cfg.h"
 
@@ -138,9 +139,12 @@ vec4_generator::vec4_generator(struct brw_context *brw,
                                struct gl_program *prog,
                                struct brw_vue_prog_data *prog_data,
                                void *mem_ctx,
-                               bool debug_flag)
+                               bool debug_flag,
+                               const char *stage_name,
+                               const char *stage_abbrev)
    : brw(brw), shader_prog(shader_prog), prog(prog), prog_data(prog_data),
-     mem_ctx(mem_ctx), debug_flag(debug_flag)
+     mem_ctx(mem_ctx), stage_name(stage_name), stage_abbrev(stage_abbrev),
+     debug_flag(debug_flag)
 {
    p = rzalloc(mem_ctx, struct brw_compile);
    brw_init_compile(brw, p, mem_ctx);
@@ -1587,14 +1591,16 @@ vec4_generator::generate_code(const cfg_t *cfg)
 
    if (unlikely(debug_flag)) {
       if (shader_prog) {
-         fprintf(stderr, "Native code for %s vertex shader %d:\n",
+         fprintf(stderr, "Native code for %s %s shader %d:\n",
                  shader_prog->Label ? shader_prog->Label : "unnamed",
-                 shader_prog->Name);
+                 stage_name, shader_prog->Name);
       } else {
-         fprintf(stderr, "Native code for vertex program %d:\n", prog->Id);
+         fprintf(stderr, "Native code for %s program %d:\n", prog->Id,
+                 stage_name);
       }
-      fprintf(stderr, "vec4 shader: %d instructions. %d loops. Compacted %d to %d"
+      fprintf(stderr, "%s vec4 shader: %d instructions. %d loops. Compacted %d to %d"
                       " bytes (%.0f%%)\n",
+              stage_abbrev,
               before_size / 16, loop_count, before_size, after_size,
               100.0f * (before_size - after_size) / before_size);
 
@@ -1607,8 +1613,9 @@ vec4_generator::generate_code(const cfg_t *cfg)
                   MESA_DEBUG_SOURCE_SHADER_COMPILER,
                   MESA_DEBUG_TYPE_OTHER,
                   MESA_DEBUG_SEVERITY_NOTIFICATION,
-                  "VS vec4 shader: %d inst, %d loops, "
+                  "%s vec4 shader: %d inst, %d loops, "
                   "compacted %d to %d bytes.\n",
+                  stage_abbrev,
                   before_size / 16, loop_count,
                   before_size, after_size);
 }
index 089f479cedec6c7ca7340df392478aa5789339ed..7a0ea3cdfdf8050889f4307d75fc6cbcf26a857c 100644 (file)
@@ -617,7 +617,7 @@ generate_assembly(struct brw_context *brw,
                   unsigned *final_assembly_size)
 {
    vec4_generator g(brw, shader_prog, prog, prog_data, mem_ctx,
-                    INTEL_DEBUG & DEBUG_GS);
+                    INTEL_DEBUG & DEBUG_GS, "geometry", "GS");
    return g.generate_assembly(cfg, final_assembly_size);
 }