Blender
V3.3
intern
cycles
kernel
sample
lcg.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
6
CCL_NAMESPACE_BEGIN
7
8
/* Linear Congruential Generator */
9
10
/* This is templated to handle multiple address spaces on Metal. */
11
template
<
class
T>
ccl_device
uint
lcg_step_uint
(
T
rng)
12
{
13
/* implicit mod 2^32 */
14
*rng = (1103515245 * (*rng) + 12345);
15
return
*rng;
16
}
17
18
/* This is templated to handle multiple address spaces on Metal. */
19
template
<
class
T>
ccl_device
float
lcg_step_float
(
T
rng)
20
{
21
/* implicit mod 2^32 */
22
*rng = (1103515245 * (*rng) + 12345);
23
return
(
float
)*rng * (1.0f / (
float
)0xFFFFFFFF);
24
}
25
26
ccl_device
uint
lcg_init
(
uint
seed
)
27
{
28
uint
rng =
seed
;
29
lcg_step_uint
(&rng);
30
return
rng;
31
}
32
33
ccl_device_inline
uint
lcg_state_init
(
const
uint
rng_hash,
34
const
uint
rng_offset,
35
const
uint
sample
,
36
const
uint
scramble)
37
{
38
return
lcg_init
(rng_hash + rng_offset +
sample
* scramble);
39
}
40
41
CCL_NAMESPACE_END
float
typedef float(TangentPoint)[2]
uint
unsigned int uint
Definition:
BLI_sys_types.h:67
seed
static unsigned long seed
Definition:
btSoftBody.h:39
ccl_device
#define ccl_device
Definition:
cuda/compat.h:32
ccl_device_inline
#define ccl_device_inline
Definition:
cuda/compat.h:34
CCL_NAMESPACE_END
#define CCL_NAMESPACE_END
Definition:
cuda/compat.h:9
sample
uint sample
Definition:
kernel/device/gpu/kernel.h:91
lcg_step_uint
CCL_NAMESPACE_BEGIN ccl_device uint lcg_step_uint(T rng)
Definition:
lcg.h:11
lcg_init
ccl_device uint lcg_init(uint seed)
Definition:
lcg.h:26
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:33
lcg_step_float
ccl_device float lcg_step_float(T rng)
Definition:
lcg.h:19
T
#define T
Definition:
mball_tessellate.c:264
CCL_NAMESPACE_BEGIN
Definition:
python.cpp:37
Generated on Tue Oct 22 2024 13:18:25 for Blender by
doxygen
1.9.1