mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-24 19:18:11 +02:00
llvmpipe: stub other functions inside compute shaders for ORCJIT
ORCJIT expects every functions prototypes to be present even when using
object caches. Code for adding stubs for entry point functions was added
previously when implementing shader cache for ORCJIT, but when using
OpenCL, extra functions could be present in compute shaders which need
stubs too.
Reuse the code for constructing references for extra functions to
generate function stubs for them.
This fixes function calls with Rusticl on llvmpipe with ORCJIT.
Fixes: bb0efdd4d8 ("llvmpipe: add shader cache support for ORCJIT implementation")
Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41532>
This commit is contained in:
parent
0dda43819e
commit
3522f0f24c
1 changed files with 22 additions and 0 deletions
|
|
@ -401,10 +401,16 @@ generate_compute(struct llvmpipe_context *lp,
|
|||
}
|
||||
|
||||
if (variant->gallivm->cache->data_size) {
|
||||
#if GALLIVM_USE_ORCJIT
|
||||
gallivm_stub_func(gallivm, function);
|
||||
if (use_coro)
|
||||
gallivm_stub_func(gallivm, coro);
|
||||
/* Otherwise continue to stub all other functions */
|
||||
if (exec_list_length(&nir->functions) <= 1)
|
||||
return;
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
context_ptr = LLVMGetParam(function, CS_ARG_CONTEXT);
|
||||
|
|
@ -474,12 +480,28 @@ generate_compute(struct llvmpipe_context *lp,
|
|||
LLVMValueRef lfunc = LLVMAddFunction(gallivm->module, func_name, func_type);
|
||||
LLVMSetFunctionCallConv(lfunc, LLVMCCallConv);
|
||||
|
||||
#if GALLIVM_USE_ORCJIT
|
||||
if (gallivm->cache->data_size) {
|
||||
gallivm_stub_func(gallivm, lfunc);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct lp_build_fn *new_fn = ralloc(fns, struct lp_build_fn);
|
||||
new_fn->fn_type = func_type;
|
||||
new_fn->fn = lfunc;
|
||||
_mesa_hash_table_insert(fns, func, new_fn);
|
||||
}
|
||||
|
||||
#if GALLIVM_USE_ORCJIT
|
||||
if (gallivm->cache->data_size) {
|
||||
lp_bld_llvm_sampler_soa_destroy(sampler);
|
||||
lp_bld_llvm_image_soa_destroy(image);
|
||||
_mesa_hash_table_destroy(fns, NULL);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
nir_foreach_function(func, nir) {
|
||||
if (func->is_entrypoint)
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue