diff options
author | Ton Roosendaal <ton@blender.org> | 2006-06-30 18:21:25 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-06-30 18:21:25 +0400 |
commit | 6a5f6373383221e33a46809d5d6b1e77ff665973 (patch) | |
tree | e893edced2fac5ef6efda6e16e30985297d05118 /source | |
parent | b291939ccc46d96f1ff611a6e243cb9cdce1804d (diff) |
Hooray! Finally found the dreaded "Opengl crash" the poor orange team
suffered for the entire movie. :)
It only happened when rendering large frames, using a lot of memory and
typically when you also use other software in meantime.
Reason: the main thread does the drawing updating, while rendering is
still continuing. When using Ztransp, there was a free buffer done
when possibly a draw could still be in progress. Only crashed when drawing
is slow... explaining why it only showed up in more complex cases.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/render/extern/include/RE_pipeline.h | 3 | ||||
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 3 | ||||
-rw-r--r-- | source/blender/render/intern/source/rendercore.c | 24 |
3 files changed, 19 insertions, 11 deletions
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 8a5fb7ec63c..eed13e15ed5 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -72,7 +72,8 @@ typedef struct RenderLayer { unsigned int lay; int layflag, passflag; - float *rectf; /* 4 float, standard rgba buffer */ + float *rectf; /* 4 float, standard rgba buffer */ + float *acolrect; /* 4 float, optional transparent buffer, needs storage for display updates */ ListBase passes; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 5de50c2f8c0..1cac8b2cbcf 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -158,6 +158,9 @@ static void free_render_result(RenderResult *res) RenderLayer *rl= res->layers.first; if(rl->rectf) MEM_freeT(rl->rectf); + /* acolrect is optionally allocated in shade_tile, only free here since it can be used for drawing */ + if(rl->acolrect) MEM_freeT(rl->acolrect); + while(rl->passes.first) { RenderPass *rpass= rl->passes.first; if(rpass->rect) MEM_freeT(rpass->rect); diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index b9300241468..2adf589392b 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -3197,23 +3197,25 @@ void zbufshadeDA_tile(RenderPart *pa) /* transp layer */ if(R.flag & R_ZTRA) { if(rl->layflag & SCE_LAY_ZTRA) { - float *acolrect= MEM_callocT(4*sizeof(float)*pa->rectx*pa->recty, "alpha layer"); - float *fcol= rl->rectf, *acol= acolrect; + float *fcol, *acol; int x; + /* allocate, but not free here, for asynchronous display of this rect in main thread */ + rl->acolrect= MEM_callocT(4*sizeof(float)*pa->rectx*pa->recty, "alpha layer"); + if(rl->passflag & SCE_PASS_VECTOR) if(rl->layflag & SCE_LAY_SOLID) reset_sky_speedvectors(pa, rl); /* swap for live updates */ - SWAP(float *, acolrect, rl->rectf); + SWAP(float *, rl->acolrect, rl->rectf); zbuffer_transp_shade(pa, rl, rl->rectf); - SWAP(float *, acolrect, rl->rectf); + SWAP(float *, rl->acolrect, rl->rectf); + fcol= rl->rectf; acol= rl->acolrect; for(x=pa->rectx*pa->recty; x>0; x--, acol+=4, fcol+=4) { addAlphaOverFloat(fcol, acol); } - MEM_freeT(acolrect); } } @@ -3329,23 +3331,25 @@ void zbufshade_tile(RenderPart *pa) if(R.flag & R_ZTRA) { if(rl->layflag & SCE_LAY_ZTRA) { - float *acolrect= MEM_callocT(4*sizeof(float)*pa->rectx*pa->recty, "alpha layer"); - float *fcol= rl->rectf, *acol= acolrect; + float *fcol, *acol; int x; + /* allocate, but not free here, for asynchronous display of this rect in main thread */ + rl->acolrect= MEM_callocT(4*sizeof(float)*pa->rectx*pa->recty, "alpha layer"); + if(addpassflag & SCE_PASS_VECTOR) if(rl->layflag & SCE_LAY_SOLID) reset_sky_speedvectors(pa, rl); /* swap for live updates */ - SWAP(float *, acolrect, rl->rectf); + SWAP(float *, rl->acolrect, rl->rectf); zbuffer_transp_shade(pa, rl, rl->rectf); - SWAP(float *, acolrect, rl->rectf); + SWAP(float *, rl->acolrect, rl->rectf); + fcol= rl->rectf; acol= rl->acolrect; for(x=pa->rectx*pa->recty; x>0; x--, acol+=4, fcol+=4) { addAlphaOverFloat(fcol, acol); } - MEM_freeT(acolrect); } } |