2011-04-27 11:58:34 +00:00
|
|
|
/*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Copyright 2011-2013 Blender Foundation
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
2014-12-25 01:50:24 +00:00
|
|
|
* limitations under the License.
|
2011-04-27 11:58:34 +00:00
|
|
|
*/
|
|
|
|
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 18:39:14 +00:00
|
|
|
#include "kernel/kernel_jitter.h"
|
2013-06-07 16:06:22 +00:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
#ifdef __SOBOL__
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
/* Skip initial numbers that are not as well distributed, especially the
|
2012-06-09 17:22:52 +00:00
|
|
|
* first sequence is just 0 everywhere, which can be problematic for e.g.
|
2017-04-25 09:42:36 +00:00
|
|
|
* path termination.
|
|
|
|
*/
|
2011-11-12 14:29:52 +00:00
|
|
|
#define SOBOL_SKIP 64
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
/* High Dimensional Sobol. */
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
/* Multidimensional sobol with generator matrices
|
|
|
|
* dimension 0 and 1 are equal to van_der_corput() and sobol() respectively.
|
|
|
|
*/
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device uint sobol_dimension(KernelGlobals *kg, int index, int dimension)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
uint result = 0;
|
|
|
|
uint i = index;
|
2017-04-25 09:42:36 +00:00
|
|
|
for(uint j = 0; i; i >>= 1, j++) {
|
|
|
|
if(i & 1) {
|
2011-04-27 11:58:34 +00:00
|
|
|
result ^= kernel_tex_fetch(__sobol_directions, 32*dimension + j);
|
2017-04-25 09:42:36 +00:00
|
|
|
}
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
ccl_device_forceinline float path_rng_1D(KernelGlobals *kg,
|
|
|
|
RNG *rng,
|
|
|
|
int sample, int num_samples,
|
|
|
|
int dimension)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
2013-06-11 21:58:48 +00:00
|
|
|
#ifdef __CMJ__
|
|
|
|
if(kernel_data.integrator.sampling_pattern == SAMPLING_PATTERN_CMJ) {
|
2017-04-25 09:42:36 +00:00
|
|
|
/* Correlated multi-jitter. */
|
2013-06-11 21:58:48 +00:00
|
|
|
int p = *rng + dimension;
|
|
|
|
return cmj_sample_1D(sample, num_samples, p);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
/* Compute sobol sequence value using direction vectors. */
|
2011-11-12 14:29:52 +00:00
|
|
|
uint result = sobol_dimension(kg, sample + SOBOL_SKIP, dimension);
|
2011-04-27 11:58:34 +00:00
|
|
|
float r = (float)result * (1.0f/(float)0xFFFFFFFF);
|
|
|
|
|
|
|
|
/* Cranly-Patterson rotation using rng seed */
|
|
|
|
float shift;
|
|
|
|
|
2016-11-26 16:30:02 +00:00
|
|
|
/* Hash rng with dimension to solve correlation issues.
|
|
|
|
* See T38710, T50116.
|
|
|
|
*/
|
|
|
|
RNG tmp_rng = cmj_hash_simple(dimension, *rng);
|
|
|
|
shift = tmp_rng * (1.0f/(float)0xFFFFFFFF);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2012-06-09 17:45:22 +00:00
|
|
|
return r + shift - floorf(r + shift);
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
ccl_device_forceinline void path_rng_2D(KernelGlobals *kg,
|
|
|
|
RNG *rng,
|
|
|
|
int sample, int num_samples,
|
|
|
|
int dimension,
|
|
|
|
float *fx, float *fy)
|
2013-06-07 16:06:22 +00:00
|
|
|
{
|
|
|
|
#ifdef __CMJ__
|
|
|
|
if(kernel_data.integrator.sampling_pattern == SAMPLING_PATTERN_CMJ) {
|
2017-04-25 09:42:36 +00:00
|
|
|
/* Correlated multi-jitter. */
|
2013-06-09 16:37:04 +00:00
|
|
|
int p = *rng + dimension;
|
2013-06-11 21:58:48 +00:00
|
|
|
cmj_sample_2D(sample, num_samples, p, fx, fy);
|
2013-06-07 16:06:22 +00:00
|
|
|
}
|
2013-07-23 16:23:30 +00:00
|
|
|
else
|
2013-06-07 16:06:22 +00:00
|
|
|
#endif
|
2013-07-23 16:23:30 +00:00
|
|
|
{
|
2017-04-25 09:42:36 +00:00
|
|
|
/* Sobol. */
|
2013-07-23 16:23:30 +00:00
|
|
|
*fx = path_rng_1D(kg, rng, sample, num_samples, dimension);
|
|
|
|
*fy = path_rng_1D(kg, rng, sample, num_samples, dimension + 1);
|
|
|
|
}
|
2013-06-07 16:06:22 +00:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
ccl_device_inline void path_rng_init(KernelGlobals *kg,
|
|
|
|
ccl_global uint *rng_state,
|
|
|
|
int sample, int num_samples,
|
|
|
|
RNG *rng,
|
|
|
|
int x, int y,
|
|
|
|
float *fx, float *fy)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
*rng = *rng_state;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-10-29 14:27:24 +00:00
|
|
|
*rng ^= kernel_data.integrator.seed;
|
|
|
|
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
if(sample == 0) {
|
|
|
|
*fx = 0.5f;
|
|
|
|
*fy = 0.5f;
|
|
|
|
}
|
|
|
|
else {
|
2013-06-11 21:58:48 +00:00
|
|
|
path_rng_2D(kg, rng, sample, num_samples, PRNG_FILTER_U, fx, fy);
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
#else /* __SOBOL__ */
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2017-08-06 19:14:58 +00:00
|
|
|
/* Pseudo random numbers, use this only on the CPU with a single thread
|
|
|
|
* for debugging correlations. */
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
ccl_device_forceinline float path_rng_1D(KernelGlobals *kg,
|
|
|
|
RNG *rng,
|
|
|
|
int sample, int num_samples,
|
|
|
|
int dimension)
|
2013-06-07 16:06:22 +00:00
|
|
|
{
|
2017-08-06 19:14:58 +00:00
|
|
|
return (float)drand48();
|
2013-06-07 16:06:22 +00:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
ccl_device_inline void path_rng_2D(KernelGlobals *kg,
|
|
|
|
RNG *rng,
|
|
|
|
int sample, int num_samples,
|
|
|
|
int dimension,
|
|
|
|
float *fx, float *fy)
|
2013-06-07 16:06:22 +00:00
|
|
|
{
|
2017-08-06 19:14:58 +00:00
|
|
|
*fx = (float)drand48();
|
|
|
|
*fy = (float)drand48();
|
2013-06-07 16:06:22 +00:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
ccl_device void path_rng_init(KernelGlobals *kg,
|
|
|
|
ccl_global uint *rng_state,
|
|
|
|
int sample, int num_samples,
|
|
|
|
RNG *rng,
|
|
|
|
int x, int y,
|
|
|
|
float *fx, float *fy)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
/* load state */
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
*rng = *rng_state;
|
2011-10-29 14:27:24 +00:00
|
|
|
*rng ^= kernel_data.integrator.seed;
|
|
|
|
|
2017-08-06 19:14:58 +00:00
|
|
|
srand48(*rng);
|
|
|
|
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
if(sample == 0) {
|
|
|
|
*fx = 0.5f;
|
|
|
|
*fy = 0.5f;
|
|
|
|
}
|
|
|
|
else {
|
2013-06-11 21:58:48 +00:00
|
|
|
path_rng_2D(kg, rng, sample, num_samples, PRNG_FILTER_U, fx, fy);
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
#endif /* __SOBOL__ */
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2014-01-03 01:48:48 +00:00
|
|
|
/* Linear Congruential Generator */
|
|
|
|
|
2016-06-28 12:11:17 +00:00
|
|
|
ccl_device uint lcg_step_uint(uint *rng)
|
2013-08-18 14:15:57 +00:00
|
|
|
{
|
|
|
|
/* implicit mod 2^32 */
|
|
|
|
*rng = (1103515245*(*rng) + 12345);
|
|
|
|
return *rng;
|
|
|
|
}
|
|
|
|
|
2016-06-28 12:11:17 +00:00
|
|
|
ccl_device float lcg_step_float(uint *rng)
|
2013-04-01 20:26:52 +00:00
|
|
|
{
|
|
|
|
/* implicit mod 2^32 */
|
|
|
|
*rng = (1103515245*(*rng) + 12345);
|
|
|
|
return (float)*rng * (1.0f/(float)0xFFFFFFFF);
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device uint lcg_init(uint seed)
|
2013-04-01 20:26:52 +00:00
|
|
|
{
|
2013-04-17 14:48:01 +00:00
|
|
|
uint rng = seed;
|
2013-08-18 14:15:57 +00:00
|
|
|
lcg_step_uint(&rng);
|
2013-04-01 20:26:52 +00:00
|
|
|
return rng;
|
|
|
|
}
|
|
|
|
|
2014-01-03 01:48:48 +00:00
|
|
|
/* Path Tracing Utility Functions
|
|
|
|
*
|
|
|
|
* For each random number in each step of the path we must have a unique
|
|
|
|
* dimension to avoid using the same sequence twice.
|
|
|
|
*
|
|
|
|
* For branches in the path we must be careful not to reuse the same number
|
2017-04-25 09:42:36 +00:00
|
|
|
* in a sequence and offset accordingly.
|
|
|
|
*/
|
2014-01-03 01:48:48 +00:00
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
ccl_device_inline float path_state_rng_1D(KernelGlobals *kg,
|
|
|
|
RNG *rng,
|
|
|
|
const ccl_addr_space PathState *state,
|
|
|
|
int dimension)
|
2014-01-03 01:48:48 +00:00
|
|
|
{
|
2017-04-25 09:42:36 +00:00
|
|
|
return path_rng_1D(kg,
|
|
|
|
rng,
|
|
|
|
state->sample, state->num_samples,
|
|
|
|
state->rng_offset + dimension);
|
2014-01-03 01:48:48 +00:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
ccl_device_inline float path_state_rng_1D_for_decision(
|
|
|
|
KernelGlobals *kg,
|
|
|
|
RNG *rng,
|
|
|
|
const ccl_addr_space PathState *state,
|
|
|
|
int dimension)
|
2014-05-29 12:12:12 +00:00
|
|
|
{
|
2017-04-25 09:42:36 +00:00
|
|
|
/* The rng_offset is not increased for transparent bounces. if we do then
|
2014-05-29 12:12:12 +00:00
|
|
|
* fully transparent objects can become subtly visible by the different
|
|
|
|
* sampling patterns used where the transparent object is.
|
|
|
|
*
|
|
|
|
* however for some random numbers that will determine if we next bounce
|
|
|
|
* is transparent we do need to increase the offset to avoid always making
|
2017-04-25 09:42:36 +00:00
|
|
|
* the same decision. */
|
|
|
|
const int rng_offset = state->rng_offset + state->transparent_bounce * PRNG_BOUNCE_NUM;
|
|
|
|
return path_rng_1D(kg,
|
|
|
|
rng,
|
|
|
|
state->sample, state->num_samples,
|
|
|
|
rng_offset + dimension);
|
2014-05-29 12:12:12 +00:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
ccl_device_inline void path_state_rng_2D(KernelGlobals *kg,
|
|
|
|
RNG *rng,
|
|
|
|
const ccl_addr_space PathState *state,
|
|
|
|
int dimension,
|
|
|
|
float *fx, float *fy)
|
2014-01-03 01:48:48 +00:00
|
|
|
{
|
2017-04-25 09:42:36 +00:00
|
|
|
path_rng_2D(kg,
|
|
|
|
rng,
|
|
|
|
state->sample, state->num_samples,
|
|
|
|
state->rng_offset + dimension,
|
|
|
|
fx, fy);
|
2014-01-03 01:48:48 +00:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
ccl_device_inline float path_branched_rng_1D(
|
|
|
|
KernelGlobals *kg,
|
|
|
|
RNG *rng,
|
|
|
|
const ccl_addr_space PathState *state,
|
|
|
|
int branch,
|
|
|
|
int num_branches,
|
|
|
|
int dimension)
|
2014-01-03 01:48:48 +00:00
|
|
|
{
|
2017-04-25 09:42:36 +00:00
|
|
|
return path_rng_1D(kg,
|
|
|
|
rng,
|
|
|
|
state->sample * num_branches + branch,
|
|
|
|
state->num_samples * num_branches,
|
|
|
|
state->rng_offset + dimension);
|
2014-01-03 01:48:48 +00:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
ccl_device_inline float path_branched_rng_1D_for_decision(
|
|
|
|
KernelGlobals *kg,
|
|
|
|
RNG *rng,
|
|
|
|
const ccl_addr_space PathState *state,
|
|
|
|
int branch,
|
|
|
|
int num_branches,
|
|
|
|
int dimension)
|
2014-04-04 14:45:49 +00:00
|
|
|
{
|
2017-04-25 09:42:36 +00:00
|
|
|
const int rng_offset = state->rng_offset + state->transparent_bounce * PRNG_BOUNCE_NUM;
|
|
|
|
return path_rng_1D(kg,
|
|
|
|
rng,
|
|
|
|
state->sample * num_branches + branch,
|
|
|
|
state->num_samples * num_branches,
|
|
|
|
rng_offset + dimension);
|
2014-04-04 14:45:49 +00:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
ccl_device_inline void path_branched_rng_2D(
|
|
|
|
KernelGlobals *kg,
|
|
|
|
RNG *rng,
|
|
|
|
const ccl_addr_space PathState *state,
|
|
|
|
int branch,
|
|
|
|
int num_branches,
|
|
|
|
int dimension,
|
|
|
|
float *fx, float *fy)
|
2014-01-03 01:48:48 +00:00
|
|
|
{
|
2017-04-25 09:42:36 +00:00
|
|
|
path_rng_2D(kg,
|
|
|
|
rng,
|
|
|
|
state->sample * num_branches + branch,
|
|
|
|
state->num_samples * num_branches,
|
|
|
|
state->rng_offset + dimension,
|
|
|
|
fx, fy);
|
2014-01-03 01:48:48 +00:00
|
|
|
}
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
/* Utitility functions to get light termination value,
|
|
|
|
* since it might not be needed in many cases.
|
|
|
|
*/
|
|
|
|
ccl_device_inline float path_state_rng_light_termination(
|
|
|
|
KernelGlobals *kg,
|
|
|
|
RNG *rng,
|
|
|
|
const ccl_addr_space PathState *state)
|
2016-10-29 21:47:30 +00:00
|
|
|
{
|
|
|
|
if(kernel_data.integrator.light_inv_rr_threshold > 0.0f) {
|
|
|
|
return path_state_rng_1D_for_decision(kg, rng, state, PRNG_LIGHT_TERMINATE);
|
|
|
|
}
|
|
|
|
return 0.0f;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
ccl_device_inline float path_branched_rng_light_termination(
|
|
|
|
KernelGlobals *kg,
|
|
|
|
RNG *rng,
|
|
|
|
const ccl_addr_space PathState *state,
|
|
|
|
int branch,
|
|
|
|
int num_branches)
|
2016-10-29 21:47:30 +00:00
|
|
|
{
|
|
|
|
if(kernel_data.integrator.light_inv_rr_threshold > 0.0f) {
|
2017-04-25 09:42:36 +00:00
|
|
|
return path_branched_rng_1D_for_decision(kg,
|
|
|
|
rng,
|
|
|
|
state,
|
|
|
|
branch,
|
|
|
|
num_branches,
|
|
|
|
PRNG_LIGHT_TERMINATE);
|
2016-10-29 21:47:30 +00:00
|
|
|
}
|
|
|
|
return 0.0f;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
ccl_device_inline void path_state_branch(ccl_addr_space PathState *state,
|
|
|
|
int branch,
|
|
|
|
int num_branches)
|
2014-01-03 01:48:48 +00:00
|
|
|
{
|
|
|
|
/* path is splitting into a branch, adjust so that each branch
|
|
|
|
* still gets a unique sample from the same sequence */
|
|
|
|
state->rng_offset += PRNG_BOUNCE_NUM;
|
|
|
|
state->sample = state->sample*num_branches + branch;
|
|
|
|
state->num_samples = state->num_samples*num_branches;
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:42:36 +00:00
|
|
|
ccl_device_inline uint lcg_state_init(RNG *rng,
|
|
|
|
int rng_offset,
|
|
|
|
int sample,
|
|
|
|
uint scramble)
|
2016-06-28 12:11:17 +00:00
|
|
|
{
|
2017-03-21 11:24:47 +00:00
|
|
|
return lcg_init(*rng + rng_offset + sample*scramble);
|
2016-06-28 12:11:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ccl_device float lcg_step_float_addrspace(ccl_addr_space uint *rng)
|
|
|
|
{
|
2017-04-25 09:42:36 +00:00
|
|
|
/* Implicit mod 2^32 */
|
2016-06-28 12:11:17 +00:00
|
|
|
*rng = (1103515245*(*rng) + 12345);
|
|
|
|
return (float)*rng * (1.0f/(float)0xFFFFFFFF);
|
|
|
|
}
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
CCL_NAMESPACE_END
|
|
|
|
|