Blender
V4.3
intern
cycles
kernel
sample
lcg.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 "
util/hash.h
"
8
9
CCL_NAMESPACE_BEGIN
10
11
/* Linear Congruential Generator */
12
13
/* This is templated to handle multiple address spaces on Metal. */
14
template
<
class
T>
ccl_device
uint
lcg_step_uint
(T rng)
15
{
16
/* implicit mod 2^32 */
17
*rng = (1103515245 * (*rng) + 12345);
18
return
*rng;
19
}
20
21
/* This is templated to handle multiple address spaces on Metal. */
22
template
<
class
T>
ccl_device
float
lcg_step_float
(T rng)
23
{
24
/* implicit mod 2^32 */
25
*rng = (1103515245 * (*rng) + 12345);
26
return
(
float
)*rng * (1.0f / (
float
)0xFFFFFFFF);
27
}
28
29
ccl_device
uint
lcg_init
(
uint
seed
)
30
{
31
uint
rng =
seed
;
32
lcg_step_uint
(&rng);
33
return
rng;
34
}
35
36
ccl_device_inline
uint
lcg_state_init
(
const
uint
rng_hash,
37
const
uint
rng_offset,
38
const
uint
sample
,
39
const
uint
scramble)
40
{
41
return
hash_uint3
(rng_hash ^ scramble, rng_offset,
sample
);
42
}
43
44
CCL_NAMESPACE_END
uint
unsigned int uint
Definition
BLI_sys_types.h:68
seed
static unsigned long seed
Definition
btSoftBody.h:39
ccl_device
#define ccl_device
Definition
device/cuda/compat.h:33
ccl_device_inline
#define ccl_device_inline
Definition
device/cuda/compat.h:36
CCL_NAMESPACE_END
#define CCL_NAMESPACE_END
Definition
device/cuda/compat.h:10
float
draw_view in_light_buf[] float
Definition
eevee_light_culling_info.hh:42
hash.h
hash_uint3
ccl_device_inline uint hash_uint3(uint kx, uint ky, uint kz)
Definition
hash.h:101
sample
uint sample
Definition
kernel/device/gpu/kernel.h:97
lcg_step_uint
CCL_NAMESPACE_BEGIN ccl_device uint lcg_step_uint(T rng)
Definition
lcg.h:14
lcg_init
ccl_device uint lcg_init(uint seed)
Definition
lcg.h:29
lcg_state_init
ccl_device_inline uint lcg_state_init(const uint rng_hash, const uint rng_offset, const uint sample, const uint scramble)
Definition
lcg.h:36
lcg_step_float
ccl_device float lcg_step_float(T rng)
Definition
lcg.h:22
CCL_NAMESPACE_BEGIN
Definition
python.cpp:44
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0