brw: don't preprocess software doubles if opts->softfp64 is not set
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

The Anv driver doesn't ever set opts->softfp64 for the preprocess
stage (anv_shader_preprocess_nir()). The Vulkan preprocess stage is a
"physical device" stage, and softfp64 requires the actual anv_device:
see the comments for the preprocess_nir function pointer inside the
definition of struct vk_device_shader_ops, and the definition of
anv_ensure_fp64_shader().

It is only during anv_shader_compile() that we call
anv_ensure_fp64_shader(), where we actually build and store the
nir_shader we name fp64_nir. Then we have everything ready and we can
call the nir_lower_doubles pass.

To account for all that, just have brw check if opts->softfp64 is
actually set, and disable the full_software lowering if we don't have
it: otherwise we'll either segfault or hit the assert(softfp64) that
is in lower_doubles_instr_to_soft() in nir_lower_double_ops.c.

This prevents a segfault (or an assertion failure when in debug mode)
when running DIRT 5 on Tiger Lake.

Fixes: 7d3b62e13d ("anv: only load fp64 software shader when needed")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42105>
This commit is contained in:
Paulo Zanoni 2026-06-05 16:08:15 -07:00 committed by Marge Bot
parent 5134104c9c
commit d3371e22d7

View file

@ -2251,11 +2251,19 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir,
};
OPT(nir_opt_16bit_tex_image, &options);
OPT(nir_lower_doubles, opts->softfp64, nir->options->lower_doubles_options);
/* Anv delays the initialization of softfp64, so we may not have
* softfp64 set here. The full lowering will happen during the post-process
* compilation.
*/
nir_lower_doubles_options double_opts =
nir->options->lower_doubles_options;
if (!opts->softfp64)
double_opts &= ~nir_lower_fp64_full_software;
OPT(nir_lower_doubles, opts->softfp64, double_opts);
if (OPT(nir_lower_int64_float_conversions)) {
OPT(nir_opt_algebraic);
OPT(nir_lower_doubles, opts->softfp64,
nir->options->lower_doubles_options);
OPT(nir_lower_doubles, opts->softfp64, double_opts);
}
OPT(nir_lower_bit_size, lower_bit_size_callback, (void *)devinfo);