[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33367] trunk/blender/source/blender/nodes /intern: Bugfix #24933
Ton Roosendaal
ton at blender.org
Sun Nov 28 19:34:16 CET 2010
Revision: 33367
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33367
Author: ton
Date: 2010-11-28 19:34:16 +0100 (Sun, 28 Nov 2010)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_texture.c
trunk/blender/source/blender/nodes/intern/CMP_util.c
trunk/blender/source/blender/nodes/intern/CMP_util.h
Modified: trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_texture.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_texture.c 2010-11-28 18:23:21 UTC (rev 33366)
+++ trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_texture.c 2010-11-28 18:34:16 UTC (rev 33367)
@@ -79,7 +79,7 @@
else {
VECCOPY(col, nor);
}
-
+
typecheck_compbuf_color(out, col, cbuf->type, cbuf->procedural_type);
}
@@ -110,7 +110,7 @@
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 @@
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;
Modified: trunk/blender/source/blender/nodes/intern/CMP_util.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/CMP_util.c 2010-11-28 18:23:21 UTC (rev 33366)
+++ trunk/blender/source/blender/nodes/intern/CMP_util.c 2010-11-28 18:34:16 UTC (rev 33367)
@@ -414,12 +414,12 @@
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 @@
return cbuf->rect + cbuf->type*( (cbuf->yrad+y)*cbuf->x + (cbuf->xrad+x) );
}
}
- else return rectf;
+ else return defcol;
}
/* **************************************************** */
@@ -446,6 +446,7 @@
{
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 @@
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 @@
{
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 @@
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 @@
{
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 @@
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 @@
{
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 @@
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);
}
Modified: trunk/blender/source/blender/nodes/intern/CMP_util.h
===================================================================
--- trunk/blender/source/blender/nodes/intern/CMP_util.h 2010-11-28 18:23:21 UTC (rev 33366)
+++ trunk/blender/source/blender/nodes/intern/CMP_util.h 2010-11-28 18:34:16 UTC (rev 33367)
@@ -117,7 +117,6 @@
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);
/* **************************************************** */
More information about the Bf-blender-cvs
mailing list