diff options
author | William Leeson <leesonw> | 2021-10-27 14:28:13 +0300 |
---|---|---|
committer | William Leeson <william@blender.org> | 2021-10-27 15:05:46 +0300 |
commit | 7b1c5712f888ea37bbccafd9ffd7a3a6a61e665f (patch) | |
tree | 659551f820d8b70fe1c37ac6a8711fcd73cd7434 /intern/cycles/util | |
parent | 18b6f0d0f18732a071b75ad56a2475c383d19111 (diff) |
Cycles: Replace saturate with saturatef
saturate is depricated in favour of __saturatef this replaces saturate
with __saturatef on CUDA by createing a saturatef function which replaces
all instances of saturate and are hooked up to the correct function on all
platforms.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D13010
Diffstat (limited to 'intern/cycles/util')
-rw-r--r-- | intern/cycles/util/math.h | 7 | ||||
-rw-r--r-- | intern/cycles/util/math_float3.h | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/intern/cycles/util/math.h b/intern/cycles/util/math.h index e7fc492733f..e4c7df6e44a 100644 --- a/intern/cycles/util/math.h +++ b/intern/cycles/util/math.h @@ -347,10 +347,15 @@ ccl_device_inline float smoothstep(float edge0, float edge1, float x) } #ifndef __KERNEL_CUDA__ -ccl_device_inline float saturate(float a) +ccl_device_inline float saturatef(float a) { return clamp(a, 0.0f, 1.0f); } +#else +ccl_device_inline float saturatef(float a) +{ + return __saturatef(a); +} #endif /* __KERNEL_CUDA__ */ ccl_device_inline int float_to_int(float f) diff --git a/intern/cycles/util/math_float3.h b/intern/cycles/util/math_float3.h index e780d7e0a7c..81550c5d03c 100644 --- a/intern/cycles/util/math_float3.h +++ b/intern/cycles/util/math_float3.h @@ -408,7 +408,7 @@ ccl_device_inline float3 project(const float3 v, const float3 v_proj) ccl_device_inline float3 saturate3(float3 a) { - return make_float3(saturate(a.x), saturate(a.y), saturate(a.z)); + return make_float3(saturatef(a.x), saturatef(a.y), saturatef(a.z)); } ccl_device_inline float3 normalize_len(const float3 a, ccl_private float *t) |