Blender V4.5
math_base.h File Reference
#include "util/defines.h"
#include "util/types_base.h"
#include <cfloat>
#include <cmath>

Go to the source code of this file.

Classes

struct  Interval< T >
 

Macros

#define M_PI_F   (3.1415926535897932f) /* `pi` */
 
#define M_PI_2_F   (1.5707963267948966f) /* `pi/2` */
 
#define M_PI_4_F   (0.7853981633974830f) /* `pi/4` */
 
#define M_1_PI_F   (0.3183098861837067f) /* `1/pi` */
 
#define M_2_PI_F   (0.6366197723675813f) /* `2/pi` */
 
#define M_1_2PI_F   (0.1591549430918953f) /* `1/(2*pi)` */
 
#define M_1_4PI_F   (0.0795774715459476f) /* `1/(4*pi)` */
 
#define M_SQRT_PI_8_F   (0.6266570686577501f) /* `sqrt(pi/8)` */
 
#define M_LN_2PI_F   (1.8378770664093454f) /* `ln(2*pi)` */
 
#define M_2PI_F   (6.2831853071795864f) /* `2*pi` */
 
#define M_4PI_F   (12.566370614359172f) /* `4*pi` */
 
#define M_PI_4F   0.78539816339744830962f /* `pi/4` */
 
#define M_SQRT2_F   (1.4142135623730950f) /* `sqrt(2)` */
 
#define M_CBRT2_F   1.2599210498948732f /* `cbrt(2)` */
 
#define M_SQRT1_2F   0.70710678118654752440f /* `sqrt(1/2)` */
 
#define M_SQRT3_F   (1.7320508075688772f) /* `sqrt(3)` */
 
#define M_LN2_F   (0.6931471805599453f) /* `ln(2)` */
 
#define M_LN10_F   (2.3025850929940457f) /* `ln(10)` */
 
#define __has_builtin(v)   0
 

Functions

ccl_device_inline int abs (const int x)
 
ccl_device_inline int max (const int a, const int b)
 
ccl_device_inline int min (const int a, const int b)
 
ccl_device_inline uint32_t max (const uint32_t a, const uint32_t b)
 
ccl_device_inline uint32_t min (const uint32_t a, const uint32_t b)
 
ccl_device_inline uint64_t max (const uint64_t a, const uint64_t b)
 
ccl_device_inline uint64_t min (const uint64_t a, const uint64_t b)
 
template<class T >
ccl_device_inline std::enable_if_t< std::is_same_v< T, size_t >, Tmax (T a, T b)
 
template<class T >
ccl_device_inline std::enable_if_t< std::is_same_v< T, size_t >, Tmin (T a, T b)
 
ccl_device_inline float max (const float a, const float b)
 
ccl_device_inline float min (const float a, const float b)
 
ccl_device_inline double max (const double a, const double b)
 
ccl_device_inline double min (const double a, const double b)
 
template<typename T >
ccl_device_inline T min4 (const T &a, const T &b, const T &c, const T &d)
 
template<typename T >
ccl_device_inline T max4 (const T &a, const T &b, const T &c, const T &d)
 
ccl_device_inline float min4 (const float a, const float b, float c, const float d)
 
ccl_device_inline float max4 (const float a, const float b, float c, const float d)
 
template<typename T >
ccl_device_inline T make_zero ()
 
ccl_device_template_spec float make_zero ()
 
ccl_device_inline int as_int (const uint i)
 
ccl_device_inline uint as_uint (const int i)
 
ccl_device_inline uint as_uint (const float f)
 
ccl_device_inline int __float_as_int (const float f)
 
ccl_device_inline float __int_as_float (const int i)
 
ccl_device_inline uint __float_as_uint (const float f)
 
ccl_device_inline float __uint_as_float (const uint i)
 
template<typename T >
ccl_device_inline uint pointer_pack_to_uint_0 (T *ptr)
 
template<typename T >
ccl_device_inline uint pointer_pack_to_uint_1 (T *ptr)
 
