Lines Matching defs:F32
508 struct F32 {
516 F32 r,g,b,a;
522 F32 h,s,l,a;
528 F32 x,y;
631 void assert_true(I32 cond, F32 debug) { assert_true(cond, pun_to_I32(debug)); }
637 void trace_var(I32 mask, int slot, F32 val);
646 void storeF (Ptr ptr, F32 val) { store32(ptr, pun_to_I32(val)); }
657 F32 loadF (Ptr ptr) { return pun_to_F32(load32(ptr)); }
663 F32 uniformF (UPtr ptr, int offset) { return pun_to_F32(uniform32(ptr,offset)); }
668 F32 arrayF (UPtr ptr, int offset, int index) {
679 F32 gatherF (UPtr ptr, int offset, I32 index) {
685 F32 uniformF (Uniform u) { return this->uniformF (u.ptr, u.offset); }
689 F32 gatherF (Uniform u, I32 index) { return this->gatherF (u.ptr, u.offset, index); }
694 F32 arrayF (Uniform a, int index) { return this->arrayF (a.ptr, a.offset, index); }
699 F32 splat(float f) {
719 F32 add(F32, F32);
720 F32 add(F32 x, float y) { return add(x, splat(y)); }
721 F32 add(float x, F32 y) { return add(splat(x), y); }
723 F32 sub(F32, F32);
724 F32 sub(F32 x, float y) { return sub(x, splat(y)); }
725 F32 sub(float x, F32 y) { return sub(splat(x), y); }
727 F32 mul(F32, F32);
728 F32 mul(F32 x, float y) { return mul(x, splat(y)); }
729 F32 mul(float x, F32 y) { return mul(splat(x), y); }
732 F32 fast_mul(F32, F32);
733 F32 fast_mul(F32 x, float y) { return fast_mul(x, splat(y)); }
734 F32 fast_mul(float x, F32 y) { return fast_mul(splat(x), y); }
736 F32 div(F32, F32);
737 F32 div(float x, F32 y) { return div(splat(x), y); }
739 F32 min(F32, F32);
740 F32 min(F32 x, float y) { return min(x, splat(y)); }
741 F32 min(float x, F32 y) { return min(splat(x), y); }
743 F32 max(F32, F32);
744 F32 max(F32 x, float y) { return max(x, splat(y)); }
745 F32 max(float x, F32 y) { return max(splat(x), y); }
748 F32 mad(F32 x, F32 y, F32 z) { return add(mul(x,y), z); }
749 F32 mad(F32 x, F32 y, float z) { return mad( x , y , splat(z)); }
750 F32 mad(F32 x, float y, F32 z) { return mad( x , splat(y), z ); }
751 F32 mad(F32 x, float y, float z) { return mad( x , splat(y), splat(z)); }
752 F32 mad(float x, F32 y, F32 z) { return mad(splat(x), y , z ); }
753 F32 mad(float x, F32 y, float z) { return mad(splat(x), y , splat(z)); }
754 F32 mad(float x, float y, F32 z) { return mad(splat(x), splat(y), z ); }
756 F32 sqrt(F32);
757 F32 approx_log2(F32);
758 F32 approx_pow2(F32);
759 F32 approx_log (F32 x) { return mul(0.69314718f, approx_log2(x)); }
760 F32 approx_exp (F32 x) { return approx_pow2(mul(x, 1.4426950408889634074f)); }
762 F32 approx_powf(F32 base, F32 exp);
763 F32 approx_powf(F32 base, float exp) { return approx_powf(base, splat(exp)); }
764 F32 approx_powf(float base, F32 exp) { return approx_powf(splat(base), exp); }
767 F32 approx_sin(F32 radians);
768 F32 approx_cos(F32 radians) { return approx_sin(add(radians, SK_ScalarPI/2)); }
769 F32 approx_tan(F32 radians);
771 F32 approx_asin(F32 x);
772 F32 approx_acos(F32 x) { return sub(SK_ScalarPI/2, approx_asin(x)); }
773 F32 approx_atan(F32 x);
774 F32 approx_atan2(F32 y, F32 x);
776 F32 lerp(F32 lo, F32 hi, F32 t);
777 F32 lerp(F32 lo, F32 hi, float t) { return lerp( lo , hi , splat(t)); }
778 F32 lerp(F32 lo, float hi, float t) { return lerp( lo , splat(hi), splat(t)); }
779 F32 lerp(F32 lo, float hi, F32 t) { return lerp( lo , splat(hi), t ); }
780 F32 lerp(float lo, F32 hi, F32 t) { return lerp(splat(lo), hi , t ); }
781 F32 lerp(float lo, F32 hi, float t) { return lerp(splat(lo), hi , splat(t)); }
782 F32 lerp(float lo, float hi, F32 t) { return lerp(splat(lo), splat(hi), t ); }
784 F32 clamp(F32 x, F32 lo, F32 hi) { return max(lo, min(x, hi)); }
785 F32 clamp(F32 x, F32 lo, float hi) { return clamp( x , lo , splat(hi)); }
786 F32 clamp(F32 x, float lo, float hi) { return clamp( x , splat(lo), splat(hi)); }
787 F32 clamp(F32 x, float lo, F32 hi) { return clamp( x , splat(lo), hi ); }
788 F32 clamp(float x, F32 lo, F32 hi) { return clamp(splat(x), lo , hi ); }
789 F32 clamp(float x, F32 lo, float hi) { return clamp(splat(x), lo , splat(hi)); }
790 F32 clamp(float x, float lo, F32 hi) { return clamp(splat(x), splat(lo), hi ); }
792 F32 clamp01(F32 x) { return clamp(x, 0.0f, 1.0f); }
794 F32 abs(F32 x) { return pun_to_F32(bit_and(pun_to_I32(x), 0x7fff'ffff)); }
795 F32 fract(F32 x) { return sub(x, floor(x)); }
796 F32 ceil(F32);
797 F32 floor(F32);
798 I32 is_NaN (F32 x) { return neq(x,x); }
799 I32 is_finite(F32 x) { return lt(bit_and(pun_to_I32(x), 0x7f80'0000), 0x7f80'0000); }
801 I32 trunc(F32 x);
802 I32 round(F32 x); // Round to int using current rounding mode (as if lrintf()).
803 I32 pun_to_I32(F32 x) { return {x.builder, x.id}; }
805 I32 to_fp16(F32 x);
806 F32 from_fp16(I32 x);
808 I32 eq(F32, F32);
809 I32 eq(F32 x, float y) { return eq(x, splat(y)); }
810 I32 eq(float x, F32 y) { return eq(splat(x), y); }
812 I32 neq(F32, F32);
813 I32 neq(F32 x, float y) { return neq(x, splat(y)); }
814 I32 neq(float x, F32 y) { return neq(splat(x), y); }
816 I32 lt(F32, F32);
817 I32 lt(F32 x, float y) { return lt(x, splat(y)); }
818 I32 lt(float x, F32 y) { return lt(splat(x), y); }
820 I32 lte(F32, F32);
821 I32 lte(F32 x, float y) { return lte(x, splat(y)); }
822 I32 lte(float x, F32 y) { return lte(splat(x), y); }
824 I32 gt(F32, F32);
825 I32 gt(F32 x, float y) { return gt(x, splat(y)); }
826 I32 gt(float x, F32 y) { return gt(splat(x), y); }
828 I32 gte(F32, F32);
829 I32 gte(F32 x, float y) { return gte(x, splat(y)); }
830 I32 gte(float x, F32 y) { return gte(splat(x), y); }
873 F32 to_F32(I32 x);
874 F32 pun_to_F32(I32 x) { return {x.builder, x.id}; }
906 F32 select(I32 cond, F32 t, F32 f) {
910 F32 select(I32 cond, float t, F32 f) { return select(cond, splat(t), f ); }
911 F32 select(I32 cond, F32 t, float f) { return select(cond, t , splat(f)); }
912 F32 select(I32 cond, float t, float f) { return select(cond, splat(t), splat(f)); }
924 F32 from_unorm(int bits, I32); // E.g. from_unorm(8, x) -> x * (1/255.0f)
925 I32 to_unorm(int bits, F32); // E.g. to_unorm(8, x) -> round(x * 255)
934 void premul(F32* r, F32* g, F32* b, F32 a);
935 void unpremul(F32* r, F32* g, F32* b, F32 a);
940 Color lerp(Color lo, Color hi, F32 t);
1117 SI F32 operator+(F32 x, F32 y) { return x->add(x,y); }
1118 SI F32 operator+(F32 x, float y) { return x->add(x,y); }
1119 SI F32 operator+(float x, F32 y) { return y->add(x,y); }
1121 SI F32 operator-(F32 x, F32 y) { return x->sub(x,y); }
1122 SI F32 operator-(F32 x, float y) { return x->sub(x,y); }
1123 SI F32 operator-(float x, F32 y) { return y->sub(x,y); }
1125 SI F32 operator*(F32 x, F32 y) { return x->mul(x,y); }
1126 SI F32 operator*(F32 x, float y) { return x->mul(x,y); }
1127 SI F32 operator*(float x, F32 y) { return y->mul(x,y); }
1129 SI F32 fast_mul(F32 x, F32 y) { return x->fast_mul(x,y); }
1130 SI F32 fast_mul(F32 x, float y) { return x->fast_mul(x,y); }
1131 SI F32 fast_mul(float x, F32 y) { return y->fast_mul(x,y); }
1133 SI F32 operator/(F32 x, F32 y) { return x->div(x,y); }
1134 SI F32 operator/(float x, F32 y) { return y->div(x,y); }
1136 SI F32 min(F32 x, F32 y) { return x->min(x,y); }
1137 SI F32 min(F32 x, float y) { return x->min(x,y); }
1138 SI F32 min(float x, F32 y) { return y->min(x,y); }
1140 SI F32 max(F32 x, F32 y) { return x->max(x,y); }
1141 SI F32 max(F32 x, float y) { return x->max(x,y); }
1142 SI F32 max(float x, F32 y) { return y->max(x,y); }
1144 SI I32 operator==(F32 x, F32 y) { return x->eq(x,y); }
1145 SI I32 operator==(F32 x, float y) { return x->eq(x,y); }
1146 SI I32 operator==(float x, F32 y) { return y->eq(x,y); }
1148 SI I32 operator!=(F32 x, F32 y) { return x->neq(x,y); }
1149 SI I32 operator!=(F32 x, float y) { return x->neq(x,y); }
1150 SI I32 operator!=(float x, F32 y) { return y->neq(x,y); }
1152 SI I32 operator< (F32 x, F32 y) { return x->lt(x,y); }
1153 SI I32 operator< (F32 x, float y) { return x->lt(x,y); }
1154 SI I32 operator< (float x, F32 y) { return y->lt(x,y); }
1156 SI I32 operator<=(F32 x, F32 y) { return x->lte(x,y); }
1157 SI I32 operator<=(F32 x, float y) { return x->lte(x,y); }
1158 SI I32 operator<=(float x, F32 y) { return y->lte(x,y); }
1160 SI I32 operator> (F32 x, F32 y) { return x->gt(x,y); }
1161 SI I32 operator> (F32 x, float y) { return x->gt(x,y); }
1162 SI I32 operator> (float x, F32 y) { return y->gt(x,y); }
1164 SI I32 operator>=(F32 x, F32 y) { return x->gte(x,y); }
1165 SI I32 operator>=(F32 x, float y) { return x->gte(x,y); }
1166 SI I32 operator>=(float x, F32 y) { return y->gte(x,y); }
1177 SI F32& operator+=(F32& x, F32 y) { return (x = x + y); }
1178 SI F32& operator+=(F32& x, float y) { return (x = x + y); }
1180 SI F32& operator-=(F32& x, F32 y) { return (x = x - y); }
1181 SI F32& operator-=(F32& x, float y) { return (x = x - y); }
1183 SI F32& operator*=(F32& x, F32 y) { return (x = x * y); }
1184 SI F32& operator*=(F32& x, float y) { return (x = x * y); }
1186 SI F32& operator/=(F32& x, F32 y) { return (x = x / y); }
1189 SI void assert_true(I32 cond, F32 debug) { cond->assert_true(cond,debug); }
1195 SI void storeF (Ptr ptr, F32 val) { val->storeF (ptr, val); }
1202 SI F32 gatherF (UPtr ptr, int off, I32 ix) { return ix->gatherF (ptr, off, ix); }
1207 SI F32 gatherF (Uniform u, I32 ix) { return ix->gatherF (u, ix); }
1209 SI F32 sqrt(F32 x) { return x-> sqrt(x); }
1210 SI F32 approx_log2(F32 x) { return x->approx_log2(x); }
1211 SI F32 approx_pow2(F32 x) { return x->approx_pow2(x); }
1212 SI F32 approx_log (F32 x) { return x->approx_log (x); }
1213 SI F32 approx_exp (F32 x) { return x->approx_exp (x); }
1215 SI F32 approx_powf(F32 base, F32 exp) { return base->approx_powf(base, exp); }
1216 SI F32 approx_powf(F32 base, float exp) { return base->approx_powf(base, exp); }
1217 SI F32 approx_powf(float base, F32 exp) { return exp->approx_powf(base, exp); }
1219 SI F32 approx_sin(F32 radians) { return radians->approx_sin(radians); }
1220 SI F32 approx_cos(F32 radians) { return radians->approx_cos(radians); }
1221 SI F32 approx_tan(F32 radians) { return radians->approx_tan(radians); }
1223 SI F32 approx_asin(F32 x) { return x->approx_asin(x); }
1224 SI F32 approx_acos(F32 x) { return x->approx_acos(x); }
1225 SI F32 approx_atan(F32 x) { return x->approx_atan(x); }
1226 SI F32 approx_atan2(F32 y, F32 x) { return x->approx_atan2(y, x); }
1228 SI F32 clamp01(F32 x) { return x-> clamp01(x); }
1229 SI F32 abs(F32 x) { return x-> abs(x); }
1230 SI F32 ceil(F32 x) { return x-> ceil(x); }
1231 SI F32 fract(F32 x) { return x-> fract(x); }
1232 SI F32 floor(F32 x) { return x-> floor(x); }
1233 SI I32 is_NaN(F32 x) { return x-> is_NaN(x); }
1234 SI I32 is_finite(F32 x) { return x->is_finite(x); }
1236 SI I32 trunc(F32 x) { return x-> trunc(x); }
1237 SI I32 round(F32 x) { return x-> round(x); }
1238 SI I32 pun_to_I32(F32 x) { return x-> pun_to_I32(x); }
1239 SI F32 pun_to_F32(I32 x) { return x-> pun_to_F32(x); }
1240 SI F32 to_F32(I32 x) { return x-> to_F32(x); }
1241 SI I32 to_fp16(F32 x) { return x-> to_fp16(x); }
1242 SI F32 from_fp16(I32 x) { return x-> from_fp16(x); }
1244 SI F32 lerp(F32 lo, F32 hi, F32 t) { return lo->lerp(lo,hi,t); }
1245 SI F32 lerp(F32 lo, F32 hi, float t) { return lo->lerp(lo,hi,t); }
1246 SI F32 lerp(F32 lo, float hi, F32 t) { return lo->lerp(lo,hi,t); }
1247 SI F32 lerp(F32 lo, float hi, float t) { return lo->lerp(lo,hi,t); }
1248 SI F32 lerp(float lo, F32 hi, F32 t) { return hi->lerp(lo,hi,t); }
1249 SI F32 lerp(float lo, F32 hi, float t) { return hi->lerp(lo,hi,t); }
1250 SI F32 lerp(float lo, float hi, F32 t) { return t->lerp(lo,hi,t); }
1252 SI F32 clamp(F32 x, F32 lo, F32 hi) { return x->clamp(x,lo,hi); }
1253 SI F32 clamp(F32 x, F32 lo, float hi) { return x->clamp(x,lo,hi); }
1254 SI F32 clamp(F32 x, float lo, F32 hi) { return x->clamp(x,lo,hi); }
1255 SI F32 clamp(F32 x, float lo, float hi) { return x->clamp(x,lo,hi); }
1256 SI F32 clamp(float x, F32 lo, F32 hi) { return lo->clamp(x,lo,hi); }
1257 SI F32 clamp(float x, F32 lo, float hi) { return lo->clamp(x,lo,hi); }
1258 SI F32 clamp(float x, float lo, F32 hi) { return hi->clamp(x,lo,hi); }
1293 SI F32 select(I32 c, F32 t, F32 f) { return c->select(c, t , f ); }
1294 SI F32 select(I32 c, F32 t, float f) { return c->select(c, t , c->splat(f)); }
1295 SI F32 select(I32 c, float t, F32 f) { return c->select(c, c->splat(t), f ); }
1296 SI F32 select(I32 c, float t, float f) { return c->select(c, c->splat(t), c->splat(f)); }
1308 SI F32 operator-(F32 x) { return 0.0f - x; }
1310 SI F32 from_unorm(int bits, I32 x) { return x->from_unorm(bits,x); }
1311 SI I32 to_unorm(int bits, F32 x) { return x-> to_unorm(bits,x); }
1318 SI void premul(F32* r, F32* g, F32* b, F32 a) { a-> premul(r,g,b,a); }
1319 SI void unpremul(F32* r, F32* g, F32* b, F32 a) { a->unpremul(r,g,b,a); }
1324 SI Color lerp(Color lo, Color hi, F32 t) { return t->lerp(lo,hi,t); }
1335 SI F32 poly(F32 x, F32_or_float a, float b, Rest... rest) {