Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-01-25 21:23:52 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-01-25 21:23:52 +0400
commitf99343d3b8676543e2bd6acd6ee2274c21b1b388 (patch)
treefd40cd33691a783f82cf877e774d1b3a64d91ed3 /intern/cycles/kernel/kernel_random.h
parent14f475fccad7158098ddecc285c617f990b2f8b5 (diff)
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
Diffstat (limited to 'intern/cycles/kernel/kernel_random.h')
-rw-r--r--intern/cycles/kernel/kernel_random.h44
1 files changed, 31 insertions, 13 deletions
diff --git a/intern/cycles/kernel/kernel_random.h b/intern/cycles/kernel/kernel_random.h
index 41301ebd3dc..6d15100f8a3 100644
--- a/intern/cycles/kernel/kernel_random.h
+++ b/intern/cycles/kernel/kernel_random.h
@@ -123,7 +123,7 @@ __device_inline float path_rng(KernelGlobals *kg, RNG *rng, int sample, int dime
#endif
}
-__device_inline void path_rng_init(KernelGlobals *kg, __global uint *rng_state, int sample, RNG *rng, int x, int y, int offset, int stride, float *fx, float *fy)
+__device_inline void path_rng_init(KernelGlobals *kg, __global uint *rng_state, int sample, RNG *rng, int x, int y, float *fx, float *fy)
{
#ifdef __SOBOL_FULL_SCREEN__
uint px, py;
@@ -135,19 +135,31 @@ __device_inline void path_rng_init(KernelGlobals *kg, __global uint *rng_state,
*rng ^= kernel_data.integrator.seed;
- *fx = size * (float)px * (1.0f/(float)0xFFFFFFFF) - x;
- *fy = size * (float)py * (1.0f/(float)0xFFFFFFFF) - y;
+ if(sample == 0) {
+ *fx = 0.5f;
+ *fy = 0.5f;
+ }
+ else {
+ *fx = size * (float)px * (1.0f/(float)0xFFFFFFFF) - x;
+ *fy = size * (float)py * (1.0f/(float)0xFFFFFFFF) - y;
+ }
#else
- *rng = rng_state[offset + x + y*stride];
+ *rng = *rng_state;
*rng ^= kernel_data.integrator.seed;
- *fx = path_rng(kg, rng, sample, PRNG_FILTER_U);
- *fy = path_rng(kg, rng, sample, PRNG_FILTER_V);
+ if(sample == 0) {
+ *fx = 0.5f;
+ *fy = 0.5f;
+ }
+ else {
+ *fx = path_rng(kg, rng, sample, PRNG_FILTER_U);
+ *fy = path_rng(kg, rng, sample, PRNG_FILTER_V);
+ }
#endif
}
-__device void path_rng_end(KernelGlobals *kg, __global uint *rng_state, RNG rng, int x, int y, int offset, int stride)
+__device void path_rng_end(KernelGlobals *kg, __global uint *rng_state, RNG rng)
{
/* nothing to do */
}
@@ -163,21 +175,27 @@ __device float path_rng(KernelGlobals *kg, RNG *rng, int sample, int dimension)
return (float)*rng * (1.0f/(float)0xFFFFFFFF);
}
-__device void path_rng_init(KernelGlobals *kg, __global uint *rng_state, int sample, RNG *rng, int x, int y, int offset, int stride, float *fx, float *fy)
+__device void path_rng_init(KernelGlobals *kg, __global uint *rng_state, int sample, RNG *rng, int x, int y, float *fx, float *fy)
{
/* load state */
- *rng = rng_state[offset + x + y*stride];
+ *rng = *rng_state;
*rng ^= kernel_data.integrator.seed;
- *fx = path_rng(kg, rng, sample, PRNG_FILTER_U);
- *fy = path_rng(kg, rng, sample, PRNG_FILTER_V);
+ if(sample == 0) {
+ *fx = 0.5f;
+ *fy = 0.5f;
+ }
+ else {
+ *fx = path_rng(kg, rng, sample, PRNG_FILTER_U);
+ *fy = path_rng(kg, rng, sample, PRNG_FILTER_V);
+ }
}
-__device void path_rng_end(KernelGlobals *kg, __global uint *rng_state, RNG rng, int x, int y, int offset, int stride)
+__device void path_rng_end(KernelGlobals *kg, __global uint *rng_state, RNG rng)
{
/* store state for next sample */
- rng_state[offset + x + y*stride] = rng;
+ *rng_state = rng;
}
#endif