Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2017-10-27 17:07:44 +0300
committerClément Foucault <foucault.clem@gmail.com>2017-10-27 23:49:15 +0300
commit18ba7e26ad445981fb2750ec4bef1273f11d1554 (patch)
treeea935b8cb35d025ab86442bbcff5dc126f485a8b /source/blender/nodes
parent23f51a4e43b75514b1219efcde9767bab0c166c2 (diff)
GPUMaterial: Add a domain property.
This let us know efficiently if a material has a dedicated nodetree for each of it's output node input. Only works for Eevee at this moment.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/shader/node_shader_tree.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c
index b014da90145..67086d1f97d 100644
--- a/source/blender/nodes/shader/node_shader_tree.c
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -527,6 +527,35 @@ static void ntree_shader_tag_ssr_node(bNodeTree *ntree, short compatibility)
nodeChainIter(ntree, output_node, ntree_tag_ssr_bsdf_cb, &lobe_count, true);
}
+/* EEVEE: Find which material domain are used (volume, surface ...).
+ */
+void ntreeGPUMaterialDomain(bNodeTree *ntree, bool *has_surface_output, bool *has_volume_output)
+{
+ /* localize tree to create links for reroute and mute */
+ bNodeTree *localtree = ntreeLocalize(ntree);
+
+ struct bNode *output = ntree_shader_output_node(localtree);
+
+ *has_surface_output = false;
+ *has_volume_output = false;
+
+ if (output != NULL) {
+ bNodeSocket *surface_sock = ntree_shader_node_find_input(output, "Surface");
+ bNodeSocket *volume_sock = ntree_shader_node_find_input(output, "Volume");
+
+ if (surface_sock != NULL) {
+ *has_surface_output = (nodeCountSocketLinks(localtree, surface_sock) > 0);
+ }
+
+ if (volume_sock != NULL) {
+ *has_volume_output = (nodeCountSocketLinks(localtree, volume_sock) > 0);
+ }
+ }
+
+ ntreeFreeTree(localtree);
+ MEM_freeN(localtree);
+}
+
void ntreeGPUMaterialNodes(bNodeTree *ntree, GPUMaterial *mat, short compatibility)
{
/* localize tree to create links for reroute and mute */