gallium/tgsi: Rewrite the docs on source modifiers.

Clarify what the rules are, and warn about the exceptions.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8369>
This commit is contained in:
Eric Anholt 2021-01-11 11:22:53 -08:00 committed by Marge Bot
parent 1fc79592b7
commit f44212067e
1 changed files with 15 additions and 12 deletions

View File

@ -23,26 +23,29 @@ When an instruction has a scalar result, the result is usually copied into
each of the components of *dst*. When this happens, the result is said to be
*replicated* to *dst*. :opcode:`RCP` is one such instruction.
Modifiers
Source Modifiers
^^^^^^^^^^^^^^^^
TGSI supports 32-bit negate and absolute value modifiers on floating-point
inputs, and 32-bit integer negates on some drivers. The negate applies after
absolute value if both are present.
The type of an input can be found by ``tgsi_opcode_infer_src_type()``, and
TGSI_OPCODE_MOV and the second and third operands of TGSI_OPCODE_UCMP (which
return TGSI_TYPE_UNTYPED) are also considered floats for the purpose of source
modifiers.
Other Modifiers
^^^^^^^^^^^^^^^
TGSI supports modifiers on inputs (as well as saturate and precise modifier
on instructions).
The saturate modifier clamps 32-bit destination stores to [0.0, 1.0].
For arithmetic instruction having a precise modifier certain optimizations
which may alter the result are disallowed. Example: *add(mul(a,b),c)* can't be
optimized to TGSI_OPCODE_MAD, because some hardware only supports the fused
MAD instruction.
For inputs which have a floating point type, both absolute value and
negation modifiers are supported (with absolute value being applied
first). The only source of TGSI_OPCODE_MOV and the second and third
sources of TGSI_OPCODE_UCMP are considered to have float type for
applying modifiers.
For inputs which have signed or unsigned type only the negate modifier is
supported.
Instruction Set
---------------