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
path: root/intern
diff options
context:
space:
mode:
authorPatrick Mours <pmours@nvidia.com>2019-08-26 16:30:12 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-08-26 17:07:01 +0300
commit6055db084d32e945bf5fbc6bdaf9b24507495737 (patch)
tree0ec4c8ca974e5af40ca2a0cb676dc6ba487e0d77 /intern
parent030a023eb2b81018d97d309e1106a17844d57b60 (diff)
Cycles: optimize Sobol loop
Ref D5363
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/kernel/kernel_random.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/intern/cycles/kernel/kernel_random.h b/intern/cycles/kernel/kernel_random.h
index a5ae427c2d3..80738213d2a 100644
--- a/intern/cycles/kernel/kernel_random.h
+++ b/intern/cycles/kernel/kernel_random.h
@@ -41,10 +41,9 @@ ccl_device uint sobol_dimension(KernelGlobals *kg, int index, int dimension)
{
uint result = 0;
uint i = index + SOBOL_SKIP;
- for (uint j = 0; i; i >>= 1, j++) {
- if (i & 1) {
- result ^= kernel_tex_fetch(__sobol_directions, 32 * dimension + j);
- }
+ for (int j = 0, x; (x = find_first_set(i)); i >>= x) {
+ j += x;
+ result ^= kernel_tex_fetch(__sobol_directions, 32 * dimension + j - 1);
}
return result;
}