template<typename T >
ccl_device_inline Tpointer_unpack_from_uint (const uint a, const uint b)
 
ccl_device_inline uint uint16_pack_to_uint (const uint a, const uint b)
 
ccl_device_inline uint uint16_unpack_from_uint_0 (const uint i)
 
ccl_device_inline uint uint16_unpack_from_uint_1 (const uint i)
 
ccl_device_inline bool isnan_safe (const float f)
 
ccl_device_inline bool isfinite_safe (const float f)
 
ccl_device_inline float ensure_finite (const float v)
 
ccl_device_inline int clamp (const int a, const int mn, const int mx)
 
ccl_device_inline float clamp (const float a, const float mn, const float mx)
 
ccl_device_inline float mix (const float a, const float b, float t)
 
ccl_device_inline float smoothstep (const float edge0, const float edge1, const float x)
 
ccl_device_inline float saturatef (const float a)
 
ccl_device_inline int float_to_int (const float f)
 
ccl_device_inline int floor_to_int (const float f)
 
ccl_device_inline float floorfrac (const float x, ccl_private int *i)
 
ccl_device_inline int ceil_to_int (const float f)
 
ccl_device_inline float fractf (const float x)
 
ccl_device_inline float wrapf (const float value, const float max, const float min)
 
ccl_device_inline float pingpongf (const float a, const float b)
 
ccl_device_inline float smoothminf (const float a, const float b, float k)
 
ccl_device_inline float signf (const float f)
 
ccl_device_inline float nonzerof (const float f, const float eps)
 
ccl_device_inline float compatible_atan2 (const float y, const float x)
 
ccl_device_inline float compatible_signf (const float f)
 
ccl_device_inline float smoothstepf (const float f)
 
ccl_device_inline int mod (const int x, const int m)
 
ccl_device_inline float interp (const float a, const float b, const float t)
 
ccl_device_inline float inverse_lerp (const float a, const float b, const float x)
 
ccl_device_inline float cubic_interp (const float a, const float b, float c, const float d, float x)
 
ccl_device_inline float safe_sqrtf (const float f)
 
ccl_device_inline float inversesqrtf (const float f)
 
ccl_device float safe_asinf (const float a)
 
ccl_device float safe_acosf (const float a)
 
ccl_device float compatible_powf (const float x, const float y)
 
ccl_device float safe_powf (const float a, const float b)
 
ccl_device float safe_divide (const float a, const float b)
 
ccl_device float safe_logf (const float a, const float b)
 
ccl_device float safe_modulo (const float a, const float b)
 
ccl_device float safe_floored_modulo (const float a, const float b)
 
ccl_device_inline float sqr (const float a)
 
ccl_device_inline float sin_from_cos (const float c)
 
ccl_device_inline float cos_from_sin (const float s)
 
ccl_device_inline float sin_sqr_to_one_minus_cos (const float s_sq)
 
ccl_device_inline float one_minus_cos (const float angle)
 
ccl_device_inline float pow20 (const float a)
 
ccl_device_inline float pow22 (const float a)
 
ccl_device_inline float beta (const float x, const float y)
 
ccl_device_inline float xor_signmask (const float x, const int y)
 
ccl_device float bits_to_01 (const uint bits)
 
ccl_device_inline uint popcount (const uint x)
 
ccl_device_inline uint count_leading_zeros (const uint x)
 
ccl_device_inline uint count_trailing_zeros (const uint x)
 
ccl_device_inline uint find_first_set (const uint x)
 
ccl_device_inline bool compare_floats (const float a, const float b, float abs_diff, const int ulp_diff)
 
ccl_device_inline uint next_power_of_two (const uint x)
 
ccl_device_inline uint prev_power_of_two (const uint x)
 
ccl_device_inline uint32_t reverse_integer_bits (uint32_t x)
 
ccl_device_inline bool solve_quadratic (const float a, const float b, const float c, ccl_private float &x1, ccl_private float &x2)
 
template<typename T1 , typename T2 >
ccl_device_inline Interval< T1operator/= (ccl_private Interval< T1 > &interval, const T2 f)
 
