Depsgraph: Use explicit parameters eval operation code
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 18 Jul 2017 09:55:06 +0000 (11:55 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 25 Oct 2017 09:25:10 +0000 (11:25 +0200)
This replaces usage of generic PLACEHOLDEWR with string lookup with more
explicit opcode. This should make it faster to build dependency graph by
avoiding string comparisons when it's not needed.

There should be no user measurable different.

source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.cc

index 22c884a86de4b5a1c5ae804c626591e835205acb..0a4974954067d7406689db129c1681f51da1084c 100644 (file)
@@ -578,9 +578,10 @@ void DepsgraphNodeBuilder::build_world(World *world)
 
        /* world itself */
        add_component_node(world_id, DEG_NODE_TYPE_PARAMETERS);
-
-       add_operation_node(world_id, DEG_NODE_TYPE_PARAMETERS, NULL,
-                          DEG_OPCODE_PLACEHOLDER, "Parameters Eval");
+       add_operation_node(world_id,
+                          DEG_NODE_TYPE_PARAMETERS,
+                          NULL,
+                          DEG_OPCODE_PARAMETERS_EVAL);
 
        /* textures */
        build_texture_stack(world->mtex);
@@ -734,8 +735,7 @@ void DepsgraphNodeBuilder::build_obdata_geom(Scene *scene, Object *ob)
        op_node = add_operation_node(&ob->id,
                                     DEG_NODE_TYPE_PARAMETERS,
                                     NULL,
-                                    DEG_OPCODE_PLACEHOLDER,
-                                    "Parameters Eval");
+                                    DEG_OPCODE_PARAMETERS_EVAL);
        op_node->set_as_exit();
 
        /* Temporary uber-update node, which does everything.
@@ -883,8 +883,10 @@ void DepsgraphNodeBuilder::build_obdata_geom(Scene *scene, Object *ob)
        op_node->set_as_exit();
 
        /* Parameters for driver sources. */
-       add_operation_node(obdata, DEG_NODE_TYPE_PARAMETERS, NULL,
-                          DEG_OPCODE_PLACEHOLDER, "Parameters Eval");
+       add_operation_node(obdata,
+                          DEG_NODE_TYPE_PARAMETERS,
+                          NULL,
+                          DEG_OPCODE_PARAMETERS_EVAL);
 }
 
 /* Cameras */
@@ -899,8 +901,10 @@ void DepsgraphNodeBuilder::build_camera(Object *ob)
 
        build_animdata(&cam->id);
 
-       add_operation_node(camera_id, DEG_NODE_TYPE_PARAMETERS, NULL,
-                          DEG_OPCODE_PLACEHOLDER, "Parameters Eval");
+       add_operation_node(camera_id,
+                          DEG_NODE_TYPE_PARAMETERS,
+                          NULL,
+                          DEG_OPCODE_PARAMETERS_EVAL);
 
        if (cam->dof_ob != NULL) {
                /* TODO(sergey): For now parametrs are on object level. */
@@ -924,8 +928,10 @@ void DepsgraphNodeBuilder::build_lamp(Object *ob)
        add_component_node(lamp_id, DEG_NODE_TYPE_PARAMETERS);
 
        /* TODO(sergey): Is it really how we're supposed to work with drivers? */
-       add_operation_node(lamp_id, DEG_NODE_TYPE_PARAMETERS, NULL,
-                          DEG_OPCODE_PLACEHOLDER, "Parameters Eval");
+       add_operation_node(lamp_id,
+                          DEG_NODE_TYPE_PARAMETERS,
+                          NULL,
+                          DEG_OPCODE_PARAMETERS_EVAL);
 
        /* lamp's nodetree */
        if (la->nodetree) {
@@ -948,8 +954,10 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree)
        build_animdata(ntree_id);
 
        /* Parameters for drivers. */
-       op_node = add_operation_node(ntree_id, DEG_NODE_TYPE_PARAMETERS, NULL,
-                                    DEG_OPCODE_PLACEHOLDER, "Parameters Eval");
+       op_node = add_operation_node(ntree_id,
+                                    DEG_NODE_TYPE_PARAMETERS,
+                                    NULL,
+                                    DEG_OPCODE_PARAMETERS_EVAL);
        op_node->set_as_exit();
 
        /* nodetree's nodes... */
index 1b44026bc226487da766cf5c5b3aca84a296d70d..f0f4cf3dc29c1c82378c6e91994dc23920978b0e 100644 (file)
@@ -1715,8 +1715,7 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)
 
        OperationKey parameters_key(ntree_id,
                                    DEG_NODE_TYPE_PARAMETERS,
-                                   DEG_OPCODE_PLACEHOLDER,
-                                   "Parameters Eval");
+                                   DEG_OPCODE_PARAMETERS_EVAL);
 
        /* nodetree's nodes... */
        LINKLIST_FOREACH (bNode *, bnode, &ntree->nodes) {
@@ -1735,8 +1734,7 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)
                                }
                                OperationKey group_parameters_key(&group_ntree->id,
                                                                  DEG_NODE_TYPE_PARAMETERS,
-                                                                 DEG_OPCODE_PLACEHOLDER,
-                                                                 "Parameters Eval");
+                                                                 DEG_OPCODE_PARAMETERS_EVAL);
                                add_relation(group_parameters_key, parameters_key, "Group Node");
                        }
                }
@@ -1768,8 +1766,7 @@ void DepsgraphRelationBuilder::build_material(Material *ma)
                build_nodetree(ma->nodetree);
                OperationKey ntree_key(&ma->nodetree->id,
                                       DEG_NODE_TYPE_PARAMETERS,
-                                      DEG_OPCODE_PLACEHOLDER,
-                                      "Parameters Eval");
+                                      DEG_OPCODE_PARAMETERS_EVAL);
                OperationKey material_key(&ma->id,
                                          DEG_NODE_TYPE_SHADING,
                                          DEG_OPCODE_PLACEHOLDER,