38 # define SOBOL_SKIP 64
43 uint i = index + SOBOL_SKIP;
54 KernelGlobals *
kg,
uint rng_hash,
int sample,
int num_samples,
int dimension)
56 #ifdef __DEBUG_CORRELATION__
57 return (
float)drand48();
68 int p = rng_hash + dimension;
69 return cmj_sample_1D(
sample, num_samples, p);
85 shift = tmp_rng * (1.0f / (
float)0xFFFFFFFF);
87 return r + shift -
floorf(
r + shift);
99 #ifdef __DEBUG_CORRELATION__
100 *fx = (
float)drand48();
101 *fy = (
float)drand48();
116 int p = rng_hash + dimension;
117 cmj_sample_2D(
sample, num_samples, p, fx, fy);
142 #ifdef __DEBUG_CORRELATION__
143 srand48(*rng_hash +
sample);
160 *rng = (1103515245 * (*rng) + 12345);
167 *rng = (1103515245 * (*rng) + 12345);
168 return (
float)*rng * (1.0f / (
float)0xFFFFFFFF);
202 state->rng_offset + dimension,
230 state->sample * num_branches + branch,
231 state->num_samples * num_branches,
232 state->rng_offset + dimension);
246 state->sample * num_branches + branch,
247 state->num_samples * num_branches,
248 state->rng_offset + dimension,
259 if (
kernel_data.integrator.light_inv_rr_threshold > 0.0f) {
271 if (
kernel_data.integrator.light_inv_rr_threshold > 0.0f) {
290 *rng = (1103515245 * (*rng) + 12345);
291 return (
float)*rng * (1.0f / (
float)0xFFFFFFFF);
300 #if defined(__GNUC__) && !defined(__KERNEL_GPU__)
301 return __builtin_popcount(
sample & 0xaaaaaaaa) & 1;
302 #elif defined(__NVCC__)
303 return __popc(
sample & 0xaaaaaaaa) & 1;
304 #elif defined(__KERNEL_OPENCL__)
305 return popcount(
sample & 0xaaaaaaaa) & 1;
308 int i =
sample & 0xaaaaaaaa;
309 i = i - ((i >> 1) & 0x55555555);
310 i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
311 i = (((i + (i >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
typedef float(TangentPoint)[2]
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
static unsigned long seed
#define kernel_tex_fetch(tex, index)
#define ccl_device_forceinline
#define ccl_device_inline
#define CCL_NAMESPACE_END
ccl_device float2 pmj_sample_2D(KernelGlobals *kg, int sample, int rng_hash, int dimension)
ccl_device_inline uint cmj_hash_simple(uint i, uint p)
ccl_device float pmj_sample_1D(KernelGlobals *kg, int sample, int rng_hash, int dimension)
ccl_device uint lcg_init(uint seed)
ccl_device_inline void path_state_rng_2D(KernelGlobals *kg, const ccl_addr_space PathState *state, int dimension, float *fx, float *fy)
ccl_device_inline uint lcg_state_init_addrspace(ccl_addr_space PathState *state, uint scramble)
ccl_device_inline float path_branched_rng_1D(KernelGlobals *kg, uint rng_hash, const ccl_addr_space PathState *state, int branch, int num_branches, int dimension)
ccl_device uint lcg_step_uint(uint *rng)
ccl_device_inline float path_state_rng_1D(KernelGlobals *kg, const ccl_addr_space PathState *state, int dimension)
ccl_device_inline uint lcg_state_init(PathState *state, uint scramble)
ccl_device float lcg_step_float(uint *rng)
ccl_device_inline bool sample_is_even(int pattern, int sample)
ccl_device_forceinline void path_rng_2D(KernelGlobals *kg, uint rng_hash, int sample, int num_samples, int dimension, float *fx, float *fy)
ccl_device_inline void path_branched_rng_2D(KernelGlobals *kg, uint rng_hash, const ccl_addr_space PathState *state, int branch, int num_branches, int dimension, float *fx, float *fy)
ccl_device_inline void path_rng_init(KernelGlobals *kg, int sample, int num_samples, uint *rng_hash, int x, int y, float *fx, float *fy)
ccl_device_inline float path_branched_rng_light_termination(KernelGlobals *kg, uint rng_hash, const ccl_addr_space PathState *state, int branch, int num_branches)
ccl_device_inline float path_state_rng_light_termination(KernelGlobals *kg, const ccl_addr_space PathState *state)
CCL_NAMESPACE_BEGIN ccl_device_forceinline float path_rng_1D(KernelGlobals *kg, uint rng_hash, int sample, int num_samples, int dimension)
ccl_device float lcg_step_float_addrspace(ccl_addr_space uint *rng)
ccl_device_inline float path_state_rng_1D_hash(KernelGlobals *kg, const ccl_addr_space PathState *state, uint hash)
static void sample(SocketReader *reader, int x, int y, float color[4])
ccl_device_inline uint hash_uint2(uint kx, uint ky)
ccl_device_inline uint find_first_set(uint x)