nir/precompiled: add shader stage option to nir_precompiled_build_variant

Signed-off-by: Simon Perretta <simon.perretta@imgtec.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36001>
This commit is contained in:
Simon Perretta 2024-12-08 14:04:40 +00:00
parent 5b29daf7bc
commit 1f1b3cc200
3 changed files with 8 additions and 6 deletions

View file

@ -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);

View file

@ -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);
}

View file

@ -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;