From ec4bcbd26d450fd91fbc25d918234e866f8d7906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Pi=C3=B1eiro?= Date: Wed, 14 Jan 2026 11:31:30 +0100 Subject: [PATCH] pan/bi: report stats only if the shaders got compiled There are some situations where we don't get a binary. In those cases it is not relevant to report the statistics. This was detected while using shader-db, with a shader that has a xfb vertex shader that was not writing to gl_Position. It that case IDVS_POSITION binary was zero, so later compiling IDVS_VARYING was skipped. Due the skip, the pan_stat structure was not initialized, so the debug used the wrong isa, that used different measurements. This lead to shader-db report tool failing, due having a mix-up of measurements. Although an alternative would be to try to ensure that the structure is always initialized, seems just more natural to just not report on shaders with empty binaries (as the stats would be zero for all measurements). Reviewed-by: Christoph Pillmayer Part-of: --- src/gallium/drivers/panfrost/pan_shader.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_shader.c b/src/gallium/drivers/panfrost/pan_shader.c index 389ce021cb8..48702137544 100644 --- a/src/gallium/drivers/panfrost/pan_shader.c +++ b/src/gallium/drivers/panfrost/pan_shader.c @@ -234,14 +234,17 @@ panfrost_shader_compile(struct panfrost_screen *screen, const nir_shader *ir, screen->vtbl.compile_shader(s, &inputs, &out->binary, &out->info); - if (s->info.stage == MESA_SHADER_VERTEX && out->info.vs.idvs) { - pan_stats_util_debug(dbg, "MESA_SHADER_POSITION", - &out->info.stats); - pan_stats_util_debug(dbg, "MESA_SHADER_VERTEX", - &out->info.stats_idvs_varying); - } else { - pan_stats_util_debug(dbg, mesa_shader_stage_name(s->info.stage), - &out->info.stats); + /* Report stats only if we really got the shader compiled */ + if (out->binary.size > 0) { + if (s->info.stage == MESA_SHADER_VERTEX && out->info.vs.idvs) { + pan_stats_util_debug(dbg, "MESA_SHADER_POSITION", + &out->info.stats); + pan_stats_util_debug(dbg, "MESA_SHADER_VERTEX", + &out->info.stats_idvs_varying); + } else { + pan_stats_util_debug(dbg, mesa_shader_stage_name(s->info.stage), + &out->info.stats); + } } assert(req_local_mem >= out->info.wls_size);