diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 20 | ||||
-rw-r--r-- | source/blender/render/intern/source/rendercore.c | 38 | ||||
-rw-r--r-- | source/blender/render/intern/source/sss.c | 14 |
3 files changed, 48 insertions, 24 deletions
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 1d414456eb6..b5e4707377a 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1165,6 +1165,15 @@ void RE_AddObject(Render *re, Object *ob) /* *************************************** */ +static int render_display_draw_enabled(Render *re) +{ + /* don't show preprocess for previewrender sss */ + if(re->sss_points) + return !(re->r.scemode & R_PREVIEWBUTS); + else + return 1; +} + static void *do_part_thread(void *pa_v) { RenderPart *pa= pa_v; @@ -1183,7 +1192,7 @@ static void *do_part_thread(void *pa_v) /* merge too on break! */ if(R.result->exrhandle) save_render_result_tile(&R, pa); - else + else if(render_display_draw_enabled(&R)) merge_render_result(R.result, pa->result); } @@ -1226,7 +1235,8 @@ static void render_tile_processor(Render *re, int firsttile) if(pa->result) { if(!re->test_break()) { - re->display_draw(pa->result, NULL); + if(render_display_draw_enabled(re)) + re->display_draw(pa->result, NULL); re->i.partsdone++; re->stats_draw(&re->i); @@ -1432,7 +1442,8 @@ static void threaded_tile_processor(Render *re) BLI_remove_thread(&threads, pa); if(pa->result) { - re->display_draw(pa->result, NULL); + if(render_display_draw_enabled(re)) + re->display_draw(pa->result, NULL); print_part_stats(re, pa); RE_FreeRenderResult(pa->result); @@ -1444,7 +1455,8 @@ static void threaded_tile_processor(Render *re) else { rendering= 1; if(pa->nr && pa->result && drawtimer>20) { - re->display_draw(pa->result, &pa->result->renrect); + if(render_display_draw_enabled(re)) + re->display_draw(pa->result, &pa->result->renrect); hasdrawn= 1; } } diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index ba904ff8cee..4e32cd16acf 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -1264,20 +1264,20 @@ static void zbufshade_sss_free(RenderPart *pa) void zbufshade_sss_tile(RenderPart *pa) { + Render *re= &R; ShadeSample ssamp; ZBufSSSHandle handle; RenderResult *rr= pa->result; RenderLayer *rl= rr->layers.first; VlakRen *vlr; - Material *mat= R.sss_mat; + Material *mat= re->sss_mat; float (*co)[3], (*color)[3], *area, *fcol= rl->rectf; - int x, y, seed, quad, totpoint; + int x, y, seed, quad, totpoint, display = !(re->r.scemode & R_PREVIEWBUTS); + int *rz, *rp, *rbz, *rbp; #if 0 PixStr *ps; long *rs; int z; -#else - int *rz, *rp, *rbz, *rbp; #endif set_part_zbuf_clipflag(pa); @@ -1312,7 +1312,7 @@ void zbufshade_sss_tile(RenderPart *pa) #if 0 /* create ISB (does not work currently!) */ - if(R.r.mode & R_SHADOW) + if(re->r.mode & R_SHADOW) ISB_create(pa, NULL); #endif @@ -1324,9 +1324,11 @@ void zbufshade_sss_tile(RenderPart *pa) ssamp.shi[0].combinedflag= ~(SCE_PASS_SPEC); ssamp.tot= 1; - /* initialize scanline updates for main thread */ - rr->renrect.ymin= 0; - rr->renlay= rl; + if(display) { + /* initialize scanline updates for main thread */ + rr->renrect.ymin= 0; + rr->renlay= rl; + } seed= pa->rectx*pa->disprect.ymin; #if 0 @@ -1348,7 +1350,7 @@ void zbufshade_sss_tile(RenderPart *pa) if(rs) { /* for each sample in this pixel, shade it */ for(ps=(PixStr*)*rs; ps; ps=ps->next) { - vlr= RE_findOrAddVlak(&R, (ps->facenr-1) & RE_QUAD_MASK); + vlr= RE_findOrAddVlak(re, (ps->facenr-1) & RE_QUAD_MASK); quad= (ps->facenr & RE_QUAD_OFFS); z= ps->z; @@ -1367,7 +1369,7 @@ void zbufshade_sss_tile(RenderPart *pa) if(rp) { if(*rp != 0) { /* shade front */ - vlr= RE_findOrAddVlak(&R, (*rp-1) & RE_QUAD_MASK); + vlr= RE_findOrAddVlak(re, (*rp-1) & RE_QUAD_MASK); quad= ((*rp) & RE_QUAD_OFFS); shade_sample_sss(&ssamp, mat, vlr, quad, x, y, *rz, @@ -1384,7 +1386,7 @@ void zbufshade_sss_tile(RenderPart *pa) if(rbp) { if(*rbp != 0 && *rbp != *(rp-1)) { /* shade back */ - vlr= RE_findOrAddVlak(&R, (*rbp-1) & RE_QUAD_MASK); + vlr= RE_findOrAddVlak(re, (*rbp-1) & RE_QUAD_MASK); quad= ((*rbp) & RE_QUAD_OFFS); shade_sample_sss(&ssamp, mat, vlr, quad, x, y, *rbz, @@ -1404,12 +1406,12 @@ void zbufshade_sss_tile(RenderPart *pa) } if(y&1) - if(R.test_break()) break; + if(re->test_break()) break; } /* note: after adding we do not free these arrays, sss keeps them */ if(totpoint > 0) { - sss_add_points(&R, co, color, area, totpoint); + sss_add_points(re, co, color, area, totpoint); } else { MEM_freeN(co); @@ -1418,13 +1420,15 @@ void zbufshade_sss_tile(RenderPart *pa) } #if 0 - if(R.r.mode & R_SHADOW) + if(re->r.mode & R_SHADOW) ISB_free(pa); #endif - /* display active layer */ - rr->renrect.ymin=rr->renrect.ymax= 0; - rr->renlay= render_get_active_layer(&R, rr); + if(display) { + /* display active layer */ + rr->renrect.ymin=rr->renrect.ymax= 0; + rr->renlay= render_get_active_layer(&R, rr); + } zbufshade_sss_free(pa); } diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c index a6132c0c062..f0d56a18994 100644 --- a/source/blender/render/intern/source/sss.c +++ b/source/blender/render/intern/source/sss.c @@ -839,6 +839,7 @@ typedef struct SSSPoints { static void sss_create_tree_mat(Render *re, Material *mat) { SSSPoints *p; + RenderResult *rr; ListBase layers, points; float (*co)[3] = NULL, (*color)[3] = NULL, *area = NULL; int totpoint = 0, osa, osaflag, partsdone; @@ -848,11 +849,15 @@ static void sss_create_tree_mat(Render *re, Material *mat) points.first= points.last= NULL; + /* TODO: this is getting a bit ugly, copying all those variables and + setting them back, maybe we need to create our own Render? */ + /* do SSS preprocessing render */ layers= re->r.layers; osa= re->osa; osaflag= re->r.mode & R_OSA; partsdone= re->i.partsdone; + rr= re->result; re->r.layers.first= re->r.layers.last= NULL; re->osa= 0; @@ -860,15 +865,18 @@ static void sss_create_tree_mat(Render *re, Material *mat) re->sss_points= &points; re->sss_mat= mat; re->i.partsdone= 0; + re->result= NULL; - RE_TileProcessor(re, 0, 1); + RE_TileProcessor(re, 0, !(re->r.mode & R_PREVIEWBUTS)); + RE_FreeRenderResult(re->result); + re->result= rr; + re->i.partsdone= partsdone; re->sss_mat= NULL; re->sss_points= NULL; re->r.layers= layers; re->osa= osa; if (osaflag) re->r.mode |= R_OSA; - re->i.partsdone= partsdone; /* no points? no tree */ if(!points.first) @@ -907,7 +915,7 @@ static void sss_create_tree_mat(Render *re, Material *mat) float fw= mat->sss_front, bw= mat->sss_back; float error = mat->sss_error; - if((R.r.scemode & R_PREVIEWBUTS) && error < 0.5f) + if((re->r.scemode & R_PREVIEWBUTS) && error < 0.5f) error= 0.5f; sss->ss[0]= scatter_settings_new(col[0], radius[0], ior, cfac, fw, bw); |