Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1651)

Issue 766041: Review: compaction as we build closures (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years ago by larrygritz
Modified:
14 years ago
Reviewers:
aconty, ckulla
Base URL:
http://openshadinglanguage.googlecode.com/svn/trunk/
Visibility:
Public.

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.

Patch Set 1 #

Total comments: 3

Patch Set 2 : Use mergeable/derived_mergeable as suggested. #

Patch Set 3 : Third time's the charm? #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+422 lines, -31 lines) Patch
src/include/oslclosure.h View 1 2 5 chunks +37 lines, -1 line 3 comments Download
src/liboslexec/background.cpp View 1 2 1 chunk +5 lines, -1 line 0 comments Download
src/liboslexec/bsdf_ashikhmin_velvet.cpp View 1 2 1 chunk +11 lines, -1 line 0 comments Download
src/liboslexec/bsdf_cloth.cpp View 1 2 1 chunk +23 lines, -1 line 0 comments Download
src/liboslexec/bsdf_cloth_specular.cpp View 1 2 1 chunk +21 lines, -1 line 0 comments Download
src/liboslexec/bsdf_diffuse.cpp View 1 2 2 chunks +20 lines, -2 lines 0 comments Download
src/liboslexec/bsdf_fakefur.cpp View 1 2 3 chunks +56 lines, -0 lines 0 comments Download
src/liboslexec/bsdf_hair.cpp View 1 2 2 chunks +21 lines, -2 lines 0 comments Download
src/liboslexec/bsdf_microfacet.cpp View 1 2 2 chunks +27 lines, -2 lines 0 comments Download
src/liboslexec/bsdf_phong.cpp View 1 2 2 chunks +27 lines, -2 lines 0 comments Download
src/liboslexec/bsdf_reflection.cpp View 1 2 2 chunks +20 lines, -1 line 0 comments Download
src/liboslexec/bsdf_refraction.cpp View 1 2 2 chunks +22 lines, -2 lines 0 comments Download
src/liboslexec/bsdf_transparent.cpp View 1 2 1 chunk +5 lines, -1 line 0 comments Download
src/liboslexec/bsdf_ward.cpp View 1 2 1 chunk +12 lines, -1 line 0 comments Download
src/liboslexec/bsdf_westin.cpp View 1 2 2 chunks +22 lines, -2 lines 0 comments Download
src/liboslexec/bssrdf.cpp View 1 2 1 chunk +11 lines, -1 line 0 comments Download
src/liboslexec/closure.cpp View 2 4 chunks +60 lines, -9 lines 0 comments Download
src/liboslexec/closure_test.cpp View 1 2 1 chunk +9 lines, -0 lines 0 comments Download
src/liboslexec/emissive.cpp View 1 2 1 chunk +13 lines, -1 line 0 comments Download

Messages

Total messages: 12
larrygritz
14 years ago (2010-03-25 22:21:20 UTC) #1
aconty
http://codereview.appspot.com/766041/diff/1/7 File src/liboslexec/bsdf_diffuse.cpp (right): http://codereview.appspot.com/766041/diff/1/7#newcode51 src/liboslexec/bsdf_diffuse.cpp:51: return m_N == comp->m_N && base_mergeable(other); Wouldn't it be ...
14 years ago (2010-03-25 23:38:40 UTC) #2
lg_imageworks.com
On Mar 25, 2010, at 4:38 PM, <aconty@gmail.com> <aconty@gmail.com> wrote: > > http://codereview.appspot.com/766041/diff/1/7#newcode51 > src/liboslexec/bsdf_diffuse.cpp:51: ...
14 years ago (2010-03-26 03:08:58 UTC) #3
Chris Foster
On Fri, Mar 26, 2010 at 1:08 PM, Larry Gritz <lg@imageworks.com> wrote: > On Mar ...
14 years ago (2010-03-26 03:38:29 UTC) #4
ckulla
I second Chris's suggestion of the "inverted" two method setup.
14 years ago (2010-03-26 15:56:11 UTC) #5
ckulla
http://codereview.appspot.com/766041/diff/1/7 File src/liboslexec/bsdf_diffuse.cpp (right): http://codereview.appspot.com/766041/diff/1/7#newcode51 src/liboslexec/bsdf_diffuse.cpp:51: return m_N == comp->m_N && base_mergeable(other); What about the ...
14 years ago (2010-03-26 16:05:18 UTC) #6
aconty
Just to give another alternative, leave it as it is but make base_mergeable virtual so ...
14 years ago (2010-03-26 17:34:00 UTC) #7
larrygritz
Use mergeable/derived_mergeable as suggested.
14 years ago (2010-03-26 17:44:16 UTC) #8
lg_larrygritz.com
On Mar 26, 2010, at 9:05 AM, ckulla@gmail.com wrote: > > http://codereview.appspot.com/766041/diff/1/7#newcode51 > src/liboslexec/bsdf_diffuse.cpp:51: return ...
14 years ago (2010-03-26 17:47:48 UTC) #9
larrygritz
Third time's the charm?
14 years ago (2010-03-26 18:28:20 UTC) #10
aconty
LGTM, just one comment in case you want to consider it for this commit http://codereview.appspot.com/766041/diff/28001/29001 ...
14 years ago (2010-03-26 21:42:39 UTC) #11
ckulla
14 years ago (2010-03-26 21:48:37 UTC) #12
LGTM2

A few small comments:

http://codereview.appspot.com/766041/diff/28001/29001
File src/include/oslclosure.h (right):

http://codereview.appspot.com/766041/diff/28001/29001#newcode181
src/include/oslclosure.h:181: for (int i = 0;  i <= MAXCUSTOM;  ++i) {
The last one is guaranteed to be Labels::NONE, so no need to check it.

http://codereview.appspot.com/766041/diff/28001/29001#newcode212
src/include/oslclosure.h:212: return m_sidedness == comp->m_sidedness &&
In theory only m_sidedness is a user settable parameter, the other ones are
fixed by the type of closure.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b