Bugfix: FSA enabled in compositing scene but disabled in other
scenes could crash, there was code to make sure osa level is the same in all scenes, but that was set too late, after sample tables are created. Fix for some unitinialized vector warnings with FSA, these were harmless, unfortunately.
This commit is contained in:
@@ -153,7 +153,7 @@ struct RenderLayer *RE_GetRenderLayer(struct RenderResult *rr, const char *name)
|
||||
float *RE_RenderLayerGetPass(struct RenderLayer *rl, int passtype);
|
||||
|
||||
/* obligatory initialize call, disprect is optional */
|
||||
void RE_InitState (struct Render *re, struct RenderData *rd, int winx, int winy, rcti *disprect);
|
||||
void RE_InitState (struct Render *re, struct Render *source, struct RenderData *rd, int winx, int winy, rcti *disprect);
|
||||
|
||||
/* use this to change disprect of active render */
|
||||
void RE_SetDispRect (struct Render *re, rcti *disprect);
|
||||
|
||||
@@ -5173,7 +5173,7 @@ void RE_make_sticky(void)
|
||||
}
|
||||
|
||||
re= RE_NewRender("_make sticky_");
|
||||
RE_InitState(re, &G.scene->r, G.scene->r.xsch, G.scene->r.ysch, NULL);
|
||||
RE_InitState(re, NULL, &G.scene->r, G.scene->r.xsch, G.scene->r.ysch, NULL);
|
||||
|
||||
/* use renderdata and camera to set viewplane */
|
||||
RE_SetCamera(re, G.scene->camera);
|
||||
|
||||
@@ -127,7 +127,7 @@ static Render *envmap_render_copy(Render *re, EnvMap *env)
|
||||
envre->r.size= 100;
|
||||
envre->r.yasp= envre->r.xasp= 1;
|
||||
|
||||
RE_InitState(envre, &envre->r, cuberes, cuberes, NULL);
|
||||
RE_InitState(envre, NULL, &envre->r, cuberes, cuberes, NULL);
|
||||
envre->scene= re->scene; /* unsure about this... */
|
||||
|
||||
/* view stuff in env render */
|
||||
|
||||
@@ -1058,7 +1058,7 @@ void RE_FreeAllRender(void)
|
||||
|
||||
/* what doesn't change during entire render sequence */
|
||||
/* disprect is optional, if NULL it assumes full window render */
|
||||
void RE_InitState(Render *re, RenderData *rd, int winx, int winy, rcti *disprect)
|
||||
void RE_InitState(Render *re, Render *source, RenderData *rd, int winx, int winy, rcti *disprect)
|
||||
{
|
||||
re->ok= TRUE; /* maybe flag */
|
||||
|
||||
@@ -1086,12 +1086,18 @@ void RE_InitState(Render *re, RenderData *rd, int winx, int winy, rcti *disprect
|
||||
re->ok= 0;
|
||||
}
|
||||
else {
|
||||
/* check state variables, osa? */
|
||||
if(re->r.mode & (R_OSA)) {
|
||||
re->osa= re->r.osa;
|
||||
if(re->osa>16) re->osa= 16;
|
||||
/* fullsample wants uniform osa levels */
|
||||
if(source && re->r.scemode & R_FULL_SAMPLE) {
|
||||
re->r.osa= re->osa= source->osa;
|
||||
}
|
||||
else {
|
||||
/* check state variables, osa? */
|
||||
if(re->r.mode & (R_OSA)) {
|
||||
re->osa= re->r.osa;
|
||||
if(re->osa>16) re->osa= 16;
|
||||
}
|
||||
else re->osa= 0;
|
||||
}
|
||||
else re->osa= 0;
|
||||
|
||||
/* always call, checks for gamma, gamma tables and jitter too */
|
||||
make_sample_tables(re);
|
||||
@@ -1913,7 +1919,7 @@ static void render_scene(Render *re, Scene *sce, int cfra)
|
||||
}
|
||||
|
||||
/* initial setup */
|
||||
RE_InitState(resc, &sce->r, winx, winy, &re->disprect);
|
||||
RE_InitState(resc, re, &sce->r, winx, winy, &re->disprect);
|
||||
|
||||
/* this to enable this scene to create speed vectors */
|
||||
resc->r.scemode |= R_DOCOMP;
|
||||
@@ -1924,10 +1930,6 @@ static void render_scene(Render *re, Scene *sce, int cfra)
|
||||
/* ensure scene has depsgraph, base flags etc OK. Warning... also sets G.scene */
|
||||
set_scene_bg(sce);
|
||||
|
||||
/* fullsample wants uniform osa levels */
|
||||
if(resc->r.scemode & R_FULL_SAMPLE)
|
||||
resc->r.osa= resc->osa= re->osa;
|
||||
|
||||
/* copy callbacks */
|
||||
resc->display_draw= re->display_draw;
|
||||
resc->test_break= re->test_break;
|
||||
@@ -2432,7 +2434,7 @@ static int render_initialize_from_scene(Render *re, Scene *scene)
|
||||
if(scene->r.scemode & R_SINGLE_LAYER)
|
||||
push_render_result(re);
|
||||
|
||||
RE_InitState(re, &scene->r, winx, winy, &disprect);
|
||||
RE_InitState(re, NULL, &scene->r, winx, winy, &disprect);
|
||||
if(!re->ok) /* if an error was printed, abort */
|
||||
return 0;
|
||||
|
||||
@@ -2647,7 +2649,7 @@ void RE_ReadRenderResult(Scene *scene, Scene *scenode)
|
||||
re= RE_GetRender(scene->id.name);
|
||||
if(re==NULL)
|
||||
re= RE_NewRender(scene->id.name);
|
||||
RE_InitState(re, &scene->r, winx, winy, &disprect);
|
||||
RE_InitState(re, NULL, &scene->r, winx, winy, &disprect);
|
||||
re->scene= scene;
|
||||
|
||||
read_render_result(re, 0);
|
||||
|
||||
@@ -819,17 +819,21 @@ void edge_enhance_tile(RenderPart *pa, float *rectf)
|
||||
static void reset_sky_speed(RenderPart *pa, RenderLayer *rl)
|
||||
{
|
||||
/* for all pixels with max speed, set to zero */
|
||||
RenderLayer *rlpp[RE_MAX_OSA];
|
||||
float *fp;
|
||||
int a;
|
||||
int a, sample, totsample;
|
||||
|
||||
fp= RE_RenderLayerGetPass(rl, SCE_PASS_VECTOR);
|
||||
if(fp==NULL) return;
|
||||
totsample= get_sample_layers(pa, rl, rlpp);
|
||||
|
||||
for(a= 4*pa->rectx*pa->recty - 1; a>=0; a--)
|
||||
if(fp[a] == PASS_VECTOR_MAX) fp[a]= 0.0f;
|
||||
for(sample= 0; sample<totsample; sample++) {
|
||||
fp= RE_RenderLayerGetPass(rlpp[sample], SCE_PASS_VECTOR);
|
||||
if(fp==NULL) break;
|
||||
|
||||
for(a= 4*pa->rectx*pa->recty - 1; a>=0; a--)
|
||||
if(fp[a] == PASS_VECTOR_MAX) fp[a]= 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static unsigned short *make_solid_mask(RenderPart *pa)
|
||||
{
|
||||
long *rd= pa->rectdaps;
|
||||
|
||||
@@ -4055,12 +4055,15 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
|
||||
|
||||
/* for each mask-sample we alpha-under colors. then in end it's added using filter */
|
||||
memset(samp_shr, 0, sizeof(ShadeResult)*osa);
|
||||
for(a=0; a<osa; a++)
|
||||
for(a=0; a<osa; a++) {
|
||||
samp_shr[a].z= 10e10f;
|
||||
|
||||
/* nice this memset, but speed vectors are not initialized OK then. it is sufficient to only clear 1 (see merge_transp_passes) */
|
||||
if(addpassflag & SCE_PASS_VECTOR)
|
||||
samp_shr->winspeed[0]= samp_shr->winspeed[1]= samp_shr->winspeed[2]= samp_shr->winspeed[3]= PASS_VECTOR_MAX;
|
||||
if(addpassflag & SCE_PASS_VECTOR) {
|
||||
samp_shr[a].winspeed[0]= PASS_VECTOR_MAX;
|
||||
samp_shr[a].winspeed[1]= PASS_VECTOR_MAX;
|
||||
samp_shr[a].winspeed[2]= PASS_VECTOR_MAX;
|
||||
samp_shr[a].winspeed[3]= PASS_VECTOR_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
if(R.osa==0) {
|
||||
while(totface>0) {
|
||||
|
||||
@@ -463,7 +463,7 @@ void BIF_previewrender(struct ID *id, struct RenderInfo *ri, struct ScrArea *are
|
||||
}
|
||||
|
||||
/* allocates render result */
|
||||
RE_InitState(re, &sce->r, ri->pr_rectx, ri->pr_recty, NULL);
|
||||
RE_InitState(re, NULL, &sce->r, ri->pr_rectx, ri->pr_recty, NULL);
|
||||
|
||||
/* enforce preview image clear */
|
||||
if(GS(id->name)==ID_MA) {
|
||||
@@ -780,7 +780,7 @@ void BIF_view3d_previewrender(ScrArea *sa)
|
||||
rdata.layers.first= rdata.layers.last= NULL;
|
||||
rdata.renderer= R_INTERN;
|
||||
|
||||
RE_InitState(re, &rdata, sa->winx, sa->winy, &ri->disprect);
|
||||
RE_InitState(re, NULL, &rdata, sa->winx, sa->winy, &ri->disprect);
|
||||
|
||||
if(orth)
|
||||
RE_SetOrtho(re, &viewplane, clipsta, clipend);
|
||||
|
||||
@@ -1270,7 +1270,7 @@ void BIF_do_ogl_render(View3D *v3d, int anim)
|
||||
winx= (G.scene->r.size*G.scene->r.xsch)/100;
|
||||
winy= (G.scene->r.size*G.scene->r.ysch)/100;
|
||||
|
||||
RE_InitState(re, &G.scene->r, winx, winy, NULL);
|
||||
RE_InitState(re, NULL, &G.scene->r, winx, winy, NULL);
|
||||
|
||||
/* for now, result is defaulting to floats still... */
|
||||
rr= RE_GetResult(re);
|
||||
|
||||
Reference in New Issue
Block a user