diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-08-23 04:57:27 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-09-28 16:18:43 +0300 |
commit | 400e6f37b80dde3910b8d7a9d5e619b778a1c1ff (patch) | |
tree | 61ecd35d2231c0f7585dc0148638de00819638b5 /intern/cycles/kernel/kernel_types.h | |
parent | 9ddee885aea4d026bb0409a51a137706c95d318b (diff) |
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.
Diffstat (limited to 'intern/cycles/kernel/kernel_types.h')
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 1853fab1967..cd19d0f90bf 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -466,6 +466,18 @@ typedef struct DebugData { } DebugData; #endif +typedef ccl_addr_space struct PathRadianceState { +#ifdef __PASSES__ + float3 diffuse; + float3 glossy; + float3 transmission; + float3 subsurface; + float3 scatter; + + float3 direct; +#endif +} PathRadianceState; + typedef ccl_addr_space struct PathRadiance { #ifdef __PASSES__ int use_light_pass; @@ -478,7 +490,6 @@ typedef ccl_addr_space struct PathRadiance { float3 ao; float3 indirect; - float3 direct_throughput; float3 direct_emission; float3 color_diffuse; @@ -499,16 +510,12 @@ typedef ccl_addr_space struct PathRadiance { float3 indirect_subsurface; float3 indirect_scatter; - float3 path_diffuse; - float3 path_glossy; - float3 path_transmission; - float3 path_subsurface; - float3 path_scatter; - float4 shadow; float mist; #endif + PathRadianceState state; + #ifdef __SHADOW_TRICKS__ /* Total light reachable across the path, ignoring shadow blocked queries. */ float3 path_total; @@ -1032,8 +1039,7 @@ typedef struct PathState { /* Subsurface */ /* Struct to gather multiple SSS hits. */ -typedef struct SubsurfaceIntersection -{ +typedef struct SubsurfaceIntersection { Ray ray; float3 weight[BSSRDF_MAX_HITS]; @@ -1043,17 +1049,14 @@ typedef struct SubsurfaceIntersection } SubsurfaceIntersection; /* Struct to gather SSS indirect rays and delay tracing them. */ -typedef struct SubsurfaceIndirectRays -{ - bool need_update_volume_stack; - bool tracing; +typedef struct SubsurfaceIndirectRays { PathState state[BSSRDF_MAX_HITS]; - struct PathRadiance direct_L; int num_rays; + struct Ray rays[BSSRDF_MAX_HITS]; float3 throughputs[BSSRDF_MAX_HITS]; - struct PathRadiance L[BSSRDF_MAX_HITS]; + struct PathRadianceState L_state[BSSRDF_MAX_HITS]; } SubsurfaceIndirectRays; /* Constant Kernel Data |