ir3_shader_disasm(v, bin);
}
- if (fd_mesa_debug & FD_DBG_SHADERDB) {
- /* print generic shader info: */
- fprintf(stderr, "SHADER-DB: %s prog %d/%d: %u instructions, %u dwords\n",
- ir3_shader_stage(v->shader),
- v->shader->id, v->id,
- v->info.instrs_count,
- v->info.sizedwords);
- fprintf(stderr, "SHADER-DB: %s prog %d/%d: %u half, %u full\n",
- ir3_shader_stage(v->shader),
- v->shader->id, v->id,
- v->info.max_half_reg + 1,
- v->info.max_reg + 1);
- fprintf(stderr, "SHADER-DB: %s prog %d/%d: %u const, %u constlen\n",
- ir3_shader_stage(v->shader),
- v->shader->id, v->id,
- v->info.max_const + 1,
- v->constlen);
- }
-
free(bin);
/* no need to keep the ir around beyond this point: */
v->ir = NULL;
}
+static void
+dump_shader_info(struct ir3_shader_variant *v, struct pipe_debug_callback *debug)
+{
+ if (!unlikely(fd_mesa_debug & FD_DBG_SHADERDB))
+ return;
+
+ pipe_debug_message(debug, SHADER_INFO, "\n"
+ "SHADER-DB: %s prog %d/%d: %u instructions, %u dwords\n"
+ "SHADER-DB: %s prog %d/%d: %u half, %u full\n"
+ "SHADER-DB: %s prog %d/%d: %u const, %u constlen\n",
+ ir3_shader_stage(v->shader),
+ v->shader->id, v->id,
+ v->info.instrs_count,
+ v->info.sizedwords,
+ ir3_shader_stage(v->shader),
+ v->shader->id, v->id,
+ v->info.max_half_reg + 1,
+ v->info.max_reg + 1,
+ ir3_shader_stage(v->shader),
+ v->shader->id, v->id,
+ v->info.max_const + 1,
+ v->constlen);
+}
+
static struct ir3_shader_variant *
create_variant(struct ir3_shader *shader, struct ir3_shader_key key)
{
}
struct ir3_shader_variant *
-ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key)
+ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key,
+ struct pipe_debug_callback *debug)
{
struct ir3_shader_variant *v;
if (v) {
v->next = shader->variants;
shader->variants = v;
+ dump_shader_info(v, debug);
}
return v;
struct ir3_shader *
ir3_shader_create(struct ir3_compiler *compiler,
- const struct pipe_shader_state *cso,
- enum shader_t type)
+ const struct pipe_shader_state *cso, enum shader_t type,
+ struct pipe_debug_callback *debug)
{
struct ir3_shader *shader = CALLOC_STRUCT(ir3_shader);
shader->compiler = compiler;
* actually compiled)
*/
static struct ir3_shader_key key = {0};
- ir3_shader_variant(shader, key);
+ ir3_shader_variant(shader, key, debug);
}
return shader;
}
void * ir3_shader_assemble(struct ir3_shader_variant *v, uint32_t gpu_id);
struct ir3_shader * ir3_shader_create(struct ir3_compiler *compiler,
- const struct pipe_shader_state *cso, enum shader_t type);
+ const struct pipe_shader_state *cso, enum shader_t type,
+ struct pipe_debug_callback *debug);
void ir3_shader_destroy(struct ir3_shader *shader);
struct ir3_shader_variant * ir3_shader_variant(struct ir3_shader *shader,
- struct ir3_shader_key key);
+ struct ir3_shader_key key, struct pipe_debug_callback *debug);
void ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin);
struct fd_ringbuffer;