Blender V5.3
clamp.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
8#include "kernel/svm/util.h"
9
11
12/* Clamp Node */
13
16{
17 const float value = stack_load(stack, node.value);
18 const float min = stack_load(stack, node.min);
19 const float max = stack_load(stack, node.max);
20
21 if (node.clamp_type == NODE_CLAMP_RANGE && (min > max)) {
22 stack_store_float(stack, node.result_offset, clamp(value, max, min));
23 }
24 else {
25 stack_store_float(stack, node.result_offset, clamp(value, min, max));
26 }
27}
28
btScalar max
CCL_NAMESPACE_BEGIN ccl_device_noinline void svm_node_clamp(ccl_private float *ccl_restrict stack, const ccl_global SVMNodeClamp &ccl_restrict node)
Definition clamp.h:14
ccl_device_inline void stack_store_float(ccl_private float *stack, const uint a, const float f)
ccl_device_inline T stack_load(const ccl_private float *stack, const uint a)
#define ccl_restrict
#define ccl_private
#define ccl_global
#define ccl_device_noinline
#define CCL_NAMESPACE_END
constexpr T clamp(T, U, U) RET
@ NODE_CLAMP_RANGE
#define min(a, b)
Definition sort.cc:38