forked from bartvdbraak/blender
avoid int/float comparisons within a number of for loops in deep shadow map compression.
gives minor overall speedup.
This commit is contained in:
parent
97e84765cd
commit
22b97743ef
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user