Cleanup: simplify kernel features definition.

No functional changes, logic here got too complex after many changes over
the years.
This commit is contained in:
Brecht Van Lommel 2019-03-16 16:45:50 +01:00
parent e17f7af0ce
commit 9873005ecd
3 changed files with 35 additions and 75 deletions

View File

@ -184,7 +184,7 @@ string OpenCLDevice::get_build_options(const DeviceRequestedFeatures& requested_
if (preview_kernel) {
DeviceRequestedFeatures preview_features;
preview_features.use_hair = true;
build_options += "-D__KERNEL_OPENCL_PREVIEW__ ";
build_options += "-D__KERNEL_AO_PREVIEW__ ";
build_options += preview_features.get_build_options();
}
else if (opencl_program_name == "split_do_volume" && !requested_features.use_volume) {

View File

@ -125,7 +125,7 @@
#define fmodf(x, y) fmod((float)(x), (float)(y))
#define sinhf(x) sinh(((float)(x)))
#ifndef __CL_USE_NATIVE__
#if !(defined(__KERNEL_OPENCL_AMD__) || defined(__KERNEL_OPENCL_INTEL_CPU__))
# define sinf(x) native_sin(((float)(x)))
# define cosf(x) native_cos(((float)(x)))
# define tanf(x) native_tan(((float)(x)))

View File

@ -83,76 +83,6 @@ CCL_NAMESPACE_BEGIN
# define SHADER_SORT_LOCAL_SIZE 1
#endif
/* Device capabilities */
#ifdef __KERNEL_CPU__
# ifdef __KERNEL_SSE2__
# define __QBVH__
# endif
# define __KERNEL_SHADING__
# define __BRANCHED_PATH__
# ifdef WITH_OSL
# define __OSL__
# endif
# define __PRINCIPLED__
# define __SUBSURFACE__
# define __CMJ__
# define __VOLUME__
# define __VOLUME_SCATTER__
# define __SHADOW_RECORD_ALL__
# define __VOLUME_DECOUPLED__
# define __VOLUME_RECORD_ALL__
#endif /* __KERNEL_CPU__ */
#ifdef __KERNEL_CUDA__
# define __KERNEL_SHADING__
# define __VOLUME__
# define __VOLUME_SCATTER__
# define __SUBSURFACE__
# define __PRINCIPLED__
# define __SHADOW_RECORD_ALL__
# define __CMJ__
# ifndef __SPLIT_KERNEL__
# define __BRANCHED_PATH__
# endif
#endif /* __KERNEL_CUDA__ */
#ifdef __KERNEL_OPENCL__
# if defined(__KERNEL_OPENCL_AMD__) || defined(__KERNEL_OPENCL_INTEL_CPU__)
# define __CL_USE_NATIVE__
# endif
/* Preview kernel is used as a small kernel when the optimized kernel is still being compiled. */
# ifdef __KERNEL_OPENCL_PREVIEW__
# define __AO__
# define __PASSES__
# define __HAIR__
# else
# define __KERNEL_SHADING__
# define __PRINCIPLED__
# define __CMJ__
# ifdef __KERNEL_OPENCL_NVIDIA__
# define __SUBSURFACE__
# define __VOLUME__
# define __VOLUME_SCATTER__
# define __SHADOW_RECORD_ALL__
# define __BRANCHED_PATH__
# endif /* __KERNEL_OPENCL_NVIDIA__ */
# ifdef __KERNEL_OPENCL_AMD__
# define __SUBSURFACE__
# define __VOLUME__
# define __VOLUME_SCATTER__
# define __SHADOW_RECORD_ALL__
# define __BRANCHED_PATH__
# endif /* __KERNEL_OPENCL_AMD__ */
# endif /* KERNEL_OPENCL_PREVIEW__ */
#endif /* __KERNEL_OPENCL__ */
/* Kernel features */
#define __SOBOL__
#define __INSTANCING__
@ -169,8 +99,12 @@ CCL_NAMESPACE_BEGIN
#define __SHADOW_TRICKS__
#define __DENOISING_FEATURES__
#define __SHADER_RAYTRACE__
#define __AO__
#define __PASSES__
#define __HAIR__
#ifdef __KERNEL_SHADING__
/* Without these we get an AO render, used by OpenCL preview kernel. */
#ifndef __KERNEL_AO_PREVIEW__
# define __SVM__
# define __EMISSION__
# define __TEXTURES__
@ -178,16 +112,42 @@ CCL_NAMESPACE_BEGIN
# define __HOLDOUT__
# define __MULTI_CLOSURE__
# define __TRANSPARENT_SHADOWS__
# define __PASSES__
# define __BACKGROUND_MIS__
# define __LAMP_MIS__
# define __AO__
# define __CAMERA_MOTION__
# define __OBJECT_MOTION__
# define __HAIR__
# define __BAKING__
# define __PRINCIPLED__
# define __SUBSURFACE__
# define __VOLUME__
# define __VOLUME_SCATTER__
# define __CMJ__
# define __SHADOW_RECORD_ALL__
# define __BRANCHED_PATH__
#endif
/* Device specific features */
#ifdef __KERNEL_CPU__
# ifdef __KERNEL_SSE2__
# define __QBVH__
# endif
# ifdef WITH_OSL
# define __OSL__
# endif
# define __VOLUME_DECOUPLED__
# define __VOLUME_RECORD_ALL__
#endif /* __KERNEL_CPU__ */
#ifdef __KERNEL_CUDA__
# ifdef __SPLIT_KERNEL__
# undef __BRANCHED_PATH__
# endif
#endif /* __KERNEL_CUDA__ */
#ifdef __KERNEL_OPENCL__
#endif /* __KERNEL_OPENCL__ */
/* Scene-based selective features compilation. */
#ifdef __NO_CAMERA_MOTION__
# undef __CAMERA_MOTION__