Blender  V3.3
white_noise.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #pragma once
5 
7 
10  ccl_private float *stack,
11  uint dimensions,
12  uint inputs_stack_offsets,
13  uint ouptuts_stack_offsets)
14 {
15  uint vector_stack_offset, w_stack_offset, value_stack_offset, color_stack_offset;
16  svm_unpack_node_uchar2(inputs_stack_offsets, &vector_stack_offset, &w_stack_offset);
17  svm_unpack_node_uchar2(ouptuts_stack_offsets, &value_stack_offset, &color_stack_offset);
18 
19  float3 vector = stack_load_float3(stack, vector_stack_offset);
20  float w = stack_load_float(stack, w_stack_offset);
21 
22  if (stack_valid(color_stack_offset)) {
23  float3 color;
24  switch (dimensions) {
25  case 1:
27  break;
28  case 2:
30  break;
31  case 3:
33  break;
34  case 4:
36  break;
37  default:
38  color = make_float3(1.0f, 0.0f, 1.0f);
39  kernel_assert(0);
40  break;
41  }
42  stack_store_float3(stack, color_stack_offset, color);
43  }
44 
45  if (stack_valid(value_stack_offset)) {
46  float value;
47  switch (dimensions) {
48  case 1:
49  value = hash_float_to_float(w);
50  break;
51  case 2:
53  break;
54  case 3:
56  break;
57  case 4:
59  break;
60  default:
61  value = 0.0f;
62  kernel_assert(0);
63  break;
64  }
65  stack_store_float(stack, value_stack_offset, value);
66  }
67 }
68 
unsigned int uint
Definition: BLI_sys_types.h:67
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
#define kernel_assert(cond)
Definition: cpu/compat.h:34
#define ccl_private
Definition: cuda/compat.h:48
#define ccl_device_noinline
Definition: cuda/compat.h:40
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
const KernelGlobalsCPU *ccl_restrict KernelGlobals
ccl_device_inline float3 hash_float_to_float3(float k)
Definition: hash.h:184
ccl_device_inline float3 hash_float4_to_float3(float4 k)
Definition: hash.h:198
ccl_device_inline float3 hash_float2_to_float3(float2 k)
Definition: hash.h:191
ccl_device_inline float hash_float2_to_float(float2 k)
Definition: hash.h:144
ccl_device_inline float hash_float4_to_float(float4 k)
Definition: hash.h:154
ccl_device_inline float hash_float3_to_float(float3 k)
Definition: hash.h:149
ccl_device_inline float3 hash_float3_to_float3(float3 k)
Definition: hash.h:167
ccl_device_inline void stack_store_float3(ccl_private float *stack, uint a, float3 f)
CCL_NAMESPACE_BEGIN ccl_device_inline float3 stack_load_float3(ccl_private float *stack, uint a)
ccl_device_forceinline void svm_unpack_node_uchar2(uint i, ccl_private uint *x, ccl_private uint *y)
ccl_device_inline void stack_store_float(ccl_private float *stack, uint a, float f)
ccl_device_inline float stack_load_float(ccl_private float *stack, uint a)
ccl_device_inline bool stack_valid(uint a)
ShaderData
Definition: kernel/types.h:925
#define make_float2(x, y)
Definition: metal/compat.h:203
#define make_float4(x, y, z, w)
Definition: metal/compat.h:205
#define make_float3(x, y, z)
Definition: metal/compat.h:204
float hash_float_to_float(float k)
Definition: noise.cc:178
CCL_NAMESPACE_BEGIN ccl_device_noinline void svm_node_tex_white_noise(KernelGlobals kg, ccl_private ShaderData *sd, ccl_private float *stack, uint dimensions, uint inputs_stack_offsets, uint ouptuts_stack_offsets)
Definition: white_noise.h:8