template<typename T >
ccl_device_inline Interval< Tintervals_intersection (const ccl_private Interval< T > &first, const ccl_private Interval< T > &second)
 

Macro Definition Documentation

◆ __has_builtin

#define __has_builtin ( v)    0

Definition at line 783 of file math_base.h.

◆ M_1_2PI_F

◆ M_1_4PI_F

#define M_1_4PI_F   (0.0795774715459476f) /* `1/(4*pi)` */

Definition at line 48 of file math_base.h.

Referenced by phase_henyey_greenstein().

◆ M_1_PI_F

◆ M_2_PI_F

#define M_2_PI_F   (0.6366197723675813f) /* `2/pi` */

Definition at line 42 of file math_base.h.

Referenced by bsdf_hair_huang_eval_residual().

◆ M_2PI_F

◆ M_4PI_F

#define M_4PI_F   (12.566370614359172f) /* `4*pi` */

◆ M_CBRT2_F

#define M_CBRT2_F   1.2599210498948732f /* `cbrt(2)` */

Definition at line 73 of file math_base.h.

Referenced by phase_draine_sample_cos().

◆ M_LN10_F

#define M_LN10_F   (2.3025850929940457f) /* `ln(10)` */

Definition at line 85 of file math_base.h.

Referenced by fast_exp10(), and fast_log10().

◆ M_LN2_F

#define M_LN2_F   (0.6931471805599453f) /* `ln(2)` */

Definition at line 82 of file math_base.h.

Referenced by fast_exp10(), fast_expf(), fast_expf4(), fast_log10(), and fast_logf().

◆ M_LN_2PI_F

#define M_LN_2PI_F   (1.8378770664093454f) /* `ln(2*pi)` */

Definition at line 54 of file math_base.h.

Referenced by log_bessel_I0().

◆ M_PI_2_F

◆ M_PI_4_F

#define M_PI_4_F   (0.7853981633974830f) /* `pi/4` */

◆ M_PI_4F

#define M_PI_4F   0.78539816339744830962f /* `pi/4` */

Definition at line 65 of file math_base.h.

Referenced by TEST().

◆ M_PI_F

#define M_PI_F   (3.1415926535897932f) /* `pi` */

Definition at line 30 of file math_base.h.

Referenced by Light::area(), area_light_spread_attenuation(), area_light_spread_clamp_light(), background_cdf(), background_map_pdf(), background_map_sample(), bsdf_aniso_D(), bsdf_ashikhmin_shirley_eval(), bsdf_ashikhmin_shirley_sample(), bsdf_D(), bsdf_hair_huang_eval_residual(), bsdf_hair_huang_sample(), bsdf_hair_reflection_eval(), bsdf_hair_transmission_eval(), bsdf_hair_transmission_sample(), bsdf_oren_nayar_get_intensity(), bsdf_oren_nayar_setup(), OrientationBounds::calculate_measure(), calculate_ris_target(), compute_2d_gabor_kernel(), compute_2d_gabor_noise_cell(), compute_3d_gabor_kernel(), compute_3d_orientation(), delta_phi(), LightManager::device_update_lights(), direction_to_equiangular_cubemap_face(), direction_to_equirectangular(), equirectangular_to_direction(), fast_acosf(), mikk::fast_acosf(), fast_atan2f(), fresnel_dielectric_polarized(), fresnel_iridescence(), SkyTextureNode::get_sun_average_radiance(), kernel_ies_interp(), light_tree_importance(), LightTreeEmitter::LightTreeEmitter(), map_to_tube(), merge(), mnee_sample_bsdf_dh(), NODE_DEFINE(), NODE_DEFINE(), NODE_DEFINE(), NODE_DEFINE(), NODE_DEFINE(), phase_fournier_forand(), phase_fournier_forand_impl(), phase_fournier_forand_newton(), phase_mie(), phase_rayleigh(), point_light_mnee_sample_update(), point_light_sample(), point_light_sample_from_intersection(), IESFile::process(), regular_polygon_sample(), sample_trimmed_logistic(), SkyTextureNode::simplify_settings(), SKY_nishita_skymodel_precompute_texture(), sky_texture_precompute_preetham(), spot_light_mnee_sample_update(), spot_light_sample(), spot_light_sample_from_intersection(), svm_math(), svm_node_ies(), svm_node_principled_volume(), svm_node_tex_gabor(), TEST(), TEST(), TEST(), TEST(), TEST(), trimmed_logistic(), TYPED_TEST(), and wrap_angle().

