Blender V4.5
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 ccl_private float *stack,
18 const uint in_fac,
19 const uint in_color,
20 const uint out_color)
21{
22 const float factor = stack_load_float(stack, in_fac);
23 float3 color = stack_load_float3(stack, in_color);
24
25 color.x = invert(color.x, factor);
26 color.y = invert(color.y, factor);
27 color.z = invert(color.z, factor);
28
29 if (stack_valid(out_color)) {
30 stack_store_float3(stack, out_color, color);
31 }
32}
33
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_device
#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 ShaderData *sd, ccl_private float *stack, const uint in_fac, const uint in_color, const uint out_color)
Definition invert.h:16
float z
Definition sky_float3.h:27
float y
Definition sky_float3.h:27
float x
Definition sky_float3.h:27