util: Add SATURATE macro
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 14 May 2020 16:34:35 +0000 (12:34 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 26 May 2020 22:31:31 +0000 (22:31 +0000)
commit35938c15e22e3021f7693425f0d2134845c81f6b
treebbdf867fd5f7386ef109de8f5028874c11d85e5a
parent8cc7711924fd0f3c76e22e527e21d8f8368e5395
util: Add SATURATE macro

Equivalent to clamp(x, 0.0, 1.0) or fsat in NIR. Useful for format
packing, among other uses given the variety of substituions in-tree.

v2: Drop brackets (Eric).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5100>
src/util/macros.h
src/util/u_math.h