From efa4313aa57e4c3511eb1d5d88edc37e99f899fa Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Tue, 6 Sep 2022 19:12:09 +0200 Subject: Add all CCPi patches (patches are not applied automatically, but just collected) --- .../rounding.h | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 patches/astra-toolbox-approximate-projectors/rounding.h (limited to 'patches/astra-toolbox-approximate-projectors/rounding.h') diff --git a/patches/astra-toolbox-approximate-projectors/rounding.h b/patches/astra-toolbox-approximate-projectors/rounding.h new file mode 100644 index 0000000..c1cbffb --- /dev/null +++ b/patches/astra-toolbox-approximate-projectors/rounding.h @@ -0,0 +1,50 @@ +#include + +#define precision 8 +#define approximate_interpolation + +#ifdef approximate_interpolation +# ifdef precision +# if precision == 16 +# define texto(v) __float2half(v) +# define texfrom(v) __half2float(v) +# define textype half +# define interpolate(v0, v1, pos) (v0 + pos*(v1-v0)) +# define textocheck(var,msg,val) var=texto(val); +# else +# define precision_mult ((1<1)) { printf("Received out-of-range value (%f) in %s texture fetch\n", val, msg); } \ + var=texto(val); +# endif +# else +# define texto(v) (v) +# define texfrom(v) (v) +# define textype float +# define interpolate(v0, v1, pos) (v0 + pos*(v1-v0)) +# define textocheck(var,msg,val) var=texto(val); +# endif +#else +# ifdef precision +# if precision == 16 +# define texto(v) __half2float(__float2half(v)) +# define textocheck(var,msg,val) var=texto(val); +# else +# define precision_mult ((1<1)) { printf("Received out-of-range value (%f) in %s texture fetch\n", val, msg); } \ + var=texto(val); +# endif +# else +# define texto(v) (v) +# define textocheck(var,msg,val) var=texto(val); +# endif +# define texfrom(v) (v) +# define textype float +# define interpolate(v0, v1, pos) (v0 + pos*(v1-v0)) +#endif -- cgit v1.2.3