nir: get ffma support from NIR options for nir_lower_flrp
This also fixes the inverted last parameter of nir_lower_flrp in most drivers. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6599>
This commit is contained in:
@@ -4314,7 +4314,7 @@ void nir_lower_alpha_test(nir_shader *shader, enum compare_func func,
|
||||
bool nir_lower_alu(nir_shader *shader);
|
||||
|
||||
bool nir_lower_flrp(nir_shader *shader, unsigned lowering_mask,
|
||||
bool always_precise, bool have_ffma);
|
||||
bool always_precise);
|
||||
|
||||
bool nir_lower_alu_to_scalar(nir_shader *shader, nir_instr_filter_cb cb, const void *data);
|
||||
bool nir_lower_bool_to_bitsize(nir_shader *shader);
|
||||
|
@@ -364,9 +364,10 @@ static void
|
||||
convert_flrp_instruction(nir_builder *bld,
|
||||
struct u_vector *dead_flrp,
|
||||
nir_alu_instr *alu,
|
||||
bool always_precise,
|
||||
bool have_ffma)
|
||||
bool always_precise)
|
||||
{
|
||||
bool have_ffma = !bld->shader->options->lower_ffma;
|
||||
|
||||
bld->cursor = nir_before_instr(&alu->instr);
|
||||
|
||||
/* There are two methods to implement flrp(x, y, t). The strictly correct
|
||||
@@ -586,8 +587,7 @@ static void
|
||||
lower_flrp_impl(nir_function_impl *impl,
|
||||
struct u_vector *dead_flrp,
|
||||
unsigned lowering_mask,
|
||||
bool always_precise,
|
||||
bool have_ffma)
|
||||
bool always_precise)
|
||||
{
|
||||
nir_builder b;
|
||||
nir_builder_init(&b, impl);
|
||||
@@ -599,8 +599,7 @@ lower_flrp_impl(nir_function_impl *impl,
|
||||
|
||||
if (alu->op == nir_op_flrp &&
|
||||
(alu->dest.dest.ssa.bit_size & lowering_mask)) {
|
||||
convert_flrp_instruction(&b, dead_flrp, alu, always_precise,
|
||||
have_ffma);
|
||||
convert_flrp_instruction(&b, dead_flrp, alu, always_precise);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -622,8 +621,7 @@ lower_flrp_impl(nir_function_impl *impl,
|
||||
bool
|
||||
nir_lower_flrp(nir_shader *shader,
|
||||
unsigned lowering_mask,
|
||||
bool always_precise,
|
||||
bool have_ffma)
|
||||
bool always_precise)
|
||||
{
|
||||
struct u_vector dead_flrp;
|
||||
|
||||
@@ -633,7 +631,7 @@ nir_lower_flrp(nir_shader *shader,
|
||||
nir_foreach_function(function, shader) {
|
||||
if (function->impl) {
|
||||
lower_flrp_impl(function->impl, &dead_flrp, lowering_mask,
|
||||
always_precise, have_ffma);
|
||||
always_precise);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user