unsigned next_uniform_if_depth = 0;
struct {
+ FILE *output = stderr;
+ bool shorten_messages = false;
void (*func)(void *private_data,
enum radv_compiler_debug_level level,
const char *message);
{
char *msg;
- msg = ralloc_strdup(NULL, prefix);
-
- ralloc_asprintf_append(&msg, " In file %s:%u\n", file, line);
- ralloc_asprintf_append(&msg, " ");
- ralloc_vasprintf_append(&msg, fmt, args);
+ if (program->debug.shorten_messages) {
+ msg = ralloc_vasprintf(NULL, fmt, args);
+ } else {
+ msg = ralloc_strdup(NULL, prefix);
+ ralloc_asprintf_append(&msg, " In file %s:%u\n", file, line);
+ ralloc_asprintf_append(&msg, " ");
+ ralloc_vasprintf_append(&msg, fmt, args);
+ }
if (program->debug.func)
program->debug.func(program->debug.private_data, level, msg);
- fprintf(stderr, "%s\n", msg);
+ fprintf(program->debug.output, "%s\n", msg);
ralloc_free(msg);
}
program->debug.func = nullptr;
program->debug.private_data = nullptr;
+ program->debug.output = output;
+ program->debug.shorten_messages = true;
+ program->debug.func = nullptr;
+ program->debug.private_data = nullptr;
+
Block *block = program->create_and_insert_block();
block->kind = block_kind_top_level;