Commit: 40a0fa8a8f1299e614ecaf6c271ef5a7fa02ee46
Author: Sergey Sharybin
Date:   Tue Jul 26 10:38:13 2016 +0200
Branches: master
https://developer.blender.org/rB40a0fa8a8f1299e614ecaf6c271ef5a7fa02ee46

Depsgraph: Use proper unsigned int bitfield for layers flags

===================================================================

M       source/blender/depsgraph/DEG_depsgraph.h
M       source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc
M       source/blender/depsgraph/intern/depsgraph.h
M       source/blender/depsgraph/intern/depsgraph_eval.cc
M       source/blender/depsgraph/intern/eval/deg_eval.cc
M       source/blender/depsgraph/intern/eval/deg_eval.h
M       source/blender/depsgraph/intern/nodes/deg_node.h
M       source/blender/depsgraph/intern/nodes/deg_node_component.cc
M       source/blender/depsgraph/intern/nodes/deg_node_component.h

===================================================================

diff --git a/source/blender/depsgraph/DEG_depsgraph.h 
b/source/blender/depsgraph/DEG_depsgraph.h
index d1de83e..945a478 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -168,7 +168,7 @@ void DEG_evaluate_on_framechange(struct EvaluationContext 
*eval_ctx,
                                  struct Main *bmain,
                                  Depsgraph *graph,
                                  float ctime,
-                                 const int layer);
+                                 const unsigned int layer);
 
 /* Data changed recalculation entry point.
  * < context_type: context to perform evaluation for
@@ -176,7 +176,7 @@ void DEG_evaluate_on_framechange(struct EvaluationContext 
*eval_ctx,
  */
 void DEG_evaluate_on_refresh_ex(struct EvaluationContext *eval_ctx,
                                 Depsgraph *graph,
-                                const int layers);
+                                const unsigned int layers);
 
 /* Data changed recalculation entry point.
  * < context_type: context to perform evaluation for
diff --git a/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc 
b/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc
index 5ce84ee..9088e3b 100644
--- a/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc
+++ b/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc
@@ -288,7 +288,7 @@ static void deg_debug_graphviz_node_single(const 
DebugContext &ctx,
        if (node->type == DEPSNODE_TYPE_ID_REF) {
                IDDepsNode *id_node = (IDDepsNode *)node;
                char buf[256];
-               BLI_snprintf(buf, sizeof(buf), " (Layers: %d)", 
id_node->layers);
+               BLI_snprintf(buf, sizeof(buf), " (Layers: %u)", 
id_node->layers);
                name += buf;
        }
        if (ctx.show_eval_priority && node->tclass == DEPSNODE_CLASS_OPERATION) 
{
@@ -324,7 +324,7 @@ static void deg_debug_graphviz_node_cluster_begin(const 
DebugContext &ctx,
        if (node->type == DEPSNODE_TYPE_ID_REF) {
                IDDepsNode *id_node = (IDDepsNode *)node;
                char buf[256];
-               BLI_snprintf(buf, sizeof(buf), " (Layers: %d)", 
id_node->layers);
+               BLI_snprintf(buf, sizeof(buf), " (Layers: %u)", 
id_node->layers);
                name += buf;
        }
        deg_debug_fprintf(ctx, "// %s\n", name.c_str());
diff --git a/source/blender/depsgraph/intern/depsgraph.h 
b/source/blender/depsgraph/intern/depsgraph.h
index 213bb30..08b264f 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -191,7 +191,7 @@ struct Depsgraph {
        /* Layers Visibility .................. */
 
        /* Visible layers bitfield, used for skipping invisible objects 
updates. */
-       int layers;
+       unsigned int layers;
 
        // XXX: additional stuff like eval contexts, mempools for allocating 
nodes from, etc.
 };
diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc 
b/source/blender/depsgraph/intern/depsgraph_eval.cc
index f8d40d0..a0435c3 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.cc
+++ b/source/blender/depsgraph/intern/depsgraph_eval.cc
@@ -133,7 +133,7 @@ void DEG_evaluate_on_framechange(EvaluationContext 
*eval_ctx,
                                  Main *bmain,
                                  Depsgraph *graph,
                                  float ctime,
-                                 const int layers)
+                                 const unsigned int layers)
 {
        DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
        /* Update time on primary timesource. */
diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc 
b/source/blender/depsgraph/intern/eval/deg_eval.cc
index 3024d62..c3fd202 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval.cc
@@ -72,13 +72,13 @@ namespace DEG {
 static void schedule_children(TaskPool *pool,
                               Depsgraph *graph,
                               OperationDepsNode *node,
-                              const int layers,
+                              const unsigned int layers,
                               const int thread_id);
 
 struct DepsgraphEvalState {
        EvaluationContext *eval_ctx;
        Depsgraph *graph;
-       int layers;
+       unsigned int layers;
 };
 
 static void deg_task_run_func(TaskPool *pool,
@@ -140,7 +140,7 @@ static void deg_task_run_func(TaskPool *pool,
                        OperationDepsNode *child = (OperationDepsNode *)rel->to;
                        BLI_assert(child->type == DEPSNODE_TYPE_OPERATION);
                        if (!child->scheduled) {
-                               int id_layers = child->owner->owner->layers;
+                               unsigned int id_layers = 
child->owner->owner->layers;
                                if (!((child->flag & DEPSOP_FLAG_NEEDS_UPDATE) 
!= 0 &&
                                      (id_layers & state->layers) != 0))
                                {
@@ -197,14 +197,14 @@ static void deg_task_run_func(TaskPool *pool,
 
 typedef struct CalculatePengindData {
        Depsgraph *graph;
-       int layers;
+       unsigned int layers;
 } CalculatePengindData;
 
 static void calculate_pending_func(void *data_v, int i)
 {
        CalculatePengindData *data = (CalculatePengindData *)data_v;
        Depsgraph *graph = data->graph;
-       int layers = data->layers;
+       unsigned int layers = data->layers;
        OperationDepsNode *node = graph->operations[i];
        IDDepsNode *id_node = node->owner->owner;
 
@@ -231,7 +231,7 @@ static void calculate_pending_func(void *data_v, int i)
        }
 }
 
-static void calculate_pending_parents(Depsgraph *graph, int layers)
+static void calculate_pending_parents(Depsgraph *graph, unsigned int layers)
 {
        const int num_operations = graph->operations.size();
        const bool do_threads = num_operations > 256;
@@ -276,11 +276,11 @@ static void calculate_eval_priority(OperationDepsNode 
*node)
  *   dec_parents: Decrement pending parents count, true when child nodes are
  *                scheduled after a task has been completed.
  */
-static void schedule_node(TaskPool *pool, Depsgraph *graph, int layers,
+static void schedule_node(TaskPool *pool, Depsgraph *graph, unsigned int 
layers,
                           OperationDepsNode *node, bool dec_parents,
                           const int thread_id)
 {
-       int id_layers = node->owner->owner->layers;
+       unsigned int id_layers = node->owner->owner->layers;
 
        if ((node->flag & DEPSOP_FLAG_NEEDS_UPDATE) != 0 &&
            (id_layers & layers) != 0)
@@ -314,7 +314,7 @@ static void schedule_node(TaskPool *pool, Depsgraph *graph, 
int layers,
 
 static void schedule_graph(TaskPool *pool,
                            Depsgraph *graph,
-                           const int layers)
+                           const unsigned int layers)
 {
        foreach (OperationDepsNode *node, graph->operations) {
                schedule_node(pool, graph, layers, node, false, 0);
@@ -324,7 +324,7 @@ static void schedule_graph(TaskPool *pool,
 static void schedule_children(TaskPool *pool,
                               Depsgraph *graph,
                               OperationDepsNode *node,
-                              const int layers,
+                              const unsigned int layers,
                               const int thread_id)
 {
        foreach (DepsRelation *rel, node->outlinks) {
@@ -352,7 +352,7 @@ static void schedule_children(TaskPool *pool,
  */
 void deg_evaluate_on_refresh(EvaluationContext *eval_ctx,
                              Depsgraph *graph,
-                             const int layers)
+                             const unsigned int layers)
 {
        /* Generate base evaluation context, upon which all the others are 
derived. */
        // TODO: this needs both main and scene access...
diff --git a/source/blender/depsgraph/intern/eval/deg_eval.h 
b/source/blender/depsgraph/intern/eval/deg_eval.h
index 92f87b0..49c0379 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval.h
+++ b/source/blender/depsgraph/intern/eval/deg_eval.h
@@ -47,6 +47,6 @@ struct Depsgraph;
  */
 void deg_evaluate_on_refresh(EvaluationContext *eval_ctx,
                              Depsgraph *graph,
-                             const int layers);
+                             const unsigned int layers);
 
 }  // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node.h 
b/source/blender/depsgraph/intern/nodes/deg_node.h
index 4169960..b2262c4 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node.h
+++ b/source/blender/depsgraph/intern/nodes/deg_node.h
@@ -176,7 +176,7 @@ struct IDDepsNode : public DepsNode {
        GHash *components;
 
        /* Layers of this node with accumulated layers of it's output 
relations. */
-       int layers;
+       unsigned int layers;
 
        /* Additional flags needed for scene evaluation.
         * TODO(sergey): Only needed for until really granular updates
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.cc 
b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
index 6ac45c9..5832c45 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.cc
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
@@ -120,7 +120,7 @@ string ComponentDepsNode::identifier() const
        sprintf(typebuf, "(%d)", type);
 
        char layers[16];
-       sprintf(layers, "%d", this->layers);
+       sprintf(layers, "%u", this->layers);
 
        return string(typebuf) + name + " : " + idname + " (Layers: " + layers 
+ ")";
 }
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.h 
b/source/blender/depsgraph/intern/nodes/deg_node_component.h
index 6f62d91..acccb1c 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.h
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.h
@@ -159,7 +159,7 @@ struct ComponentDepsNode : public DepsNode {
        // XXX: a poll() callback to check if component's first node can be 
started?
 
        /* Temporary bitmask, used during graph construction. */
-       int layers;
+       unsigned int layers;
 };
 
 /* ---------------------------------------- */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to