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>2022-06-29 12:35:36 +0300
committerThomas Dinges <blender@dingto.org>2022-06-29 17:18:12 +0300
commitf2a7be6e75db35f7d1945e4a0d443c0120f7b8cb (patch)
tree1c059365fdae9e5db0daf45403dada749d3b0a36
parent5b1a8a0e2f81ed8f0962970a81c850cd47169c20 (diff)
Fix T99104: EEVEE: Regression: Crash when using Light Output in Materials
Using Light output is supported in Cycles. This patch adds support for it and remove the crash in `ntree_shader_weight_tree_invert()` by treating it as any other outputs. Candidate for 3.2.1 corrective release.
-rw-r--r--source/blender/nodes/shader/node_shader_tree.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output_light.cc18
2 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/nodes/shader/node_shader_tree.cc b/source/blender/nodes/shader/node_shader_tree.cc
index 3cbd3f0d776..25387498df1 100644
--- a/source/blender/nodes/shader/node_shader_tree.cc
+++ b/source/blender/nodes/shader/node_shader_tree.cc
@@ -712,6 +712,7 @@ static void ntree_shader_weight_tree_invert(bNodeTree *ntree, bNode *output_node
switch (node->type) {
case SH_NODE_SHADERTORGB:
+ case SH_NODE_OUTPUT_LIGHT:
case SH_NODE_OUTPUT_WORLD:
case SH_NODE_OUTPUT_MATERIAL: {
/* Start the tree with full weight. */
@@ -810,6 +811,7 @@ static void ntree_shader_weight_tree_invert(bNodeTree *ntree, bNode *output_node
switch (node->type) {
case SH_NODE_SHADERTORGB:
+ case SH_NODE_OUTPUT_LIGHT:
case SH_NODE_OUTPUT_WORLD:
case SH_NODE_OUTPUT_MATERIAL:
case SH_NODE_ADD_SHADER: {
diff --git a/source/blender/nodes/shader/nodes/node_shader_output_light.cc b/source/blender/nodes/shader/nodes/node_shader_output_light.cc
index 0eb8a60fdaa..3707806841e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_light.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_output_light.cc
@@ -10,6 +10,22 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Shader>(N_("Surface"));
}
+static int node_shader_gpu_output_light(GPUMaterial *mat,
+ bNode *UNUSED(node),
+ bNodeExecData *UNUSED(execdata),
+ GPUNodeStack *in,
+ GPUNodeStack *UNUSED(out))
+{
+ GPUNodeLink *outlink_surface;
+ /* Passthrough node in order to do the right socket conversions. */
+ if (in[0].link) {
+ /* Reuse material output. */
+ GPU_link(mat, "node_output_material_surface", in[0].link, &outlink_surface);
+ GPU_material_output_surface(mat, outlink_surface);
+ }
+ return true;
+}
+
} // namespace blender::nodes::node_shader_output_light_cc
/* node type definition */
@@ -21,6 +37,8 @@ void register_node_type_sh_output_light()
sh_node_type_base(&ntype, SH_NODE_OUTPUT_LIGHT, "Light Output", NODE_CLASS_OUTPUT);
ntype.declare = file_ns::node_declare;
+ node_type_gpu(&ntype, file_ns::node_shader_gpu_output_light);
+
ntype.no_muting = true;
nodeRegisterType(&ntype);