Blender V5.0
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
7#include "kernel/svm/util.h"
8
10
11ccl_device float invert(const float color, const float factor)
12{
13 return factor * (1.0f - color) + (1.0f - factor) * color;
14}
15
17 const uint in_fac,
18 const uint in_color,
19 const uint out_color)
20{
21 const float factor = stack_load_float(stack, in_fac);
22 float3 color = stack_load_float3(stack, in_color);
23
24 color.x = invert(color.x, factor);
25 color.y = invert(color.y, factor);
26 color.z = invert(color.z, factor);
27
28 if (stack_valid(out_color)) {
29 stack_store_float3(stack, out_color, color);
30 }
31}
32
unsigned int uint
ccl_device_inline float stack_load_float(const ccl_private float *stack, const uint a)
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_NAMESPACE_BEGIN ccl_device_inline float3 stack_load_float3(const ccl_private float *stack, const uint a)
#define ccl_private
#define ccl_device_noinline
#define CCL_NAMESPACE_END
CCL_NAMESPACE_BEGIN ccl_device float invert(const float color, const float factor)
Definition invert.h:11
ccl_device_noinline void svm_node_invert(ccl_private float *stack, const uint in_fac, const uint in_color, const uint out_color)
Definition invert.h:16
#define ccl_device
float z
Definition sky_math.h:136
float y
Definition sky_math.h:136
float x
Definition sky_math.h:136