◆ M_SQRT1_2F

#define M_SQRT1_2F   0.70710678118654752440f /* `sqrt(1/2)` */

Definition at line 76 of file math_base.h.

Referenced by TEST().

◆ M_SQRT2_F

#define M_SQRT2_F   (1.4142135623730950f) /* `sqrt(2)` */

◆ M_SQRT3_F

#define M_SQRT3_F   (1.7320508075688772f) /* `sqrt(3)` */

Definition at line 79 of file math_base.h.

Referenced by TEST().

◆ M_SQRT_PI_8_F

#define M_SQRT_PI_8_F   (0.6266570686577501f) /* `sqrt(pi/8)` */

Definition at line 51 of file math_base.h.

Function Documentation

◆ __float_as_int()

ccl_device_inline int __float_as_int ( const float f)

Definition at line 257 of file math_base.h.

◆ __float_as_uint()

ccl_device_inline uint __float_as_uint ( const float f)

Definition at line 277 of file math_base.h.

◆ __int_as_float()

ccl_device_inline float __int_as_float ( const int i)

Definition at line 267 of file math_base.h.

◆ __uint_as_float()

ccl_device_inline float __uint_as_float ( const uint i)

Definition at line 287 of file math_base.h.

◆ abs()

ccl_device_inline int abs ( const int x)

Definition at line 115 of file math_base.h.

References x.

◆ as_int()

ccl_device_inline int as_int ( const uint i)

Definition at line 226 of file math_base.h.

Referenced by ANIM_channel_debug_print_info(), and BM_mesh_intersect_edges().

◆ as_uint() [1/2]

ccl_device_inline uint as_uint ( const float f)

Definition at line 246 of file math_base.h.

◆ as_uint() [2/2]

ccl_device_inline uint as_uint ( const int i)

Definition at line 236 of file math_base.h.

Referenced by emit_attribute_map_entry().

◆ beta()

◆ bits_to_01()

ccl_device float bits_to_01 ( const uint bits)

Definition at line 661 of file math_base.h.

◆ ceil_to_int()

ccl_device_inline int ceil_to_int ( const float f)

Definition at line 424 of file math_base.h.

References ceilf, and float_to_int().

Referenced by RenderScheduler::calculate_resolution_divider_for_time().

◆ clamp() [1/2]

ccl_device_inline float clamp ( const float a,
const float mn,
const float mx )

Definition at line 367 of file math_base.h.

References max, and min.

◆ clamp() [2/2]

ccl_device_inline int clamp ( const int a,
const int mn,
const int mx )

Definition at line 362 of file math_base.h.

References max, and min.

Referenced by safe_acosf(), safe_asinf(), and saturatef().

◆ compare_floats()

ccl_device_inline bool compare_floats ( const float a,
const float b,
float abs_diff,
const int ulp_diff )

Definition at line 754 of file math_base.h.

References __float_as_int, abs, b, and fabsf.

◆ compatible_atan2()

ccl_device_inline float compatible_atan2 ( const float y,
const float x )

Definition at line 471 of file math_base.h.

References atan2f, x, and y.

Referenced by svm_math().

◆ compatible_powf()

ccl_device float compatible_powf ( const float x,
const float y )

Definition at line 548 of file math_base.h.

References fmodf, powf, x, and y.

Referenced by safe_powf().

◆ compatible_signf()

ccl_device_inline float compatible_signf ( const float f)

Definition at line 477 of file math_base.h.

References signf().

◆ cos_from_sin()

◆ count_leading_zeros()

ccl_device_inline uint count_leading_zeros ( const uint x)

