radv,aco: report ACO errors/warnings back via VK_EXT_debug_report
[mesa.git] / src / amd / compiler / aco_interface.cpp
index a05df1e7959ba9d380d38986470d8a96fcc6f57b..96a968d376a2dfdeb5bbb1d9fb5b59d4779892ef 100644 (file)
@@ -25,8 +25,6 @@
 #include "aco_ir.h"
 #include "vulkan/radv_shader.h"
 #include "vulkan/radv_shader_args.h"
-#include "c11/threads.h"
-#include "util/debug.h"
 
 #include <iostream>
 #include <sstream>
@@ -47,10 +45,10 @@ static radv_compiler_statistic_info statistic_infos[] = {
 
 static void validate(aco::Program *program)
 {
-   if (!(aco::debug_flags & aco::DEBUG_VALIDATE))
+   if (!(aco::debug_flags & aco::DEBUG_VALIDATE_IR))
       return;
 
-   bool is_valid = aco::validate(program, stderr);
+   bool is_valid = aco::validate_ir(program);
    assert(is_valid);
 }
 
@@ -68,6 +66,9 @@ void aco_compile_shader(unsigned shader_count,
    if (program->collect_statistics)
       memset(program->statistics, 0, sizeof(program->statistics));
 
+   program->debug.func = args->options->debug.func;
+   program->debug.private_data = args->options->debug.private_data;
+
    /* Instruction Selection */
    if (args->is_gs_copy_shader)
       aco::select_gs_copy_shader(program.get(), shaders[0], &config, args);
@@ -95,10 +96,6 @@ void aco_compile_shader(unsigned shader_count,
    /* spilling and scheduling */
    aco::live live_vars = aco::live_var_analysis(program.get(), args->options);
    aco::spill(program.get(), live_vars, args->options);
-   if (program->collect_statistics)
-      aco::collect_presched_stats(program.get());
-   aco::schedule_program(program.get(), live_vars);
-   validate(program.get());
 
    std::string llvm_ir;
    if (args->options->record_ir) {
@@ -115,6 +112,11 @@ void aco_compile_shader(unsigned shader_count,
       free(data);
    }
 
+   if (program->collect_statistics)
+      aco::collect_presched_stats(program.get());
+   aco::schedule_program(program.get(), live_vars);
+   validate(program.get());
+
    /* Register Allocation */
    aco::register_allocation(program.get(), live_vars.live_out);
    if (args->options->dump_shader) {
@@ -122,7 +124,7 @@ void aco_compile_shader(unsigned shader_count,
       aco_print_program(program.get(), stderr);
    }
 
-   if (aco::validate_ra(program.get(), args->options, stderr)) {
+   if (aco::validate_ra(program.get(), args->options)) {
       std::cerr << "Program after RA validation failure:\n";
       aco_print_program(program.get(), stderr);
       abort();