diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-05-17 13:30:46 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-05-18 11:14:24 +0300 |
commit | 7b356a856540a1affa5dc85360183418e6337a5a (patch) | |
tree | 9acee7019c696f694c97d504e1a2fe678a7f0cd1 /intern/cycles/kernel/kernel_globals.h | |
parent | 2433a537fa12dad6cc8a1c323b1b73e5cad6cd4d (diff) |
Cycles: Reduce amount of malloc() calls from the kernel
This commit makes it so malloc() is only happening once per volume and
once per transparent shadow query (per thread), improving scalability of
the code to multiple CPU cores.
Hard to measure this with a low-bottom i7 here currently, but from quick
tests seems volume sampling gave about 3-5% speedup.
The idea is to store allocated memory in kernel globals, which are per
thread on CPU already.
Reviewers: dingto, juicyfruit, lukasstockner97, maiself, brecht
Reviewed By: brecht
Subscribers: Blendify, nutel
Differential Revision: https://developer.blender.org/D1996
Diffstat (limited to 'intern/cycles/kernel/kernel_globals.h')
-rw-r--r-- | intern/cycles/kernel/kernel_globals.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/intern/cycles/kernel/kernel_globals.h b/intern/cycles/kernel/kernel_globals.h index c44ea1b051f..7e6cdf93fb9 100644 --- a/intern/cycles/kernel/kernel_globals.h +++ b/intern/cycles/kernel/kernel_globals.h @@ -31,6 +31,9 @@ struct OSLThreadData; struct OSLShadingSystem; # endif +struct Intersection; +struct VolumeStep; + typedef struct KernelGlobals { texture_image_uchar4 texture_byte4_images[TEX_NUM_BYTE4_IMAGES_CPU]; texture_image_float4 texture_float4_images[TEX_NUM_FLOAT4_IMAGES_CPU]; @@ -51,6 +54,14 @@ typedef struct KernelGlobals { OSLThreadData *osl_tdata; # endif + /* **** Run-time data **** */ + + /* Heap-allocated storage for transparent shadows intersections. */ + Intersection *transparent_shadow_intersections; + + /* Storage for decoupled volume steps. */ + VolumeStep *decoupled_volume_steps[2]; + int decoupled_volume_steps_index; } KernelGlobals; #endif /* __KERNEL_CPU__ */ |