[Bf-blender-cvs] [6055db084d3] master: Cycles: optimize Sobol loop
Patrick Mours
noreply at git.blender.org
Mon Aug 26 16:12:24 CEST 2019
Commit: 6055db084d32e945bf5fbc6bdaf9b24507495737
Author: Patrick Mours
Date: Mon Aug 26 15:30:12 2019 +0200
Branches: master
https://developer.blender.org/rB6055db084d32e945bf5fbc6bdaf9b24507495737
Cycles: optimize Sobol loop
Ref D5363
===================================================================
M intern/cycles/kernel/kernel_random.h
===================================================================
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;
}
More information about the Bf-blender-cvs
mailing list