Definition at line 692 of file math_base.h.

References assert, and x.

Referenced by find_first_set(), hash_shuffle_uint(), next_power_of_two(), prev_power_of_two(), and sobol_burley().

◆ count_trailing_zeros()

ccl_device_inline uint count_trailing_zeros ( const uint x)

Definition at line 712 of file math_base.h.

References assert, and x.

◆ cubic_interp()

ccl_device_inline float cubic_interp ( const float a,
const float b,
float c,
const float d,
float x )

Definition at line 513 of file math_base.h.

References b, and x.

Referenced by interpolate_ies_vertical(), and kernel_ies_interp().

◆ ensure_finite()

ccl_device_inline float ensure_finite ( const float v)

◆ find_first_set()

ccl_device_inline uint find_first_set ( const uint x)

Definition at line 732 of file math_base.h.

References count_leading_zeros(), and x.

◆ float_to_int()

◆ floor_to_int()

ccl_device_inline int floor_to_int ( const float f)

Definition at line 412 of file math_base.h.

References float_to_int(), and floorf.

Referenced by HdCyclesDelegate::GetRenderStats(), and svm_brick().

◆ floorfrac()

ccl_device_inline float floorfrac ( const float x,
ccl_private int * i )

Definition at line 417 of file math_base.h.

References float_to_int(), floorf, and x.

Referenced by perlin_1d(), perlin_2d(), perlin_3d(), and perlin_4d().

◆ fractf()

ccl_device_inline float fractf ( const float x)

Definition at line 429 of file math_base.h.

References floorf, and x.

Referenced by pingpongf().

◆ interp()

ccl_device_inline float interp ( const float a,
const float b,
const float t )

Definition at line 502 of file math_base.h.

References b.

Referenced by camera_sample_perspective(), ClipSegmentToLine(), CurvesNode::constant_fold(), InvertNode::constant_fold(), CustomData_data_transfer(), data_transfer_layersmapping_add_item(), data_transfer_layersmapping_add_item_cd(), data_transfer_layersmapping_cdlayers(), data_transfer_layersmapping_cdlayers_multisrc_to_dst(), data_transfer_layersmapping_generate(), LinearQuadPatch::eval(), film_apply_pass_pixel_overlays_rgba(), SkyTextureNode::get_sun_average_radiance(), blender::io::usd::import_mesh_skel_bindings(), CCL_NAMESPACE_BEGIN::TextureInterpolator< TexT, OutT >::interp_3d(), CCL_NAMESPACE_BEGIN::kernel_tex_image_interp_3d(), kernel_tex_image_interp_3d(), SubPatch::map_uv(), meshcache_read_mdd_range(), meshcache_read_pc2_range(), MOD_meshcache_calc_range(), MOD_meshcache_read_mdd_frame(), MOD_meshcache_read_mdd_times(), MOD_meshcache_read_pc2_frame(), MOD_meshcache_read_pc2_times(), paint_sample_color(), blender::draw::particle_key_weight(), project_paint_PickColor(), SubdAttributeInterpolation::setup_attribute_corner_linear(), SubdAttributeInterpolation::setup_attribute_vertex_linear(), SKY_arhosekskymodel_radiance(), sky_radiance_nishita(), svm_math_wavelength_color_xyz(), svm_mix_add(), svm_mix_blend(), svm_mix_color(), svm_mix_dark(), svm_mix_diff(), svm_mix_exclusion(), svm_mix_hue(), svm_mix_light(), svm_mix_mul(), svm_mix_sub(), blender::gpu::to_string(), to_string(), blender::gpu::to_string_msl(), and AnimationImporter::write_animation().

◆ intervals_intersection()

template<typename T >
ccl_device_inline Interval< T > intervals_intersection ( const ccl_private Interval< T > & first,
const ccl_private Interval< T > & second )

Definition at line 886 of file math_base.h.

References max, and min.

Referenced by bsdf_hair_huang_eval(), ray_cone_intersect(), and ray_infinite_cylinder_intersect().

