- Preview render (buttons) was executing the 'data ipos', causing inserting

keys with IKEY in buttons to not work.

- Crash in opengl while rendering was caused by the fact that scanline
  updates are drawn in the main thread, whilst the actual render thread
  then can already be doing different stuff.
  Especially with many layers & passes it's getting confusing easily :)

  Convention now is that scanline render updates only happen while the
  thread is looping over scanlines. As soon as it reached the last, no
  drawing happens, not even to update the last segment.
  This isnt a problen, since any finished tile is drawn again entirely.
This commit is contained in:
Ton Roosendaal 2006-02-15 09:35:01 +00:00
parent 8bc0060835
commit 9ef9d66a26
6 changed files with 11 additions and 7 deletions

View File

@ -439,7 +439,7 @@ typedef struct Scene {
#define R_BG_RENDER 0x0002
/* passepartout is camera option now, keep this for backward compatibility */
#define R_PASSEPARTOUT 0x0004
#define R_PREVIEWBUTS 0x0008
#define R_EXTENSION 0x0010
#define R_NODE_PREVIEW 0x0020
#define R_DOCOMP 0x0040

View File

@ -2804,7 +2804,8 @@ void RE_Database_FromScene(Render *re, Scene *scene, int use_camera_view)
else lay= re->scene->lay;
/* applies changes fully */
scene_update_for_newframe(re->scene, lay);
if((re->r.scemode & R_PREVIEWBUTS)==0)
scene_update_for_newframe(re->scene, lay);
/* if no camera, viewmat should have been set! */
if(use_camera_view && re->scene->camera) {

View File

@ -854,6 +854,7 @@ static void do_render_scene_node(Render *re, Scene *sce, int cfra)
RE_InitState(resc, &sce->r, re->winx, re->winy, &re->disprect);
/* now use renderdata and camera to set viewplane */
if(sce->camera==NULL) return;
RE_SetCamera(resc, sce->camera);
/* still unsure entity this... */

View File

@ -3106,6 +3106,7 @@ void zbufshadeDA_tile(RenderPart *pa)
for(rl= rr->layers.first; rl; rl= rl->next) {
/* indication for scanline updates */
rr->renlay= rl;
rr->renrect.ymin=rr->renrect.ymax= 0;
/* initialize pixelstructs */
addpsmain(&psmlist);
@ -3200,6 +3201,7 @@ void zbufshade_tile(RenderPart *pa)
for(rl= rr->layers.first; rl; rl= rl->next) {
/* indication for scanline updates */
rr->renlay= rl;
rr->renrect.ymin=rr->renrect.ymax= 0;
/* fill shadepixel info struct */
shpi.lay= rl->lay;
@ -3217,9 +3219,6 @@ void zbufshade_tile(RenderPart *pa)
float *fcol= rl->rectf;
int x, y, *rp= pa->rectp, *rz= pa->rectz, offs=0;
/* init scanline updates */
rr->renrect.ymin=rr->renrect.ymax= 0;
for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++, rr->renrect.ymax++) {
for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, rz++, rp++, fcol+=4, offs++) {
shadepixel_sky(&shpi, (float)x, (float)y, *rz, *rp, 0);

View File

@ -262,7 +262,9 @@ static Scene *preview_prepare_scene(RenderInfo *ri, int id_type, ID *id, int pr_
sce= pr_main->scene.first;
if(sce) {
sce->r.mode |= G.scene->r.mode & R_THREADS;
// sce->r.mode |= G.scene->r.mode & R_THREADS;
/* this flag tells render to not execute depsgraph or ipos etc */
sce->r.scemode |= R_PREVIEWBUTS;
if(id_type==ID_MA) {
Material *mat= (Material *)id;

View File

@ -763,7 +763,8 @@ static void renderwin_progress(RenderWin *rw, RenderResult *rr, rcti *renrect)
if(renrect) {
ymin= renrect->ymin;
ymax= renrect->ymax-ymin;
if(ymax<2 || renrect->ymax>=rr->recty) return;
if(ymax<2 || renrect->ymax>=rr->recty) /* if ymax==recty, rendering of layer is ready, we should not draw, other things happen... */
return;
renrect->ymin= renrect->ymax;
}
else {