Page MenuHome

Cycles: unify math functions names
ClosedPublic

Authored by Andrii Symkin (pembem22) on Jun 22 2022, 11:14 PM.

Details

Summary

This patch unifies the names of math functions for different data types and uses overloading instead. The goal is to make it possible to swap out all the float3 variables containing RGB data with something else, with as few as possible changes to the code. It's a requirement for future spectral rendering patches.

Renamed functions:

  • saturate3 -> saturate
  • sqr3 -> sqr
  • pow3 -> pow
  • exp3 -> exp
  • log3 -> log
  • isequal_float3 -> isequal
  • isfinite3_safe -> isfinite_safe
  • isfinite4_safe -> isfinite_safe
  • ensure_finite3 -> ensure_finite
  • ensure_finite4 -> ensure_finite
  • safe_divide_float3_float3 -> safe_divide
  • safe_divide_float3_float -> safe_divide
  • safe_divide_float4_float -> safe_divide
  • min3 -> reduce_min
  • max3 -> reduce_max
  • bsdf_eval_mul3 -> bsdf_eval_mul

Tested on CPU and CUDA.

Diff Detail

Repository
rB Blender
Branch
cycles-unify-math-functions
Build Status
Buildable 22645
Build 22645: arc lint + arc unit

Event Timeline

Andrii Symkin (pembem22) requested review of this revision.Jun 22 2022, 11:14 PM
Andrii Symkin (pembem22) created this revision.

Tested on AMD HIP, compiled fine and couldn't spot render issues.

With that patch applied though, it crashes for me on Metal M1. https://developer.blender.org/P3026

Seems to be working on all platforms.

This revision is now accepted and ready to land.Jun 23 2022, 3:04 PM

Thanks @Brecht Van Lommel (brecht), the crash on Metal is gone for me.

This revision was automatically updated to reflect the committed changes.