Review: compaction as we build closures (issue766041)


larry...@...
 

Reviewers: ,

Description:
In practice with our production shaders, were were often getting Ci's
with many components that were duplicates. We figured this wasn't great
for performance and also wouldn't be the best input for our integrator.
So I've modified the "closure add" to check if components are
duplicates, and if so merge them by adding the weights rather than
appending. Also to not bother merging if the weights are 0.

Results:

Baseline:

4:45 1427 MB
Largest Ci closure constructed: 12 components
Tiny weight components: 7037131 / 128325701 (5.4838% of components,
present in 3.48453% of Ci's)
Zero weight components: 6719907 / 128325701 (5.2366%)


After my changes:

4:32 1403 MB
Largest Ci closure constructed: 4 components
Tiny weight components: 42956 / 113090187 (0.0379838% of components,
present in 0.0426577% of Ci's)
Zero weight components: 0 / 113090187 (0%)


So it's a tad faster, an eensy bit less memory, and the images look just
a bit less noisy now.



Please review this at http://codereview.appspot.com/766041/show

Affected files:
src/include/oslclosure.h
src/liboslexec/background.cpp
src/liboslexec/bsdf_ashikhmin_velvet.cpp
src/liboslexec/bsdf_cloth.cpp
src/liboslexec/bsdf_cloth_specular.cpp
src/liboslexec/bsdf_diffuse.cpp
src/liboslexec/bsdf_fakefur.cpp
src/liboslexec/bsdf_hair.cpp
src/liboslexec/bsdf_microfacet.cpp
src/liboslexec/bsdf_phong.cpp
src/liboslexec/bsdf_reflection.cpp
src/liboslexec/bsdf_refraction.cpp
src/liboslexec/bsdf_transparent.cpp
src/liboslexec/bsdf_ward.cpp
src/liboslexec/bsdf_westin.cpp
src/liboslexec/bssrdf.cpp
src/liboslexec/closure.cpp
src/liboslexec/closure_test.cpp
src/liboslexec/emissive.cpp