From 41838038c4793e340b21b65d02efe9edaad83877 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Mon, 25 Oct 2021 11:15:11 +0200 Subject: [PATCH] vrend: Keep the TGSI string on debug builds and dump it on shader errors This should help debugging shader compilation errors. Signed-off-by: Gert Wollny Reviewed-by: John Bates --- src/vrend_renderer.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 05448c3..ebafbb1 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -1146,6 +1146,9 @@ vrend_so_target_reference(struct vrend_so_target **ptr, struct vrend_so_target * static void vrend_shader_dump(struct vrend_shader *shader) { const char *prefix = pipe_shader_to_prefix(shader->sel->type); + if (shader->sel->tmp_buf) + vrend_printf("%s: %d TGSI:\n%s\n", prefix, shader->id, shader->sel->tmp_buf); + vrend_printf("%s: %d GLSL:\n", prefix, shader->id); strarray_dump_with_line_numbers(&shader->glsl_strings); vrend_printf("\n"); @@ -3811,10 +3814,10 @@ int vrend_create_shader(struct vrend_context *ctx, ret = EINVAL; goto error; } else { - if (!vrend_debug(ctx, dbg_shader_tgsi)) { +#ifdef NDEBUG free(sel->tmp_buf); sel->tmp_buf = NULL; - } +#endif } free(tokens); sub_ctx->long_shader_in_progress_handle[type] = 0;