diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-07-20 17:03:04 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-07-20 17:03:04 +0300 |
commit | 21f27692daece6b6aea2887bc99d4b67d7764935 (patch) | |
tree | 6d498f2558b91bd9b6997afb71feb04054eb8429 /source | |
parent | 83b0bf91660c3421fa56a4b7a83f971bf793ffde (diff) |
Depsgraph: Use explicit material update operation code
Avoids string comparison on key matching.
Diffstat (limited to 'source')
5 files changed, 8 insertions, 10 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 8826c946c73..b7678bbd9a3 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -1097,8 +1097,10 @@ void DepsgraphNodeBuilder::build_material(Material *ma) /* material itself */ add_id_node(ma_id); - add_operation_node(ma_id, DEG_NODE_TYPE_SHADING, NULL, - DEG_OPCODE_PLACEHOLDER, "Material Update"); + add_operation_node(ma_id, + DEG_NODE_TYPE_SHADING, + NULL, + DEG_OPCODE_MATERIAL_UPDATE); /* material animation */ build_animdata(ma_id); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index afb89e9f117..1bfb3bbb71d 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -1513,8 +1513,7 @@ void DepsgraphRelationBuilder::build_obdata_geom(Main *bmain, Scene *scene, Obje if (ob->type == OB_MESH) { OperationKey material_key(&ma->id, DEG_NODE_TYPE_SHADING, - DEG_OPCODE_PLACEHOLDER, - "Material Update"); + DEG_OPCODE_MATERIAL_UPDATE); OperationKey shading_key(&ob->id, DEG_NODE_TYPE_SHADING, DEG_OPCODE_SHADING); add_relation(material_key, shading_key, "Material Update"); } @@ -1754,8 +1753,7 @@ void DepsgraphRelationBuilder::build_material(Material *ma) DEG_OPCODE_PARAMETERS_EVAL); OperationKey material_key(&ma->id, DEG_NODE_TYPE_SHADING, - DEG_OPCODE_PLACEHOLDER, - "Material Update"); + DEG_OPCODE_MATERIAL_UPDATE); add_relation(ntree_key, material_key, "Material's NTree"); } } diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cc b/source/blender/depsgraph/intern/depsgraph_type_defines.cc index dfffe0e7a79..b757d4ba37e 100644 --- a/source/blender/depsgraph/intern/depsgraph_type_defines.cc +++ b/source/blender/depsgraph/intern/depsgraph_type_defines.cc @@ -141,6 +141,7 @@ static const char *stringify_opcode(eDepsOperation_Code opcode) STRINGIFY_OPCODE(COPY_ON_WRITE); /* Shading. */ STRINGIFY_OPCODE(SHADING); + STRINGIFY_OPCODE(MATERIAL_UPDATE); case DEG_NUM_OPCODES: return "SpecialCase"; #undef STRINGIFY_OPCODE diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h index 32385668f94..4371483193b 100644 --- a/source/blender/depsgraph/intern/depsgraph_types.h +++ b/source/blender/depsgraph/intern/depsgraph_types.h @@ -224,6 +224,7 @@ typedef enum eDepsOperation_Code { /* Shading. ------------------------------------------- */ DEG_OPCODE_SHADING, + DEG_OPCODE_MATERIAL_UPDATE, DEG_NUM_OPCODES, } eDepsOperation_Code; diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index 42d914b1a71..5d4015f64bd 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -298,10 +298,6 @@ static void material_changed(Main *bmain, Material *ma) /* icons */ BKE_icon_changed(BKE_icon_id_ensure(&ma->id)); - /* glsl */ - if (ma->gpumaterial.first) - GPU_material_free(&ma->gpumaterial); - /* find node materials using this */ for (parent = bmain->mat.first; parent; parent = parent->id.next) { if (parent->use_nodes && parent->nodetree && nodes_use_material(parent->nodetree, ma)) { |