i965: Print input/output VUE maps on INTEL_DEBUG=vs, gs.

I've been carrying around a patch to do this for the last few months,
and it's been exceedingly useful for debugging GS and tessellation
problems.  I've caught lots of bugs by inspecting the interface
expectations of two adjacent stages.

It's not that much spam, so I figure we may as well just print it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Kenneth Graunke
2015-11-10 00:48:33 -08:00
parent f88c175a29
commit a4ba476c30
4 changed files with 40 additions and 1 deletions
+2
View File
@@ -458,6 +458,8 @@ struct brw_vue_map {
int num_slots;
};
void brw_print_vue_map(FILE *fp, const struct brw_vue_map *vue_map);
/**
* Convert a VUE slot number into a byte offset within the VUE.
*/
@@ -812,6 +812,12 @@ brw_compile_gs(const struct brw_compiler *compiler, void *log_data,
/* Now that prog_data setup is done, we are ready to actually compile the
* program.
*/
if (unlikely(INTEL_DEBUG & DEBUG_GS)) {
fprintf(stderr, "GS Input ");
brw_print_vue_map(stderr, &c.input_vue_map);
fprintf(stderr, "GS Output ");
brw_print_vue_map(stderr, &prog_data->base.vue_map);
}
if (compiler->scalar_gs) {
/* TODO: Support instanced GS. We have basically no tests... */
+5 -1
View File
@@ -159,9 +159,13 @@ brw_codegen_vs_prog(struct brw_context *brw,
start_time = get_time();
}
if (unlikely(INTEL_DEBUG & DEBUG_VS))
if (unlikely(INTEL_DEBUG & DEBUG_VS)) {
brw_dump_ir("vertex", prog, vs ? &vs->base : NULL, &vp->program.Base);
fprintf(stderr, "VS Output ");
brw_print_vue_map(stderr, &prog_data.base.vue_map);
}
int st_index = -1;
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
st_index = brw_get_shader_time_index(brw, prog, &vp->program.Base, ST_VS);
+27
View File
@@ -178,3 +178,30 @@ brw_compute_vue_map(const struct brw_device_info *devinfo,
vue_map->num_slots = separate ? slot + 1 : slot;
}
static const char *
varying_name(brw_varying_slot slot)
{
if (slot < VARYING_SLOT_MAX)
return gl_varying_slot_name(slot);
static const char *brw_names[] = {
[BRW_VARYING_SLOT_NDC - VARYING_SLOT_MAX] = "BRW_VARYING_SLOT_NDC",
[BRW_VARYING_SLOT_PAD - VARYING_SLOT_MAX] = "BRW_VARYING_SLOT_PAD",
[BRW_VARYING_SLOT_PNTC - VARYING_SLOT_MAX] = "BRW_VARYING_SLOT_PNTC",
};
return brw_names[slot - VARYING_SLOT_MAX];
}
void
brw_print_vue_map(FILE *fp, const struct brw_vue_map *vue_map)
{
fprintf(fp, "VUE map (%d slots, %s)\n",
vue_map->num_slots, vue_map->separate ? "SSO" : "non-SSO");
for (int i = 0; i < vue_map->num_slots; i++) {
fprintf(fp, " [%d] %s\n", i,
varying_name(vue_map->slot_to_varying[i]));
}
fprintf(fp, "\n");
}