X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Futil%2Fu_math.h;h=b725489b520b1564677bef1cdec80cbdd97cb475;hb=HEAD;hp=59266c16922824e25c4ca5c0c5b65af9a6e4b80a;hpb=72acb66527df6f38c7b8b15fa5062a616d67074b;p=mesa.git diff --git a/src/util/u_math.h b/src/util/u_math.h index 59266c16922..b725489b520 100644 --- a/src/util/u_math.h +++ b/src/util/u_math.h @@ -667,6 +667,9 @@ util_memcpy_cpu_to_le32(void * restrict dest, const void * restrict src, size_t */ #define CLAMP( X, MIN, MAX ) ( (X)>(MIN) ? ((X)>(MAX) ? (MAX) : (X)) : (MIN) ) +/* Syntax sugar occuring frequently in graphics code */ +#define SATURATE( X ) CLAMP(X, 0.0f, 1.0f) + #define MIN2( A, B ) ( (A)<(B) ? (A) : (B) ) #define MAX2( A, B ) ( (A)>(B) ? (A) : (B) )