Cycles: fix rendering with Nishita Sky Texture on Intel Arc GPUs

Speckles and missing lights were experienced in scenes with Nishita Sky
Texture and a Sun Size smaller than 1.5°, such as in Lone Monk and Attic
scenes.
Increasing the precision of cosf fixes it.
This commit is contained in:
Xavier Hallade 2023-01-23 16:22:24 +01:00
parent 6279042d21
commit 1c90f8209d
Notes: blender-bot 2023-02-15 14:32:30 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3
Referenced by pull request #104781, Cycles: fix rendering with Nishita Sky Texture on Intel Arc GPUs in 3.3
1 changed files with 9 additions and 1 deletions

View File

@ -195,7 +195,15 @@ using sycl::half;
#define fmodf(x, y) sycl::fmod((x), (y))
#define lgammaf(x) sycl::lgamma((x))
#define cosf(x) sycl::native::cos(((float)(x)))
/* sycl::native::cos precision is not sufficient and -ffast-math lets
* the current DPC++ compiler overload sycl::cos with it.
* We work around this issue by directly calling the spirv implementation which
* provides greater precision. */
#if defined(__SYCL_DEVICE_ONLY__) && defined(__SPIR__)
# define cosf(x) __spirv_ocl_cos(((float)(x)))
#else
# define cosf(x) sycl::cos(((float)(x)))
#endif
#define sinf(x) sycl::native::sin(((float)(x)))
#define powf(x, y) sycl::native::powr(((float)(x)), ((float)(y)))
#define tanf(x) sycl::native::tan(((float)(x)))