Cycles: Using OpenCL popcount() in PMJ sampler.
This commit is contained in:
parent
7b8ac04d86
commit
811569dc11
@ -294,12 +294,15 @@ ccl_device_inline bool sample_is_even(int pattern, int sample)
|
||||
if (pattern == SAMPLING_PATTERN_PMJ) {
|
||||
/* See Section 10.2.1, "Progressive Multi-Jittered Sample Sequences", Christensen et al.
|
||||
* We can use this to get divide sample sequence into two classes for easier variance
|
||||
* estimation. There must be a more elegant way of writing this? */
|
||||
* estimation. */
|
||||
#if defined(__GNUC__) && !defined(__KERNEL_GPU__)
|
||||
return __builtin_popcount(sample & 0xaaaaaaaa) & 1;
|
||||
#elif defined(__NVCC__)
|
||||
return __popc(sample & 0xaaaaaaaa) & 1;
|
||||
#elif defined(__KERNEL_OPENCL__)
|
||||
return popcount(sample & 0xaaaaaaaa) & 1;
|
||||
#else
|
||||
/* TODO(Stefan): popcnt intrinsic for Windows with fallback for older CPUs. */
|
||||
int i = sample & 0xaaaaaaaa;
|
||||
i = i - ((i >> 1) & 0x55555555);
|
||||
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
|
||||
|
Loading…
Reference in New Issue
Block a user