diff options
author | Ton Roosendaal <ton@blender.org> | 2010-11-28 21:34:16 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2010-11-28 21:34:16 +0300 |
commit | d01054da0f569581d5802f3184fd330568c24774 (patch) | |
tree | 6b00467af1eaedde8df255c3727f21204dfd3aa6 /source/blender/nodes | |
parent | 510920a299478cdd50ce8ce4ff43d14eb4e2c2e4 (diff) |
Bugfix #24933
Compositor: Texture node only allowed 1 user, with more nodes using it
there was a thread conflict, using same memory for writing values.
Also: brought back the original intention for texture nodes, which is to
be using a "procedural image", not allocating memory for a buffer, but
only allowing to read per pixel. Commit in 2007 (!) allocated full buffers
for texture nodes, without using them even.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/intern/CMP_nodes/CMP_texture.c | 6 | ||||
-rw-r--r-- | source/blender/nodes/intern/CMP_util.c | 32 | ||||
-rw-r--r-- | source/blender/nodes/intern/CMP_util.h | 1 |
3 files changed, 21 insertions, 18 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c b/source/blender/nodes/intern/CMP_nodes/CMP_texture.c index f990fa452cb..7ddd8b96ae2 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_texture.c @@ -79,7 +79,7 @@ static void texture_procedural(CompBuf *cbuf, float *out, float xco, float yco) else { VECCOPY(col, nor); } - + typecheck_compbuf_color(out, col, cbuf->type, cbuf->procedural_type); } @@ -110,7 +110,7 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in, free_compbuf(prevbuf); if(out[0]->hasoutput) { - CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_VAL, 1); /* alloc */ + CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_VAL, 0); /* no buffer alloc */ stackbuf->rect_procedural= texture_procedural; stackbuf->node= node; @@ -121,7 +121,7 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in, out[0]->data= stackbuf; } if(out[1]->hasoutput) { - CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_RGBA, 1); /* alloc */ + CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_RGBA, 0); /* no buffer alloc */ stackbuf->rect_procedural= texture_procedural; stackbuf->node= node; diff --git a/source/blender/nodes/intern/CMP_util.c b/source/blender/nodes/intern/CMP_util.c index 06c4740f6b9..9e2fed1877e 100644 --- a/source/blender/nodes/intern/CMP_util.c +++ b/source/blender/nodes/intern/CMP_util.c @@ -414,12 +414,12 @@ CompBuf *typecheck_compbuf(CompBuf *inbuf, int type) return inbuf; } -float *compbuf_get_pixel(CompBuf *cbuf, float *rectf, int x, int y, int xrad, int yrad) +static float *compbuf_get_pixel(CompBuf *cbuf, float *defcol, float *use, int x, int y, int xrad, int yrad) { if(cbuf) { if(cbuf->rect_procedural) { - cbuf->rect_procedural(cbuf, rectf, (float)x/(float)xrad, (float)y/(float)yrad); - return rectf; + cbuf->rect_procedural(cbuf, use, (float)x/(float)xrad, (float)y/(float)yrad); + return use; } else { static float col[4]= {0.0f, 0.0f, 0.0f, 0.0f}; @@ -434,7 +434,7 @@ float *compbuf_get_pixel(CompBuf *cbuf, float *rectf, int x, int y, int xrad, in return cbuf->rect + cbuf->type*( (cbuf->yrad+y)*cbuf->x + (cbuf->xrad+x) ); } } - else return rectf; + else return defcol; } /* **************************************************** */ @@ -446,6 +446,7 @@ void composit1_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, floa { CompBuf *src_use; float *outfp=out->rect, *srcfp; + float color[4]; /* local color if compbuf is procedural */ int xrad, yrad, x, y; src_use= typecheck_compbuf(src_buf, src_type); @@ -455,7 +456,7 @@ void composit1_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, floa for(y= -yrad; y<-yrad+out->y; y++) { for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) { - srcfp= compbuf_get_pixel(src_use, src_col, x, y, xrad, yrad); + srcfp= compbuf_get_pixel(src_use, src_col, color, x, y, xrad, yrad); func(node, outfp, srcfp); } } @@ -471,6 +472,7 @@ void composit2_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, floa { CompBuf *src_use, *fac_use; float *outfp=out->rect, *srcfp, *facfp; + float color[4]; /* local color if compbuf is procedural */ int xrad, yrad, x, y; src_use= typecheck_compbuf(src_buf, src_type); @@ -481,8 +483,8 @@ void composit2_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, floa for(y= -yrad; y<-yrad+out->y; y++) { for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) { - srcfp= compbuf_get_pixel(src_use, src_col, x, y, xrad, yrad); - facfp= compbuf_get_pixel(fac_use, fac, x, y, xrad, yrad); + srcfp= compbuf_get_pixel(src_use, src_col, color, x, y, xrad, yrad); + facfp= compbuf_get_pixel(fac_use, fac, color, x, y, xrad, yrad); func(node, outfp, srcfp, facfp); } @@ -500,6 +502,7 @@ void composit3_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo { CompBuf *src1_use, *src2_use, *fac_use; float *outfp=out->rect, *src1fp, *src2fp, *facfp; + float color[4]; /* local color if compbuf is procedural */ int xrad, yrad, x, y; src1_use= typecheck_compbuf(src1_buf, src1_type); @@ -511,9 +514,9 @@ void composit3_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo for(y= -yrad; y<-yrad+out->y; y++) { for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) { - src1fp= compbuf_get_pixel(src1_use, src1_col, x, y, xrad, yrad); - src2fp= compbuf_get_pixel(src2_use, src2_col, x, y, xrad, yrad); - facfp= compbuf_get_pixel(fac_use, fac, x, y, xrad, yrad); + src1fp= compbuf_get_pixel(src1_use, src1_col, color, x, y, xrad, yrad); + src2fp= compbuf_get_pixel(src2_use, src2_col, color, x, y, xrad, yrad); + facfp= compbuf_get_pixel(fac_use, fac, color, x, y, xrad, yrad); func(node, outfp, src1fp, src2fp, facfp); } @@ -535,6 +538,7 @@ void composit4_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo { CompBuf *src1_use, *src2_use, *fac1_use, *fac2_use; float *outfp=out->rect, *src1fp, *src2fp, *fac1fp, *fac2fp; + float color[4]; /* local color if compbuf is procedural */ int xrad, yrad, x, y; src1_use= typecheck_compbuf(src1_buf, src1_type); @@ -547,10 +551,10 @@ void composit4_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo for(y= -yrad; y<-yrad+out->y; y++) { for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) { - src1fp= compbuf_get_pixel(src1_use, src1_col, x, y, xrad, yrad); - src2fp= compbuf_get_pixel(src2_use, src2_col, x, y, xrad, yrad); - fac1fp= compbuf_get_pixel(fac1_use, fac1, x, y, xrad, yrad); - fac2fp= compbuf_get_pixel(fac2_use, fac2, x, y, xrad, yrad); + src1fp= compbuf_get_pixel(src1_use, src1_col, color, x, y, xrad, yrad); + src2fp= compbuf_get_pixel(src2_use, src2_col, color, x, y, xrad, yrad); + fac1fp= compbuf_get_pixel(fac1_use, fac1, color, x, y, xrad, yrad); + fac2fp= compbuf_get_pixel(fac2_use, fac2, color, x, y, xrad, yrad); func(node, outfp, src1fp, fac1fp, src2fp, fac2fp); } diff --git a/source/blender/nodes/intern/CMP_util.h b/source/blender/nodes/intern/CMP_util.h index 9dfea6abf54..19c48d8f083 100644 --- a/source/blender/nodes/intern/CMP_util.h +++ b/source/blender/nodes/intern/CMP_util.h @@ -117,7 +117,6 @@ CompBuf *get_cropped_compbuf(rcti *drect, float *rectf, int rectx, int recty, in CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy); CompBuf *typecheck_compbuf(CompBuf *inbuf, int type); void typecheck_compbuf_color(float *out, float *in, int outtype, int intype); -float *compbuf_get_pixel(CompBuf *cbuf, float *rectf, int x, int y, int xrad, int yrad); /* **************************************************** */ |