nir: Add Mali-specific derivative opcodes
Add derivative opcodes fddx_must_abs_mali/fddy_must_abs_mali satisfying: fabs(fdd*_must_abs_mali(v)) = fabs(fdd*(v)) The sign of their result is undefined. On Bifrost and Valhall, these unsigned derivatives can be implemented more efficiently than the correctly-signed counterparts, since the sign fixup requires extra ALU instructions. On backends where this is the case, it is useful to optimize fabs(fdd*(v)) to fabs(fdd*_must_abs_mali(v)). This pattern comes up with the GLSL builtin `fwidth`. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Acked-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12332>
This commit is contained in:
parent
72c0e57e7e
commit
3e8f540753
|
@ -1308,6 +1308,10 @@ for (int i = 0; i < 32; i += 8) {
|
|||
unop("fsat_signed_mali", tfloat, ("fmin(fmax(src0, -1.0), 1.0)"))
|
||||
unop("fclamp_pos_mali", tfloat, ("fmax(src0, 0.0)"))
|
||||
|
||||
# Magnitude equal to fddx/y, sign undefined. Derivative of a constant is zero.
|
||||
unop("fddx_must_abs_mali", tfloat, "0.0")
|
||||
unop("fddy_must_abs_mali", tfloat, "0.0")
|
||||
|
||||
# DXIL specific double [un]pack
|
||||
# DXIL doesn't support generic [un]pack instructions, so we want those
|
||||
# lowered to bit ops. HLSL doesn't support 64bit bitcasts to/from
|
||||
|
|
Loading…
Reference in New Issue