diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-02-04 17:25:29 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-02-04 17:29:58 +0300 |
commit | 3e7389eaf2d7ffbd180931c117776d3de2da5adb (patch) | |
tree | d63be65c92ad5b50e07f8e0425394d0add1aef62 /intern/cycles/kernel/kernel_types.h | |
parent | f250aa9d86a35ae8bb6692a85ffe04610924fb08 (diff) |
Cycles: Speedup of Christensen-Burley SSS falloff function
The idea is simply to pre-compute fitting and parameterization
in the bssrdf_setup() function and re-use the values in both
sample() and eval().
The only trick is where to store the pre-calculated values and
the answer is inside of ShaderClosure->custom{1,2,3}. There's
no memory bump here because we now simply re-use padding fields
for the pre-calculated values. Similar trick we can do for other
BSDFs.
Seems to give nice speedup up to 7% here on my desktop with
Core i7 CPU, SSE4.1 kernel.
Diffstat (limited to 'intern/cycles/kernel/kernel_types.h')
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 93ff732ca2f..42d40e1daee 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -642,7 +642,14 @@ typedef ccl_addr_space struct ShaderClosure { float data0; float data1; float data2; - int pad1, pad2, pad3; + + /* Following fields could be used to store pre-calculated + * values by various BSDF closures for more effective sampling + * and evaluation. + */ + float custom1; + float custom2; + float custom3; #ifdef __OSL__ void *prim, *pad4; |