[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31280] branches/particles-2010/source/ blender/nodes/intern: Fixed missing output stream initialisation due to mix of init calls and boolean shortcut logic .
Lukas Toenne
lukas.toenne at googlemail.com
Thu Aug 12 12:15:21 CEST 2010
Revision: 31280
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31280
Author: lukastoenne
Date: 2010-08-12 12:15:20 +0200 (Thu, 12 Aug 2010)
Log Message:
-----------
Fixed missing output stream initialisation due to mix of init calls and boolean shortcut logic. Set fill count on default sockets to 1 for input stream validity.
Modified Paths:
--------------
branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_math.c
branches/particles-2010/source/blender/nodes/intern/SIM_util.c
branches/particles-2010/source/blender/nodes/intern/SIM_util.h
branches/particles-2010/source/blender/nodes/intern/node_tree_simulation.c
Modified: branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_math.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_math.c 2010-08-12 09:50:04 UTC (rev 31279)
+++ branches/particles-2010/source/blender/nodes/intern/SIM_nodes/SIM_math.c 2010-08-12 10:15:20 UTC (rev 31280)
@@ -75,7 +75,7 @@
{ -1, 0, "" }
};
-inline static void exec_float(SimNodeThreadContext *ctx, SimNodeJob *job, float(*floatfunc)(float))
+static void exec_float(SimNodeThreadContext *ctx, SimNodeJob *job, float(*floatfunc)(float))
{
SimNodeDataStream istream[1];
SimNodeDataStream ostream[1];
@@ -85,7 +85,7 @@
SIM_JOBEXEC_END(ctx, job)
}
-inline static void exec_int_float(SimNodeThreadContext *ctx, SimNodeJob *job, int(*func)(float))
+static void exec_int_float(SimNodeThreadContext *ctx, SimNodeJob *job, int(*func)(float))
{
SimNodeDataStream istream[1];
SimNodeDataStream ostream[1];
@@ -95,7 +95,7 @@
SIM_JOBEXEC_END(ctx, job)
}
-inline static void exec_binary_float(SimNodeThreadContext *ctx, SimNodeJob *job, float(*floatfunc)(float, float))
+static void exec_binary_float(SimNodeThreadContext *ctx, SimNodeJob *job, float(*floatfunc)(float, float))
{
SimNodeDataStream istream[2];
SimNodeDataStream ostream[1];
@@ -105,7 +105,7 @@
SIM_JOBEXEC_END(ctx, job)
}
-inline static void exec_binary_int(SimNodeThreadContext *ctx, SimNodeJob *job, int (*intfunc)(int, int))
+static void exec_binary_int(SimNodeThreadContext *ctx, SimNodeJob *job, int (*intfunc)(int, int))
{
SimNodeDataStream istream[2];
SimNodeDataStream ostream[1];
@@ -115,7 +115,7 @@
SIM_JOBEXEC_END(ctx, job)
}
-inline static void exec_binary_bool(SimNodeThreadContext *ctx, SimNodeJob *job, char (*boolfunc)(char, char))
+static void exec_binary_bool(SimNodeThreadContext *ctx, SimNodeJob *job, char (*boolfunc)(char, char))
{
SimNodeDataStream istream[2];
@@ -126,7 +126,7 @@
SIM_JOBEXEC_END(ctx, job)
}
-inline static void exec_binary_vector(SimNodeThreadContext *ctx, SimNodeJob *job, void (*vectorfunc)(float*, float*, float*))
+static void exec_binary_vector(SimNodeThreadContext *ctx, SimNodeJob *job, void (*vectorfunc)(float*, float*, float*))
{
SimNodeDataStream istream[2];
SimNodeDataStream ostream[1];
@@ -138,7 +138,7 @@
SIM_JOBEXEC_END(ctx, job)
}
-inline static void exec_binary_rgba(SimNodeThreadContext *ctx, SimNodeJob *job, void (*rgbafunc)(float*, float*, float*))
+static void exec_binary_rgba(SimNodeThreadContext *ctx, SimNodeJob *job, void (*rgbafunc)(float*, float*, float*))
{
SimNodeDataStream istream[2];
SimNodeDataStream ostream[1];
@@ -150,7 +150,7 @@
SIM_JOBEXEC_END(ctx, job)
}
-inline static void exec_binary_bool_any_any(SimNodeThreadContext *ctx, SimNodeJob *job,
+static void exec_binary_bool_any_any(SimNodeThreadContext *ctx, SimNodeJob *job,
char(*floatfunc)(float, float),
char(*intfunc)(int, int),
char(*boolfunc)(char, char),
Modified: branches/particles-2010/source/blender/nodes/intern/SIM_util.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/SIM_util.c 2010-08-12 09:50:04 UTC (rev 31279)
+++ branches/particles-2010/source/blender/nodes/intern/SIM_util.c 2010-08-12 10:15:20 UTC (rev 31280)
@@ -230,8 +230,7 @@
batch->filter = NULL;
batch->flag = NODE_DATA_EXTERNAL; /* using bNodeSocket members */
batch->start = 0;
- batch->totdata = 1;
- batch->fill = 0;
+ batch->fill = batch->totdata = 1;
batch->branches_done = 0; /* not used */
}
@@ -363,7 +362,7 @@
int sim_ostream_init(SimNodeDataStream *stream, SimNodeThreadContext *ctx, SimNodeJob *job, int start)
{
/* Note: Data is initially unfiltered. The filter array gets allocated as soon as an element is skipped/filtered */
- int i;
+ int i, valid = 1;
for (i=0; i < job->node->totoutputs; ++i, ++stream) {
stream->total = job->node->totoutputs;
stream->sock = job->node->outputs + i;
@@ -376,12 +375,14 @@
sim_init_collection_batch(stream->batch, stream->sock->datatype, start, ctx->sim->ntmd->batchsize, 0);
stream->valid = (stream->batch->totdata > 0);
}
+ if (!stream->valid)
+ valid = 0;
stream->datasize = sim_get_data_size(stream->sock->datatype);
stream->current = 0;
stream->data = stream->batch->data;
stream->filter = NULL;
}
- return 1;
+ return valid;
}
void sim_ostream_close(SimNodeDataStream *stream, SimNodeThreadContext *ctx, SimNodeJob *job)
Modified: branches/particles-2010/source/blender/nodes/intern/SIM_util.h
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/SIM_util.h 2010-08-12 09:50:04 UTC (rev 31279)
+++ branches/particles-2010/source/blender/nodes/intern/SIM_util.h 2010-08-12 10:15:20 UTC (rev 31280)
@@ -196,17 +196,21 @@
#define SIM_JOBEXEC_BEGIN(ctx, job, istream, ostream) \
{ \
- int i, valid; \
+ int i, ivalid, ovalid; \
if (job->execlevel == 0) \
job->current = job->input_start; \
- valid = (sim_istream_init(istream, ctx, job) && sim_ostream_init(ostream, ctx, job, job->current)); \
- for (i=0; valid && i < job->input_totdata; ++i, ++job->current) { \
+ ivalid = sim_istream_init(istream, ctx, job); \
+ ovalid = sim_ostream_init(ostream, ctx, job, job->current); \
+ printf("ivalid=%d, ovalid=%d\n", ivalid, ovalid); \
+ for (i=0; ivalid && ovalid && i < job->input_totdata; ++i, ++job->current) { \
SIM_JOBEXEC_DEBUGPRINT \
{
#define SIM_JOBEXEC_END(ctx, job) \
} \
- valid = sim_istream_next(istream) && sim_ostream_next(ostream); \
+ ivalid = sim_istream_next(istream); \
+ ovalid = sim_ostream_next(ostream); \
} \
+ printf("ivalid=%d, ovalid=%d\n", ivalid, ovalid); \
SIM_JOBEXEC_DEBUGPRINT_END \
sim_istream_close(istream, ctx); \
sim_ostream_close(ostream, ctx, job); \
Modified: branches/particles-2010/source/blender/nodes/intern/node_tree_simulation.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/node_tree_simulation.c 2010-08-12 09:50:04 UTC (rev 31279)
+++ branches/particles-2010/source/blender/nodes/intern/node_tree_simulation.c 2010-08-12 10:15:20 UTC (rev 31280)
@@ -346,7 +346,91 @@
/* TODO it might be beneficial to use RW lock here or even per-node mutexes if searching for jobs takes significant time */
pthread_mutex_lock(&ctx->mutex);
+
while (1) {
+ #if 1
+ {
+ int i, k;
+ bNodeSocket *sock;
+ SimNodeBatch *batch;
+ printf("***** Jobs *****\n");
+ for (n=0, node=ctx->nodestack; n < ctx->totnode; ++n, ++node) {
+ printf("### Node %s: ###\n", node->node->name);
+ printf("--- Jobs ---\n");
+ for (job=node->jobs.first; job; job = job->next) {
+ printf("\tstart=%d, totdata=%d, current=%d ", job->input_start, job->input_totdata, job->current);
+ switch (job->state) {
+ case SIM_JOB_PREPARING: printf("preparing"); break;
+ case SIM_JOB_READY: printf("ready"); break;
+ case SIM_JOB_RUNNING: printf("running"); break;
+ case SIM_JOB_SUSPENDED: printf("suspended"); break;
+ case SIM_JOB_DONE: printf("done"); break;
+ case SIM_JOB_CANCEL: printf("cancel"); break;
+ }
+ printf(", batches=[");
+ for (i=0; i < job->node->totinputs; ++i) {
+ if (i > 0) printf(" ");
+ if (job->input[i]==NULL)
+ printf("-");
+ else
+ printf("X");
+ }
+ printf("]\n");
+ }
+ printf("--- Inputs ---\n");
+ for (i=0, sock=node->node->inputs.first; sock; ++i, sock = sock->next) {
+ printf("\t%s, type ", sock->name);
+ switch (node->inputs[i]->datatype) {
+ case SOCK_FLOAT: printf("float"); break;
+ case SOCK_INT: printf("int"); break;
+ case SOCK_BOOL: printf("bool"); break;
+ case SOCK_VECTOR: printf("vector"); break;
+ case SOCK_RGBA: printf("rgba"); break;
+ case SOCK_OP: printf("operator"); break;
+ }
+ printf(", context ");
+ switch (node->inputs[i]->contexttype) {
+ case NDC_SINGLETON: printf("singleton"); break;
+ case NDC_PARTICLE: printf("particle"); break;
+ case NDC_VERTEX: printf("vertex"); break;
+ case NDC_EDGE: printf("edge"); break;
+ case NDC_FACE: printf("face"); break;
+ case NDC_NODE: printf("node"); break;
+ }
+ printf(":\n");
+ for (k=0, batch=node->inputs[i]->batches.first; batch; ++k, batch = batch->next)
+ printf("\t\tBatch start=%d, fill=%d, totdata=%d\n", batch->start, batch->fill, batch->totdata);
+ }
+ printf("--- Outputs ---\n");
+ for (i=0, sock=node->node->outputs.first; sock; ++i, sock = sock->next) {
+ printf("\t%s, type ", sock->name);
+ switch (node->outputs[i].datatype) {
+ case SOCK_FLOAT: printf("float"); break;
+ case SOCK_INT: printf("int"); break;
+ case SOCK_BOOL: printf("bool"); break;
+ case SOCK_VECTOR: printf("vector"); break;
+ case SOCK_RGBA: printf("rgba"); break;
+ case SOCK_OP: printf("operator"); break;
+ }
+ printf(", context ");
+ switch (node->outputs[i].contexttype) {
+ case NDC_SINGLETON: printf("singleton"); break;
+ case NDC_PARTICLE: printf("particle"); break;
+ case NDC_VERTEX: printf("vertex"); break;
+ case NDC_EDGE: printf("edge"); break;
+ case NDC_FACE: printf("face"); break;
+ case NDC_NODE: printf("node"); break;
+ }
+ printf(":\n");
+ for (k=0, batch=node->outputs[i].batches.first; batch; ++k, batch = batch->next)
+ printf("\t\tBatch start=%d, fill=%d, totdata=%d\n", batch->start, batch->fill, batch->totdata);
+ }
+
+ }
+ printf("****************\n");
+ }
+ #endif
+
/* starting at the right-most nodes helps making data freeable ASAP */
// printf("----------------------\n");
for (n=ctx->totnode-1, node=ctx->nodestack + ctx->totnode-1; n >= 0; --n, --node) {
@@ -846,7 +930,7 @@
threads[i].num= i;
}
-// printf("Executing simulation tree, threads=%d\n", ctx.totthread);
+ printf("Executing simulation tree, threads=%d\n", ctx.totthread);
/* execute threads */
if(ctx.totthread > 1) {
More information about the Bf-blender-cvs
mailing list