Blender V5.3
sepcomb_color.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
9#include "kernel/svm/util.h"
10
12
15{
16 const float r = stack_load(stack, node.red);
17 const float g = stack_load(stack, node.green);
18 const float b = stack_load(stack, node.blue);
19
20 /* Combine, and convert back to RGB */
21 const float3 color = svm_combine_color(node.color_type, make_float3(r, g, b));
22
23 if (stack_valid(node.color_offset)) {
24 stack_store_float3(stack, node.color_offset, color);
25 }
26}
27
29 ccl_private float *ccl_restrict stack,
31{
32 float3 color = stack_load(stack, node.color);
33
34 /* Convert color space */
35 color = svm_separate_color(node.color_type, color);
36
37 if (stack_valid(node.red_offset)) {
38 stack_store_float(stack, node.red_offset, color.x);
39 }
40 if (stack_valid(node.green_offset)) {
41 stack_store_float(stack, node.green_offset, color.y);
42 }
43 if (stack_valid(node.blue_offset)) {
44 stack_store_float(stack, node.blue_offset, color.z);
45 }
46}
47
ccl_device float3 svm_separate_color(NodeCombSepColorType type, const float3 color)
Definition color_util.h:396
ccl_device float3 svm_combine_color(NodeCombSepColorType type, const float3 color)
Definition color_util.h:383
ccl_device_inline void stack_store_float(ccl_private float *stack, const uint a, const float f)
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
ccl_device_forceinline float3 make_float3(const float x, const float y, const float z)
ccl_device_noinline void svm_node_separate_color(ccl_private float *ccl_restrict stack, const ccl_global SVMNodeSeparateColor &ccl_restrict node)
CCL_NAMESPACE_BEGIN ccl_device_noinline void svm_node_combine_color(ccl_private float *ccl_restrict stack, const ccl_global SVMNodeCombineColor &ccl_restrict node)
float z
Definition sky_math.h:136
float y
Definition sky_math.h:136
float x
Definition sky_math.h:136