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 <brecht@blender.org>2020-04-07 20:43:51 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-04-07 21:29:48 +0300
commit53981c7fb6fdd9973e40f81f867f25d10540c1d1 (patch)
tree84572c33af5bb0c343f6a2928b135041bb8cb3b3 /intern/cycles/kernel
parent7b4b07a7ddc874efd11b3932f152c7136d720f9c (diff)
Cleanup: refactor adaptive sampling to more easily change some parameters
No functional changes yet, this is work towards making CPU and GPU results match more closely.
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r--intern/cycles/kernel/kernel_passes.h10
-rw-r--r--intern/cycles/kernel/kernel_types.h9
2 files changed, 10 insertions, 9 deletions
diff --git a/intern/cycles/kernel/kernel_passes.h b/intern/cycles/kernel/kernel_passes.h
index 98136bc7047..7437e540a1f 100644
--- a/intern/cycles/kernel/kernel_passes.h
+++ b/intern/cycles/kernel/kernel_passes.h
@@ -403,9 +403,13 @@ ccl_device_inline void kernel_write_result(KernelGlobals *kg,
make_float4(L_sum.x * 2.0f, L_sum.y * 2.0f, L_sum.z * 2.0f, 0.0f));
}
#ifdef __KERNEL_CPU__
- if (sample > kernel_data.integrator.adaptive_min_samples &&
- (sample & (ADAPTIVE_SAMPLE_STEP - 1)) == (ADAPTIVE_SAMPLE_STEP - 1)) {
- kernel_do_adaptive_stopping(kg, buffer, sample);
+ if ((sample > kernel_data.integrator.adaptive_min_samples) &&
+ kernel_data.integrator.adaptive_stop_per_sample) {
+ const int step = kernel_data.integrator.adaptive_step;
+
+ if ((sample & (step - 1)) == (step - 1)) {
+ kernel_do_adaptive_stopping(kg, buffer, sample);
+ }
}
#endif
}
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 44c936da626..a1f8c35348d 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -63,11 +63,6 @@ CCL_NAMESPACE_BEGIN
#define VOLUME_STACK_SIZE 32
-/* Adaptive sampling constants */
-#define ADAPTIVE_SAMPLE_STEP 4
-static_assert((ADAPTIVE_SAMPLE_STEP & (ADAPTIVE_SAMPLE_STEP - 1)) == 0,
- "ADAPTIVE_SAMPLE_STEP must be power of two for bitwise operations to work");
-
/* Split kernel constants */
#define WORK_POOL_SIZE_GPU 64
#define WORK_POOL_SIZE_CPU 1
@@ -1350,6 +1345,8 @@ typedef struct KernelIntegrator {
int sampling_pattern;
int aa_samples;
int adaptive_min_samples;
+ int adaptive_step;
+ int adaptive_stop_per_sample;
float adaptive_threshold;
/* volume render */
@@ -1362,7 +1359,7 @@ typedef struct KernelIntegrator {
int max_closures;
- int pad1, pad2, pad3;
+ int pad1;
} KernelIntegrator;
static_assert_align(KernelIntegrator, 16);