diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-10-21 20:25:38 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-10-22 14:03:03 +0300 |
commit | 282516e53eba9bb3aaddd67b2b099fea98bd4c1f (patch) | |
tree | 32fc55a41ea26bb4e8237db6924fa78176641760 /intern/cycles/kernel/device/cuda/compat.h | |
parent | 65dbeb1d81bff6c5742eb5f503b59207485041a9 (diff) |
Cleanup: refactor float/half conversions for clarity
Diffstat (limited to 'intern/cycles/kernel/device/cuda/compat.h')
-rw-r--r-- | intern/cycles/kernel/device/cuda/compat.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/intern/cycles/kernel/device/cuda/compat.h b/intern/cycles/kernel/device/cuda/compat.h index 685c7a5b753..8a50eb1a3d5 100644 --- a/intern/cycles/kernel/device/cuda/compat.h +++ b/intern/cycles/kernel/device/cuda/compat.h @@ -128,6 +128,13 @@ __device__ half __float2half(const float f) return val; } +__device__ float __half2float(const half h) +{ + float val; + asm("{ cvt.f32.f16 %0, %1;}\n" : "=f"(val) : "h"(h)); + return val; +} + /* Types */ #include "util/util_half.h" |