[Mesa-dev] [PATCH] i965: Fix "vertex" vs. "geometry" and "VS" vs. "GS" in debug output.
Kenneth Graunke
kenneth at whitecape.org
Tue Jan 13 14:59:33 PST 2015
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 at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_vec4.cpp | 2 +-
src/mesa/drivers/dri/i965/brw_vec4.h | 6 +++++-
src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 21 ++++++++++++++-------
src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 2 +-
4 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 0089bd0..33d5fdc 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -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);
}
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 75ecaf1..980544d 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -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;
};
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
index f900bf7..fd37a05 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
@@ -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);
}
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
index 089f479..7a0ea3c 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
@@ -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);
}
--
2.2.1
More information about the mesa-dev
mailing list