Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/util/math.h
| Show First 20 Lines • Show All 713 Lines • ▼ Show 20 Lines | ccl_device_inline float pow20(float a) | ||||
| return sqr(sqr(sqr(sqr(a)) * a)); | return sqr(sqr(sqr(sqr(a)) * a)); | ||||
| } | } | ||||
| ccl_device_inline float pow22(float a) | ccl_device_inline float pow22(float a) | ||||
| { | { | ||||
| return sqr(a * sqr(sqr(sqr(a)) * a)); | return sqr(a * sqr(sqr(sqr(a)) * a)); | ||||
| } | } | ||||
| #ifdef __KERNEL_METAL__ | |||||
| ccl_device_inline float lgammaf(float x) | |||||
brecht: Add `ccl_device_inline` even if it is unnecessary for Metal. | |||||
| { | |||||
| /* Nemes, Gergő (2010), "New asymptotic expansion for the Gamma function", Archiv der Mathematik | |||||
| */ | |||||
| const float _1_180 = 1.0f / 180.0f; | |||||
| const float log2pi = 1.83787706641f; | |||||
| const float logx = log(x); | |||||
| return (log2pi - logx + | |||||
| x * (logx * 2.0f + log(x * sinh(1.0f / x) + (_1_180 / pow(x, 6.0f))) - 2.0f)) * | |||||
| 0.5f; | |||||
| } | |||||
| #endif | |||||
| ccl_device_inline float beta(float x, float y) | ccl_device_inline float beta(float x, float y) | ||||
| { | { | ||||
| return expf(lgammaf(x) + lgammaf(y) - lgammaf(x + y)); | return expf(lgammaf(x) + lgammaf(y) - lgammaf(x + y)); | ||||
| } | } | ||||
| ccl_device_inline float xor_signmask(float x, int y) | ccl_device_inline float xor_signmask(float x, int y) | ||||
| { | { | ||||
| return __int_as_float(__float_as_int(x) ^ y); | return __int_as_float(__float_as_int(x) ^ y); | ||||
| ▲ Show 20 Lines • Show All 191 Lines • Show Last 20 Lines | |||||
Add ccl_device_inline even if it is unnecessary for Metal.