[Bf-blender-cvs] [f31cef6248f] cycles_oneapi: Merge branch 'master' into cycles_oneapi
Sergey Sharybin
noreply at git.blender.org
Wed Jun 8 11:11:42 CEST 2022
Commit: f31cef6248fd12039a4d2dfb76b26f3426477a70
Author: Sergey Sharybin
Date: Wed Jun 8 10:58:35 2022 +0200
Branches: cycles_oneapi
https://developer.blender.org/rBf31cef6248fd12039a4d2dfb76b26f3426477a70
Merge branch 'master' into cycles_oneapi
===================================================================
===================================================================
diff --cc intern/cycles/util/half.h
index af33264e044,434bc12d670..c668638eb02
--- a/intern/cycles/util/half.h
+++ b/intern/cycles/util/half.h
@@@ -73,10 -73,10 +73,10 @@@ struct half4
ccl_device_inline half float_to_half_image(float f)
{
-#if defined(__KERNEL_METAL__)
+#if defined(__KERNEL_METAL__) || defined(__KERNEL_ONEAPI__)
- return half(f);
+ return half(min(f, 65504.0f));
#elif defined(__KERNEL_CUDA__) || defined(__KERNEL_HIP__)
- return __float2half(f);
+ return __float2half(min(f, 65504.0f));
#else
const uint u = __float_as_uint(f);
/* Sign bit, shifted to its position. */
@@@ -138,10 -136,10 +138,10 @@@ ccl_device_inline float4 half4_to_float
ccl_device_inline half float_to_half_display(const float f)
{
-#if defined(__KERNEL_METAL__)
+#if defined(__KERNEL_METAL__) || defined(__KERNEL_ONEAPI__)
- return half(f);
+ return half(min(f, 65504.0f));
#elif defined(__KERNEL_CUDA__) || defined(__KERNEL_HIP__)
- return __float2half(f);
+ return __float2half(min(f, 65504.0f));
#else
const int x = __float_as_int((f > 0.0f) ? ((f < 65504.0f) ? f : 65504.0f) : 0.0f);
const int absolute = x & 0x7FFFFFFF;
More information about the Bf-blender-cvs
mailing list