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 <gert.wollny@collabora.com>
Reviewed-by: John Bates <jbates@chromium.org>
macos/master
Gert Wollny 3 years ago
parent 2a5fb800c6
commit 41838038c4
  1. 7
      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) static void vrend_shader_dump(struct vrend_shader *shader)
{ {
const char *prefix = pipe_shader_to_prefix(shader->sel->type); 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); vrend_printf("%s: %d GLSL:\n", prefix, shader->id);
strarray_dump_with_line_numbers(&shader->glsl_strings); strarray_dump_with_line_numbers(&shader->glsl_strings);
vrend_printf("\n"); vrend_printf("\n");
@ -3811,10 +3814,10 @@ int vrend_create_shader(struct vrend_context *ctx,
ret = EINVAL; ret = EINVAL;
goto error; goto error;
} else { } else {
if (!vrend_debug(ctx, dbg_shader_tgsi)) { #ifdef NDEBUG
free(sel->tmp_buf); free(sel->tmp_buf);
sel->tmp_buf = NULL; sel->tmp_buf = NULL;
} #endif
} }
free(tokens); free(tokens);
sub_ctx->long_shader_in_progress_handle[type] = 0; sub_ctx->long_shader_in_progress_handle[type] = 0;

Loading…
Cancel
Save