Blender  V2.93
svm_mix.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2013 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 /* Node */
20 
21 ccl_device void svm_node_mix(KernelGlobals *kg,
22  ShaderData *sd,
23  float *stack,
24  uint fac_offset,
25  uint c1_offset,
26  uint c2_offset,
27  int *offset)
28 {
29  /* read extra data */
30  uint4 node1 = read_node(kg, offset);
31 
32  float fac = stack_load_float(stack, fac_offset);
33  float3 c1 = stack_load_float3(stack, c1_offset);
34  float3 c2 = stack_load_float3(stack, c2_offset);
35  float3 result = svm_mix((NodeMix)node1.y, fac, c1, c2);
36 
37  stack_store_float3(stack, node1.z, result);
38 }
39 
unsigned int uint
Definition: BLI_sys_types.h:83
CCL_NAMESPACE_BEGIN ccl_device_inline float3 stack_load_float3(float *stack, uint a)
ccl_device_inline uint4 read_node(KernelGlobals *kg, int *offset)
ccl_device_inline float stack_load_float(float *stack, uint a)
ccl_device_inline void stack_store_float3(float *stack, uint a, float3 f)
#define ccl_device
#define CCL_NAMESPACE_END
ShaderData
ccl_device_noinline_cpu float3 svm_mix(NodeMix type, float fac, float3 c1, float3 c2)
CCL_NAMESPACE_BEGIN ccl_device void svm_node_mix(KernelGlobals *kg, ShaderData *sd, float *stack, uint fac_offset, uint c1_offset, uint c2_offset, int *offset)
Definition: svm_mix.h:21
NodeMix
Definition: svm_types.h:249