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:
authorJeroen Bakker <jeroen@blender.org>2020-12-18 12:26:02 +0300
committerJeroen Bakker <jeroen@blender.org>2020-12-18 12:26:02 +0300
commitfe5d2448c6e1348be1f82f10a65d65b992f2477b (patch)
treeb43ce935e4992e2401f8bc60ed3edecf573cb51f /source/blender/nodes/shader/nodes/node_shader_clamp.cc
parentffb6648a970e72a749c7de3c5645450ba7d8d858 (diff)
Fix T83494: Eevee clamp node incorrect when min > max.
In glsl the clamp function has undefined behavior when min > max. For the clamp node this resulted in differences between cycles and eevee. This patch adds the expected implementation for minmax. The old clamp function is still used in cases where we know for certain that the input values are correct (math node clamp option). GPU uses optimized code and silicon in these cases.
Diffstat (limited to 'source/blender/nodes/shader/nodes/node_shader_clamp.cc')
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_clamp.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_clamp.cc b/source/blender/nodes/shader/nodes/node_shader_clamp.cc
index d3a893e1d76..4f77421cfe0 100644
--- a/source/blender/nodes/shader/nodes/node_shader_clamp.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_clamp.cc
@@ -46,8 +46,9 @@ static int gpu_shader_clamp(GPUMaterial *mat,
GPUNodeStack *in,
GPUNodeStack *out)
{
- return (node->custom1 == NODE_CLAMP_MINMAX) ? GPU_stack_link(mat, node, "clamp_value", in, out) :
- GPU_stack_link(mat, node, "clamp_range", in, out);
+ return (node->custom1 == NODE_CLAMP_MINMAX) ?
+ GPU_stack_link(mat, node, "clamp_minmax", in, out) :
+ GPU_stack_link(mat, node, "clamp_range", in, out);
}
static void sh_node_clamp_expand_in_mf_network(blender::nodes::NodeMFNetworkBuilder &builder)