From 1f1b3cc200ac9ddf7d99051b9e6650ff7ce669a1 Mon Sep 17 00:00:00 2001 From: Simon Perretta Date: Sun, 8 Dec 2024 14:04:40 +0000 Subject: [PATCH] nir/precompiled: add shader stage option to nir_precompiled_build_variant Signed-off-by: Simon Perretta Reviewed-by: Alyssa Rosenzweig Part-of: --- src/asahi/clc/asahi_clc.c | 3 ++- src/compiler/nir/nir_precompiled.h | 7 ++++--- src/panfrost/clc/pan_compile.c | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/asahi/clc/asahi_clc.c b/src/asahi/clc/asahi_clc.c index 7118d06b66c..4b5b469b74b 100644 --- a/src/asahi/clc/asahi_clc.c +++ b/src/asahi/clc/asahi_clc.c @@ -293,7 +293,8 @@ main(int argc, char **argv) for (unsigned v = 0; v < nr_vars; ++v) { nir_shader *s = nir_precompiled_build_variant( - libfunc, v, &agx_nir_options, &opt, load_kernel_input); + libfunc, MESA_SHADER_COMPUTE, v, &agx_nir_options, &opt, + load_kernel_input); nir_link_shader_functions(s, nir); NIR_PASS(_, s, nir_inline_functions); diff --git a/src/compiler/nir/nir_precompiled.h b/src/compiler/nir/nir_precompiled.h index d3bc466e60c..bd78acde438 100644 --- a/src/compiler/nir/nir_precompiled.h +++ b/src/compiler/nir/nir_precompiled.h @@ -627,7 +627,8 @@ nir_precomp_print_target_binary_map(FILE *fp_c, FILE *fp_h, const char *prefix, } static inline nir_shader * -nir_precompiled_build_variant(const nir_function *libfunc, unsigned variant, +nir_precompiled_build_variant(const nir_function *libfunc, + gl_shader_stage stage, unsigned variant, const nir_shader_compiler_options *opts, const struct nir_precomp_opts *precomp_opt, nir_def *(*load_arg)(nir_builder *b, @@ -641,11 +642,11 @@ nir_precompiled_build_variant(const nir_function *libfunc, unsigned variant, nir_builder b; if (has_variants) { - b = nir_builder_init_simple_shader(MESA_SHADER_COMPUTE, opts, + b = nir_builder_init_simple_shader(stage, opts, "%s variant %u", libfunc->name, variant); } else { - b = nir_builder_init_simple_shader(MESA_SHADER_COMPUTE, opts, "%s", + b = nir_builder_init_simple_shader(stage, opts, "%s", libfunc->name); } diff --git a/src/panfrost/clc/pan_compile.c b/src/panfrost/clc/pan_compile.c index fe501fa8972..328cfe7e82d 100644 --- a/src/panfrost/clc/pan_compile.c +++ b/src/panfrost/clc/pan_compile.c @@ -334,8 +334,8 @@ main(int argc, const char **argv) for (unsigned v = 0; v < nr_vars; ++v) { nir_shader *s = nir_precompiled_build_variant( - libfunc, v, get_compiler_options(target_arch), &opt, - load_kernel_input); + libfunc, MESA_SHADER_COMPUTE, v, get_compiler_options(target_arch), + &opt, load_kernel_input); unsigned gpu_prod_id = (target_arch & 0xf) << 12;