mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 19:30:11 +01:00
aco: make validate_ir() output usable in tests
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3151>
This commit is contained in:
parent
54292e99c7
commit
cf22eabc68
3 changed files with 16 additions and 6 deletions
|
|
@ -1922,6 +1922,8 @@ public:
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -37,16 +37,19 @@ static void aco_log(Program *program, enum radv_compiler_debug_level level,
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,6 +85,11 @@ void create_program(enum chip_class chip_class, Stage stage, unsigned wave_size,
|
|||
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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue