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_volume.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_volume.h')
-rw-r--r-- | intern/cycles/kernel/kernel_volume.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/intern/cycles/kernel/kernel_volume.h b/intern/cycles/kernel/kernel_volume.h index f5d10c0ca8a..fdf712293e7 100644 --- a/intern/cycles/kernel/kernel_volume.h +++ b/intern/cycles/kernel/kernel_volume.h @@ -274,11 +274,24 @@ ccl_device void kernel_volume_shadow_heterogeneous(KernelGlobals *kg, /* get the volume attenuation over line segment defined by ray, with the * assumption that there are no surfaces blocking light between the endpoints */ -ccl_device_noinline void kernel_volume_shadow(KernelGlobals *kg, - ShaderData *shadow_sd, - ccl_addr_space PathState *state, - Ray *ray, - float3 *throughput) +# if defined(__KERNEL_OPTIX__) && defined(__SHADER_RAYTRACE__) +ccl_device_inline void kernel_volume_shadow(KernelGlobals *kg, + ShaderData *shadow_sd, + ccl_addr_space PathState *state, + Ray *ray, + float3 *throughput) +{ + optixDirectCall<void>(1, kg, shadow_sd, state, ray, throughput); +} +extern "C" __device__ void __direct_callable__kernel_volume_shadow( +# else +ccl_device_noinline void kernel_volume_shadow( +# endif + KernelGlobals *kg, + ShaderData *shadow_sd, + ccl_addr_space PathState *state, + Ray *ray, + float3 *throughput) { shader_setup_from_volume(kg, shadow_sd, ray); |