2022-02-11 13:53:21 +01:00
|
|
|
/* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
* Copyright 2011-2022 Blender Foundation */
|
2011-04-27 11:58:34 +00:00
|
|
|
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
#pragma once
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
|
#define __KERNEL_CPU__
|
|
|
|
|
|
2015-02-12 23:51:02 +11:00
|
|
|
/* Release kernel has too much false-positive maybe-uninitialized warnings,
|
2015-02-02 21:13:41 +05:00
|
|
|
* which makes it possible to miss actual warnings.
|
|
|
|
|
*/
|
2015-10-25 20:48:28 +01:00
|
|
|
#if (defined(__GNUC__) && !defined(__clang__)) && defined(NDEBUG)
|
2015-02-02 21:13:41 +05:00
|
|
|
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
2015-06-13 16:17:55 +02:00
|
|
|
# pragma GCC diagnostic ignored "-Wuninitialized"
|
2015-02-02 21:13:41 +05:00
|
|
|
#endif
|
|
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "util/half.h"
|
|
|
|
|
#include "util/math.h"
|
|
|
|
|
#include "util/simd.h"
|
|
|
|
|
#include "util/texture.h"
|
|
|
|
|
#include "util/types.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2014-11-07 13:35:45 +05:00
|
|
|
/* On x86_64, versions of glibc < 2.16 have an issue where expf is
|
|
|
|
|
* much slower than the double version. This was fixed in glibc 2.16.
|
2014-10-06 13:43:23 +06:00
|
|
|
*/
|
2014-11-07 13:35:45 +05:00
|
|
|
#if !defined(__KERNEL_GPU__) && defined(__x86_64__) && defined(__x86_64__) && \
|
|
|
|
|
defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \
|
|
|
|
|
(__GLIBC__ <= 2 && __GLIBC_MINOR__ < 16)
|
2014-10-08 00:02:46 +02:00
|
|
|
# define expf(x) ((float)exp((double)(x)))
|
2014-10-06 13:43:23 +06:00
|
|
|
#endif
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
|
|
/* Assertions inside the kernel only work for the CPU device, so we wrap it in
|
2012-06-09 17:22:52 +00:00
|
|
|
* a macro which is empty for other devices */
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
|
#define kernel_assert(cond) assert(cond)
|
|
|
|
|
|
|
|
|
|
/* Macros to handle different memory storage on different devices */
|
|
|
|
|
|
2014-12-16 20:27:44 +05:00
|
|
|
#ifdef __KERNEL_SSE2__
|
|
|
|
|
typedef vector3<sseb> sse3b;
|
|
|
|
|
typedef vector3<ssef> sse3f;
|
|
|
|
|
typedef vector3<ssei> sse3i;
|
2015-02-11 00:20:34 +05:00
|
|
|
|
|
|
|
|
ccl_device_inline void print_sse3b(const char *label, sse3b &a)
|
|
|
|
|
{
|
|
|
|
|
print_sseb(label, a.x);
|
|
|
|
|
print_sseb(label, a.y);
|
|
|
|
|
print_sseb(label, a.z);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ccl_device_inline void print_sse3f(const char *label, sse3f &a)
|
|
|
|
|
{
|
|
|
|
|
print_ssef(label, a.x);
|
|
|
|
|
print_ssef(label, a.y);
|
|
|
|
|
print_ssef(label, a.z);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ccl_device_inline void print_sse3i(const char *label, sse3i &a)
|
|
|
|
|
{
|
|
|
|
|
print_ssei(label, a.x);
|
|
|
|
|
print_ssei(label, a.y);
|
|
|
|
|
print_ssei(label, a.z);
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-14 11:23:30 +01:00
|
|
|
# if defined(__KERNEL_AVX__) || defined(__KERNEL_AVX2__)
|
|
|
|
|
typedef vector3<avxf> avx3f;
|
|
|
|
|
# endif
|
|
|
|
|
|
2014-12-16 20:27:44 +05:00
|
|
|
#endif
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
CCL_NAMESPACE_END
|