◆ inverse_lerp()

ccl_device_inline float inverse_lerp ( const float a,
const float b,
const float x )

◆ inversesqrtf()

◆ isfinite_safe()

◆ isnan_safe()

ccl_device_inline bool isnan_safe ( const float f)

Definition at line 342 of file math_base.h.

References __float_as_uint, and x.

Referenced by bsdf_hair_huang_eval(), and fresnel_dielectric_polarized().

◆ make_zero() [1/2]

◆ make_zero() [2/2]

ccl_device_template_spec float make_zero ( )

Definition at line 218 of file math_base.h.

◆ max() [1/6]

ccl_device_inline double max ( const double a,
const double b )

Definition at line 179 of file math_base.h.

References b.

◆ max() [2/6]

ccl_device_inline float max ( const float a,
const float b )

Definition at line 169 of file math_base.h.

References b.

◆ max() [3/6]

ccl_device_inline int max ( const int a,
const int b )

Definition at line 120 of file math_base.h.

References b.

◆ max() [4/6]

ccl_device_inline uint32_t max ( const uint32_t a,
const uint32_t b )

Definition at line 130 of file math_base.h.

References b.

◆ max() [5/6]

ccl_device_inline uint64_t max ( const uint64_t a,
const uint64_t b )

Definition at line 140 of file math_base.h.

References b.

◆ max() [6/6]

template<class T >
ccl_device_inline std::enable_if_t< std::is_same_v< T, size_t >, T > max ( T a,
T b )
constexpr

Definition at line 158 of file math_base.h.

References b.

◆ max4() [1/2]

ccl_device_inline float max4 ( const float a,
const float b,
float c,
const float d )

Definition at line 211 of file math_base.h.

References b, and max.

◆ max4() [2/2]

template<typename T >
ccl_device_inline T max4 ( const T & a,
const T & b,
const T & c,
const T & d )

Definition at line 200 of file math_base.h.

References b, and max.

Referenced by bvh_aligned_node_intersect(), and bvh_unaligned_node_intersect_child().

◆ min() [1/6]

ccl_device_inline double min ( const double a,
const double b )

Definition at line 184 of file math_base.h.

References b.

◆ min() [2/6]

ccl_device_inline float min ( const float a,
const float b )

Definition at line 174 of file math_base.h.

References b.

◆ min() [3/6]

ccl_device_inline int min ( const int a,
const int b )

Definition at line 125 of file math_base.h.

References b.

◆ min() [4/6]

ccl_device_inline uint32_t min ( const uint32_t a,
const uint32_t b )

Definition at line 135 of file math_base.h.

References b.

◆ min() [5/6]

ccl_device_inline uint64_t min ( const uint64_t a,
const uint64_t b )

Definition at line 145 of file math_base.h.

References b.

◆ min() [6/6]

template<class T >
ccl_device_inline std::enable_if_t< std::is_same_v< T, size_t >, T > min ( T a,
T b )
constexpr

Definition at line 164 of file math_base.h.

References b.

◆ min4() [1/2]

ccl_device_inline float min4 ( const float a,
const float b,
float c,
const float d )

Definition at line 206 of file math_base.h.

References b, and min.

◆ min4() [2/2]

template<typename T >
ccl_device_inline T min4 ( const T & a,
const T & b,
const T & c,
const T & d )

Definition at line 195 of file math_base.h.

References b, and min.

Referenced by bvh_aligned_node_intersect(), and bvh_unaligned_node_intersect_child().

◆ mix()

ccl_device_inline float mix ( const float a,
const float b,
float t )

Definition at line 372 of file math_base.h.

References b.

◆ mod()

ccl_device_inline int mod ( const int x,
const int m )

Definition at line 497 of file math_base.h.

References x.

◆ next_power_of_two()

ccl_device_inline uint next_power_of_two ( const uint x)

Definition at line 771 of file math_base.h.

References count_leading_zeros(), and x.

Referenced by round_num_samples_to_power_of_2(), round_up_to_power_of_two(), and TEST().

◆ nonzerof()

