Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-01-03 09:13:50 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-01-03 09:13:50 +0300
commit22b97743ef42c1b5d0c6a57f4004e72d55341c7a (patch)
tree4d112e1e5df9ee69b9e401bf7977089e25979b56 /source/blender/render
parent97e84765cd90bd711232318cee71d9523614eb7e (diff)
avoid int/float comparisons within a number of for loops in deep shadow map compression.
gives minor overall speedup.
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/intern/source/shadbuf.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index e589bb3a840..7d6edde2c0d 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -300,8 +300,14 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
DeepSample *ds[RE_MAX_OSA], *sampleds[RE_MAX_OSA], *dsb, *newbuf;
APixstr *ap, *apn;
APixstrand *aps, *apns;
- float visibility, totbuf= shb->totbuf;
- int a, b, c, tot, minz, found, size= shb->size, prevtot, newtot;
+ float visibility;
+
+ const int totbuf= shb->totbuf;
+ const float totbuf_f= (float)shb->totbuf;
+ const float totbuf_f_inv= 1.0f/totbuf_f;
+ const int size= shb->size;
+
+ int a, b, c, tot, minz, found, prevtot, newtot;
int sampletot[RE_MAX_OSA], totsample = 0, totsamplec = 0;
shsample= MEM_callocN( sizeof(ShadSampleBuf), "shad sample buf");
@@ -456,9 +462,9 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
}
if(sampleds[c] == ds[c])
- visibility += 1.0f/totbuf;
+ visibility += totbuf_f_inv;
else
- visibility += (ds[c]-1)->v/totbuf;
+ visibility += (ds[c]-1)->v / totbuf_f;
}
dsb->v= visibility;