diff options
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/shader/node_shader_tree.c | 15 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_output_aov.c | 19 |
2 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index efd0e48f41a..a385cb7039f 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -903,6 +903,16 @@ void ntreeGPUMaterialNodes(bNodeTree *localtree, /* Duplicate bump height branches for manual derivatives. */ nodeChainIterBackwards(localtree, output, ntree_shader_bump_branches, localtree, 0); + LISTBASE_FOREACH (bNode *, node, &localtree->nodes) { + if (node->type == SH_NODE_OUTPUT_AOV) { + nodeChainIterBackwards(localtree, node, ntree_shader_bump_branches, localtree, 0); + nTreeTags tags = { + .ssr_id = 1.0, + .sss_id = 1.0, + }; + ntree_shader_tag_nodes(localtree, node, &tags); + } + } /* TODO(fclem): consider moving this to the gpu shader tree evaluation. */ nTreeTags tags = { @@ -913,6 +923,11 @@ void ntreeGPUMaterialNodes(bNodeTree *localtree, exec = ntreeShaderBeginExecTree(localtree); ntreeExecGPUNodes(exec, mat, output); + LISTBASE_FOREACH (bNode *, node, &localtree->nodes) { + if (node->type == SH_NODE_OUTPUT_AOV) { + ntreeExecGPUNodes(exec, mat, node); + } + } ntreeShaderEndExecTree(exec); /* EEVEE: Find which material domain was used (volume, surface ...). */ diff --git a/source/blender/nodes/shader/nodes/node_shader_output_aov.c b/source/blender/nodes/shader/nodes/node_shader_output_aov.c index 8e73a547bf7..403b3e6d9d6 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_aov.c +++ b/source/blender/nodes/shader/nodes/node_shader_output_aov.c @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +#include "BLI_hash.h" + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_output_aov_in[] = { @@ -33,6 +35,22 @@ static void node_shader_init_output_aov(bNodeTree *UNUSED(ntree), bNode *node) node->storage = aov; } +static int node_shader_gpu_output_aov(GPUMaterial *mat, + bNode *node, + bNodeExecData *UNUSED(execdata), + GPUNodeStack *in, + GPUNodeStack *out) +{ + GPUNodeLink *outlink; + NodeShaderOutputAOV *aov = (NodeShaderOutputAOV *)node->storage; + /* Keep in sync with `renderpass_lib.glsl#render_pass_aov_hash`. */ + unsigned int hash = BLI_hash_string(aov->name) & ~1; + GPU_stack_link(mat, node, "node_output_aov", in, out, &outlink); + GPU_material_add_output_link_aov(mat, outlink, hash); + + return true; +} + /* node type definition */ void register_node_type_sh_output_aov(void) { @@ -43,6 +61,7 @@ void register_node_type_sh_output_aov(void) node_type_init(&ntype, node_shader_init_output_aov); node_type_storage( &ntype, "NodeShaderOutputAOV", node_free_standard_storage, node_copy_standard_storage); + node_type_gpu(&ntype, node_shader_gpu_output_aov); /* Do not allow muting output node. */ node_type_internal_links(&ntype, NULL); |