ccl_device_inline float nonzerof ( const float f,
const float eps )

Definition at line 460 of file math_base.h.

References eps, fabsf, and signf().

◆ one_minus_cos()

◆ operator/=()

template<typename T1 , typename T2 >
ccl_device_inline Interval< T1 > operator/= ( ccl_private Interval< T1 > & interval,
const T2 f )

Definition at line 877 of file math_base.h.

References Interval< T >::min.

◆ pingpongf()

ccl_device_inline float pingpongf ( const float a,
const float b )

Definition at line 441 of file math_base.h.

References b, fabsf, and fractf().

◆ pointer_pack_to_uint_0()

template<typename T >
ccl_device_inline uint pointer_pack_to_uint_0 ( T * ptr)

Definition at line 311 of file math_base.h.

References ptr.

Referenced by scene_intersect(), and scene_intersect_shadow().

◆ pointer_pack_to_uint_1()

template<typename T >
ccl_device_inline uint pointer_pack_to_uint_1 ( T * ptr)

Definition at line 316 of file math_base.h.

References ptr.

Referenced by scene_intersect(), and scene_intersect_shadow().

◆ pointer_unpack_from_uint()

template<typename T >
ccl_device_inline T * pointer_unpack_from_uint ( const uint a,
const uint b )

Definition at line 321 of file math_base.h.

References b.

Referenced by get_payload_ptr_0(), and get_payload_ptr_2().

◆ popcount()

ccl_device_inline uint popcount ( const uint x)

◆ pow20()

ccl_device_inline float pow20 ( const float a)

Definition at line 627 of file math_base.h.

References sqr().

◆ pow22()

ccl_device_inline float pow22 ( const float a)

Definition at line 632 of file math_base.h.

References sqr().

◆ prev_power_of_two()

ccl_device_inline uint prev_power_of_two ( const uint x)

Definition at line 777 of file math_base.h.

References count_leading_zeros(), and x.

Referenced by round_down_to_power_of_two(), and TEST().

◆ reverse_integer_bits()

◆ safe_acosf()

◆ safe_asinf()

◆ safe_divide()

◆ safe_floored_modulo()

ccl_device float safe_floored_modulo ( const float a,
const float b )

Definition at line 595 of file math_base.h.

References b, and floorf.

◆ safe_logf()

ccl_device float safe_logf ( const float a,
const float b )

◆ safe_modulo()

ccl_device float safe_modulo ( const float a,
const float b )

Definition at line 590 of file math_base.h.

References b, and fmodf.

◆ safe_powf()

◆ safe_sqrtf()

◆ saturatef()

ccl_device_inline float saturatef ( const float a)

Definition at line 401 of file math_base.h.

References clamp().

◆ signf()

◆ sin_from_cos()

◆ sin_sqr_to_one_minus_cos()

ccl_device_inline float sin_sqr_to_one_minus_cos ( const float s_sq)

Definition at line 615 of file math_base.h.

References safe_sqrtf().

Referenced by point_light_sample(), sphere_light_pdf(), spot_light_pdf(), and spot_light_sample().

◆ smoothminf()

ccl_device_inline float smoothminf ( const float a,
const float b,
float k )

Definition at line 446 of file math_base.h.

References b, fabsf, fmaxf, and fminf.

◆ smoothstep()

ccl_device_inline float smoothstep ( const float edge0,
const float edge1,
const float x )

Definition at line 377 of file math_base.h.

References result, and x.

◆ smoothstepf()

ccl_device_inline float smoothstepf ( const float f)

Definition at line 485 of file math_base.h.

Referenced by spot_light_attenuation(), spot_light_tree_parameters(), and svm_brick().

◆ solve_quadratic()

ccl_device_inline bool solve_quadratic ( const float a,
const float b,
const float c,
ccl_private float & x1,
ccl_private float & x2 )

Definition at line 827 of file math_base.h.

References b, copysignf, fmaxf, fminf, safe_sqrtf(), and sqr().

Referenced by ray_cone_intersect(), and ray_infinite_cylinder_intersect().

