diff options
author | Thomas Dinges <blender@dingto.org> | 2014-08-21 01:15:30 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2014-08-21 01:15:30 +0400 |
commit | 187d77612bcc13a85c8017c872b99bccd7e8f28c (patch) | |
tree | e287b262815f4b10fc30242061a307b22bc4d95f /intern/cycles/kernel/kernel_path.h | |
parent | 075f6eff746b9fc6b1eabfccb213f02decd62fe8 (diff) |
Code refactor: Split __VOLUME__ defines in Cycles.
* __VOLUME__ is basic volume support with Emission and Absorption.
* __VOLUME_SCATTER__ enables volume Scattering support.
* __VOLUME_DECOUPLED__ enables Decoupled Ray Marching.
Diffstat (limited to 'intern/cycles/kernel/kernel_path.h')
-rw-r--r-- | intern/cycles/kernel/kernel_path.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index 7c06a895249..25c285e3def 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -90,6 +90,8 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, Ray ray, bool heterogeneous = volume_stack_is_heterogeneous(kg, state.volume_stack); int sampling_method = volume_stack_sampling_method(kg, state.volume_stack); + +#ifdef __VOLUME_DECOUPLED__ bool decoupled = kernel_volume_use_decoupled(kg, heterogeneous, false, sampling_method); if(decoupled) { @@ -141,12 +143,15 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, Ray ray, break; } } - else { + else +#endif + { /* integrate along volume segment with distance sampling */ ShaderData volume_sd; VolumeIntegrateResult result = kernel_volume_integrate( kg, &state, &volume_sd, &volume_ray, L, &throughput, rng); +#ifdef __VOLUME_SCATTER__ if(result == VOLUME_PATH_SCATTERED) { /* direct lighting */ kernel_path_volume_connect_light(kg, rng, &volume_sd, throughput, &state, L, 1.0f); @@ -157,6 +162,7 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, Ray ray, else break; } +#endif } } #endif @@ -471,6 +477,8 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, bool heterogeneous = volume_stack_is_heterogeneous(kg, state.volume_stack); int sampling_method = volume_stack_sampling_method(kg, state.volume_stack); + +#ifdef __VOLUME_DECOUPLED__ bool decoupled = kernel_volume_use_decoupled(kg, heterogeneous, true, sampling_method); if(decoupled) { @@ -522,12 +530,15 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, break; } } - else { + else +#endif + { /* integrate along volume segment with distance sampling */ ShaderData volume_sd; VolumeIntegrateResult result = kernel_volume_integrate( kg, &state, &volume_sd, &volume_ray, &L, &throughput, rng); +#ifdef __VOLUME_SCATTER__ if(result == VOLUME_PATH_SCATTERED) { /* direct lighting */ kernel_path_volume_connect_light(kg, rng, &volume_sd, throughput, &state, &L, 1.0f); @@ -538,6 +549,7 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, else break; } +#endif } } #endif @@ -804,7 +816,7 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in Ray volume_ray = ray; volume_ray.t = (hit)? isect.t: FLT_MAX; -#ifdef __KERNEL_CPU__ +#ifdef __VOLUME_DECOUPLED__ /* decoupled ray marching only supported on CPU */ bool heterogeneous = volume_stack_is_heterogeneous(kg, state.volume_stack); @@ -891,6 +903,7 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in VolumeIntegrateResult result = kernel_volume_integrate( kg, &ps, &volume_sd, &volume_ray, &L, &tp, rng); +#ifdef __VOLUME_SCATTER__ if(result == VOLUME_PATH_SCATTERED) { /* todo: support equiangular, MIS and all light sampling. * alternatively get decoupled ray marching working on the GPU */ @@ -905,6 +918,7 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in path_radiance_reset_indirect(&L); } } +#endif } /* todo: avoid this calculation using decoupled ray marching */ |