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
parent97e84765cd90bd711232318cee71d9523614eb7e (diff)
avoid int/float comparisons within a number of for loops in deep shadow map compression.
gives minor overall speedup.
-rw-r--r--source/blender/editors/render/render_preview.c2
-rw-r--r--source/blender/render/intern/source/shadbuf.c14
2 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index b60f948dc79..efe30533ac2 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -1030,7 +1030,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
/* handle results */
if(sp->pr_method==PR_ICON_RENDER) {
- char *rct= (char *)(sp->pr_rect + 32*16 + 16);
+ // char *rct= (char *)(sp->pr_rect + 32*16 + 16);
if(sp->pr_rect)
RE_ResultGet32(re, sp->pr_rect);
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;