Blender V5.3
invert.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
12ccl_device float invert(const float color, const float factor)
13{
14 return factor * (1.0f - color) + (1.0f - factor) * color;
15}
16
19{
20 const float factor = stack_load(stack, node.fac);
21 float3 color = stack_load(stack, node.color);
22
23 color.x = invert(color.x, factor);
24 color.y = invert(color.y, factor);
25 color.z = invert(color.z, factor);
26
27 if (stack_valid(node.out_offset)) {
28 stack_store_float3(stack, node.out_offset, color);
29 }
30}
31
ccl_device_inline void stack_store_float3(ccl_private float *stack, const uint a, const float3 f)
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
float2x2 invert(float2x2 mat)
ccl_device_noinline void svm_node_invert(ccl_private float *ccl_restrict stack, const ccl_global SVMNodeInvert &ccl_restrict node)
Definition invert.h:17
#define ccl_device
float z
Definition sky_math.h:136
float y
Definition sky_math.h:136
float x
Definition sky_math.h:136