diff options
author | Dave Airlie <airlied@redhat.com> | 2022-05-11 14:56:36 +1000 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-07-01 01:34:19 +0000 |
commit | 9fe2b6b7480559831d78e7c5e82839eb80633f15 (patch) | |
tree | 05dec7fee315ad13c3c82f152ad370e76042cea3 /src/amd/compiler/aco_interface.cpp | |
parent | 2dce77c239396c5c507fddd47c63d9402e597bfc (diff) | |
download | mesa-9fe2b6b7480559831d78e7c5e82839eb80633f15.tar.gz |
aco/radv: provide a vs prolog callback from aco to radv.
Avoid building the radv binary in aco, just callback with the
necessary info.
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16445>
Diffstat (limited to 'src/amd/compiler/aco_interface.cpp')
-rw-r--r-- | src/amd/compiler/aco_interface.cpp | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/src/amd/compiler/aco_interface.cpp b/src/amd/compiler/aco_interface.cpp index 7759464d833..5dde37b378f 100644 --- a/src/amd/compiler/aco_interface.cpp +++ b/src/amd/compiler/aco_interface.cpp @@ -266,7 +266,8 @@ aco_compile_vs_prolog(const struct aco_compiler_options* options, const struct aco_shader_info* info, const struct aco_vs_prolog_key* key, const struct radv_shader_args* args, - struct radv_shader_part_binary** binary) + aco_prolog_callback *build_prolog, + void **binary) { aco::init(); @@ -290,29 +291,18 @@ aco_compile_vs_prolog(const struct aco_compiler_options* options, code.reserve(align(program->blocks[0].instructions.size() * 2, 16)); unsigned exec_size = aco::emit_program(program.get(), code); - /* copy into binary */ - size_t size = code.size() * sizeof(uint32_t) + sizeof(radv_shader_part_binary); - bool get_disasm = options->dump_shader || options->record_ir; std::string disasm; - if (get_disasm) { + if (get_disasm) disasm = get_disasm_string(program.get(), code, exec_size); - size += disasm.size(); - } - - radv_shader_part_binary* bin = (radv_shader_part_binary*)calloc(size, 1); - bin->num_sgprs = config.num_sgprs; - bin->num_vgprs = config.num_vgprs; - bin->num_preserved_sgprs = num_preserved_sgprs; - bin->code_size = code.size() * sizeof(uint32_t); - memcpy(bin->data, code.data(), bin->code_size); - - if (get_disasm) { - disasm.copy((char*)bin->data + bin->code_size, disasm.size()); - bin->disasm_size = disasm.size(); - } - - *binary = bin; + (*build_prolog)(binary, + config.num_sgprs, + config.num_vgprs, + num_preserved_sgprs, + code.data(), + code.size(), + disasm.data(), + disasm.size()); } |