diff options
author | Patrick Mours <pmours@nvidia.com> | 2020-12-03 14:19:36 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2020-12-04 15:04:11 +0300 |
commit | c10546f5e9fe2a300b6a21e1e16b22c93060d0e9 (patch) | |
tree | 59cd62f21fb10c08d9143ca640b44848f38584a8 /intern/cycles/kernel/kernel_subsurface.h | |
parent | 7f2d356a672d838c90cf47e9ff4006b15c104148 (diff) |
Cycles: Add support for shader raytracing in OptiX
Support for the AO and bevel shader nodes requires calling "optixTrace" from within the shading
VM, which is only allowed from inlined functions to the raygen program or callables. This patch
therefore converts the shading VM to use direct callables to make it work. To prevent performance
regressions a separate kernel module is compiled and used for this purpose.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D9733
Diffstat (limited to 'intern/cycles/kernel/kernel_subsurface.h')
-rw-r--r-- | intern/cycles/kernel/kernel_subsurface.h | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/intern/cycles/kernel/kernel_subsurface.h b/intern/cycles/kernel/kernel_subsurface.h index ed8572467ea..917f35d37dc 100644 --- a/intern/cycles/kernel/kernel_subsurface.h +++ b/intern/cycles/kernel/kernel_subsurface.h @@ -281,13 +281,28 @@ ccl_device_inline int subsurface_scatter_disk(KernelGlobals *kg, return num_eval_hits; } -ccl_device_noinline void subsurface_scatter_multi_setup(KernelGlobals *kg, - LocalIntersection *ss_isect, - int hit, - ShaderData *sd, - ccl_addr_space PathState *state, - ClosureType type, - float roughness) +#if defined(__KERNEL_OPTIX__) && defined(__SHADER_RAYTRACE__) +ccl_device_inline void subsurface_scatter_multi_setup(KernelGlobals *kg, + LocalIntersection *ss_isect, + int hit, + ShaderData *sd, + ccl_addr_space PathState *state, + ClosureType type, + float roughness) +{ + optixDirectCall<void>(2, kg, ss_isect, hit, sd, state, type, roughness); +} +extern "C" __device__ void __direct_callable__subsurface_scatter_multi_setup( +#else +ccl_device_noinline void subsurface_scatter_multi_setup( +#endif + KernelGlobals *kg, + LocalIntersection *ss_isect, + int hit, + ShaderData *sd, + ccl_addr_space PathState *state, + ClosureType type, + float roughness) { #ifdef __SPLIT_KERNEL__ Ray ray_object = ss_isect->ray; |