From 9873005ecd7c21e3a6d371833a64b3ce722a48ea Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 16 Mar 2019 16:45:50 +0100 Subject: Cleanup: simplify kernel features definition. No functional changes, logic here got too complex after many changes over the years. --- intern/cycles/kernel/kernel_compat_opencl.h | 2 +- intern/cycles/kernel/kernel_types.h | 106 +++++++++------------------- 2 files changed, 34 insertions(+), 74 deletions(-) (limited to 'intern/cycles/kernel') diff --git a/intern/cycles/kernel/kernel_compat_opencl.h b/intern/cycles/kernel/kernel_compat_opencl.h index 21a95098894..3bf8cdebf4a 100644 --- a/intern/cycles/kernel/kernel_compat_opencl.h +++ b/intern/cycles/kernel/kernel_compat_opencl.h @@ -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))) diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index e0bf9b054ac..4b1c8e82dfa 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -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__ -- cgit v1.2.3