◆ sqr()

ccl_device_inline float sqr ( const float a)

Definition at line 600 of file math_base.h.

Referenced by arc_length(), Light::area(), area_light_rect_sample(), area_light_sample(), area_light_spread_clamp_light(), area_light_valid_ray_segment(), atmosphere_intersection(), bessel_I0(), bsdf_aniso_D(), bsdf_aniso_lambda(), bsdf_D(), bsdf_get_roughness_pass_squared(), bsdf_hair_chiang_eval(), bsdf_hair_chiang_sample(), bsdf_hair_huang_albedo(), bsdf_hair_huang_eval_r(), bsdf_hair_huang_eval_residual(), bsdf_hair_huang_eval_trrt(), bsdf_hair_huang_sample(), bsdf_lambda(), bsdf_microfacet_eval(), bsdf_microfacet_sample(), bsdf_oren_nayar_G(), bsdf_oren_nayar_setup(), bsdf_sheen_eval(), bsdf_sheen_sample(), bump_shadowing_term(), color_highlight_compress(), compute_v(), computeBindWeights(), cos_from_sin(), cos_theta(), LightManager::device_update_lights(), ensure_valid_specular_reflection(), F0_from_ior(), fresnel_dielectric_polarized(), fresnel_f82_B(), fresnel_f82tint_B(), SkyTextureNode::get_sun_average_radiance(), hair_alpha_angles(), hair_attenuation(), ior_parametrization(), iridescence_airy_summation(), iridescence_lookup_sensitivity(), light_tree_importance(), logistic(), microfacet_beckmann_sample_vndf(), microfacet_fresnel(), microfacet_ggx_sample_vndf(), mnee_eval_bsdf_contribution(), mnee_path_contribution(), one_minus_cos(), phase_draine(), phase_draine_sample_cos(), phase_fournier_forand_delta(), phase_fournier_forand_impl(), phase_fournier_forand_newton(), phase_henyey_greenstein(), phase_henyey_greenstein_sample(), phase_mie(), phase_mie_fitted_parameters(), phase_rayleigh(), phase_rayleigh(), phase_rayleigh_sample(), point_light_mnee_sample_update(), point_light_sample(), point_light_sample_from_intersection(), point_light_tree_parameters(), pow20(), pow22(), precompute_ggx_E(), precompute_ggx_gen_schlick_s(), precompute_ggx_glass_E(), ray_cone_intersect(), ray_disk_intersect(), sin_from_cos(), SKY_nishita_skymodel_precompute_texture(), sky_radiance_nishita(), solve_quadratic(), sphg_dir(), spot_light_mnee_sample_update(), spot_light_sample(), spot_light_sample_from_intersection(), spot_light_tree_parameters(), spot_light_valid_ray_segment(), surface_intersection(), surface_shader_prepare_closures(), svm_node_closure_bsdf(), and svm_node_principled_volume().

◆ uint16_pack_to_uint()

ccl_device_inline uint uint16_pack_to_uint ( const uint a,
const uint b )

Definition at line 326 of file math_base.h.

References b.

Referenced by __anyhit__kernel_optix_shadow_all_hit().

◆ uint16_unpack_from_uint_0()

ccl_device_inline uint uint16_unpack_from_uint_0 ( const uint i)

Definition at line 331 of file math_base.h.

Referenced by __anyhit__kernel_optix_shadow_all_hit().

◆ uint16_unpack_from_uint_1()

ccl_device_inline uint uint16_unpack_from_uint_1 ( const uint i)

Definition at line 336 of file math_base.h.

Referenced by __anyhit__kernel_optix_shadow_all_hit().

◆ wrapf()

ccl_device_inline float wrapf ( const float value,
const float max,
const float min )

Definition at line 435 of file math_base.h.

References floorf, max, min, range, and value.

◆ xor_signmask()

ccl_device_inline float xor_signmask ( const float x,
const int y )

Definition at line 656 of file math_base.h.

References __float_as_int, __int_as_float, x, and y.

Referenced by isect_ray_tri_watertight_v3().