nir: Hoist nir_op_is_derivative

Redefine in terms of the algebraic property. This correctly handles the
Mali-specific derivatives.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24833>
This commit is contained in:
Alyssa Rosenzweig
2023-08-24 07:05:53 -04:00
parent b77dc9f7d7
commit 1a788a86c1
2 changed files with 6 additions and 11 deletions

View File

@@ -1432,6 +1432,12 @@ nir_op_is_selection(nir_op op)
return (nir_op_infos[op].algebraic_properties & NIR_OP_IS_SELECTION) != 0;
}
static inline bool
nir_op_is_derivative(nir_op op)
{
return (nir_op_infos[op].algebraic_properties & NIR_OP_IS_DERIVATIVE) != 0;
}
typedef struct nir_alu_instr {
/** Base instruction */
nir_instr instr;

View File

@@ -26,17 +26,6 @@
#include "nir_control_flow.h"
#include "nir_worklist.h"
static bool
nir_op_is_derivative(nir_op op)
{
return op == nir_op_fddx ||
op == nir_op_fddy ||
op == nir_op_fddx_fine ||
op == nir_op_fddy_fine ||
op == nir_op_fddx_coarse ||
op == nir_op_fddy_coarse;
}
static bool
nir_texop_implies_derivative(nir_texop op)
{