Blender V5.3
boolean_math.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
8#include "kernel/svm/util.h"
9
11
12ccl_device int svm_boolean_math(const NodeBooleanMathType type, const int a_int, const int b_int)
13{
14 const bool a = a_int > 0;
15 const bool b = b_int > 0;
16 bool result = false;
17
18 switch (type) {
20 result = a && b;
21 break;
23 result = a || b;
24 break;
26 result = !a;
27 break;
29 result = !(a && b);
30 break;
32 result = !(a || b);
33 break;
35 result = a == b;
36 break;
38 result = a != b;
39 break;
41 result = !a || b;
42 break;
44 result = a && !b;
45 break;
46 }
47
48 return result ? 1 : 0;
49}
50
53{
54 const int a = stack_load(stack, node.value1);
55 const int b = stack_load(stack, node.value2);
56 const int result = svm_boolean_math(node.math_type, a, b);
57
58 if (stack_valid(node.result_offset)) {
59 stack_store_int(stack, node.result_offset, result);
60 }
61}
62
CCL_NAMESPACE_BEGIN ccl_device int svm_boolean_math(const NodeBooleanMathType type, const int a_int, const int b_int)
ccl_device_noinline void svm_node_boolean_math(ccl_private float *ccl_restrict stack, const ccl_global SVMNodeBooleanMath &ccl_restrict node)
ccl_device_inline void stack_store_int(ccl_private float *stack, const uint a, const int i)
ccl_device_inline bool stack_valid(const uint a)
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
NodeBooleanMathType
@ NODE_BOOLEAN_MATH_IMPLY
@ NODE_BOOLEAN_MATH_AND
@ NODE_BOOLEAN_MATH_NAND
@ NODE_BOOLEAN_MATH_XOR
@ NODE_BOOLEAN_MATH_NOT
@ NODE_BOOLEAN_MATH_OR
@ NODE_BOOLEAN_MATH_NIMPLY
@ NODE_BOOLEAN_MATH_XNOR
@ NODE_BOOLEAN_MATH_NOR
#define ccl_device