From 400e6f37b80dde3910b8d7a9d5e619b778a1c1ff Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 23 Aug 2017 03:57:27 +0200 Subject: Cycles: reduce subsurface stack memory usage. This is done by storing only a subset of PathRadiance, and by storing direct light immediately in the main PathRadiance. Saves about 10% of CUDA stack memory, and simplifies subsurface indirect ray code. --- intern/cycles/kernel/kernel_path.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'intern/cycles/kernel/kernel_path.h') diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index d43d6374c13..793fede0deb 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -222,7 +222,7 @@ ccl_device_forceinline VolumeIntegrateResult kernel_path_volume( kernel_volume_decoupled_free(kg, &volume_segment); if(result == VOLUME_PATH_SCATTERED) { - if(kernel_path_volume_bounce(kg, sd, throughput, state, L, ray)) + if(kernel_path_volume_bounce(kg, sd, throughput, state, &L->state, ray)) return VOLUME_PATH_SCATTERED; else return VOLUME_PATH_MISSED; @@ -244,7 +244,7 @@ ccl_device_forceinline VolumeIntegrateResult kernel_path_volume( kernel_path_volume_connect_light(kg, sd, emission_sd, *throughput, state, L); /* indirect light bounce */ - if(kernel_path_volume_bounce(kg, sd, throughput, state, L, ray)) + if(kernel_path_volume_bounce(kg, sd, throughput, state, &L->state, ray)) return VOLUME_PATH_SCATTERED; else return VOLUME_PATH_MISSED; @@ -519,7 +519,7 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg, } #endif /* defined(__EMISSION__) */ - if(!kernel_path_surface_bounce(kg, sd, &throughput, state, L, ray)) + if(!kernel_path_surface_bounce(kg, sd, &throughput, state, &L->state, ray)) break; } } @@ -648,13 +648,11 @@ ccl_device_forceinline void kernel_path_integrate( kernel_path_surface_connect_light(kg, &sd, emission_sd, throughput, state, L); /* compute direct lighting and next bounce */ - if(!kernel_path_surface_bounce(kg, &sd, &throughput, state, L, ray)) + if(!kernel_path_surface_bounce(kg, &sd, &throughput, state, &L->state, ray)) break; } #ifdef __SUBSURFACE__ - kernel_path_subsurface_accum_indirect(&ss_indirect, L); - /* Trace indirect subsurface rays by restarting the loop. this uses less * stack memory than invoking kernel_path_indirect. */ -- cgit v1.2.3