[Bf-blender-cvs] [2bf02b14c6f] cycles-x: Fix wrong viewport render when enabling adaptive sampling in Cycles X
Sergey Sharybin
noreply at git.blender.org
Tue Aug 17 14:26:13 CEST 2021
Commit: 2bf02b14c6f740d16b7b2e1565973cc384e81ce0
Author: Sergey Sharybin
Date: Tue Aug 17 14:23:46 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB2bf02b14c6f740d16b7b2e1565973cc384e81ce0
Fix wrong viewport render when enabling adaptive sampling in Cycles X
Steps to reproduce:
- Start viewport render
- Enable adaptive sampling
Caused by d5019b3838c: integrator's device update did not properly
detect change in sampler and hence did not rebuild the sampler LUT.
===================================================================
M intern/cycles/render/integrator.cpp
===================================================================
diff --git a/intern/cycles/render/integrator.cpp b/intern/cycles/render/integrator.cpp
index 55d86701701..0e5e8821526 100644
--- a/intern/cycles/render/integrator.cpp
+++ b/intern/cycles/render/integrator.cpp
@@ -129,8 +129,20 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
}
});
+ KernelIntegrator *kintegrator = &dscene->data.integrator;
+
+ /* Adaptive sampling requires PMJ samples.
+ *
+ * This also makes detection of sampling pattern a bit more involved: can not rely on the changed
+ * state of socket, since its value might be different from the effective value used here. So
+ * instead compare with previous value in the KernelIntegrator. Only do it if the device was
+ * updated once (in which case the `sample_pattern_lut` will be allocated to a non-zero size). */
+ const SamplingPattern new_sampling_pattern = (use_adaptive_sampling) ? SAMPLING_PATTERN_PMJ :
+ sampling_pattern;
+
const bool need_update_lut = max_bounce_is_modified() || max_transmission_bounce_is_modified() ||
- sampling_pattern_is_modified();
+ dscene->sample_pattern_lut.size() == 0 ||
+ kintegrator->sampling_pattern != new_sampling_pattern;
if (need_update_lut) {
dscene->sample_pattern_lut.tag_realloc();
@@ -138,8 +150,6 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
device_free(device, dscene);
- KernelIntegrator *kintegrator = &dscene->data.integrator;
-
/* integrator parameters */
kintegrator->min_bounce = min_bounce + 1;
kintegrator->max_bounce = max_bounce + 1;
@@ -185,8 +195,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
FLT_MAX :
sample_clamp_indirect * 3.0f;
- kintegrator->sampling_pattern = (use_adaptive_sampling) ? SAMPLING_PATTERN_PMJ :
- sampling_pattern;
+ kintegrator->sampling_pattern = new_sampling_pattern;
if (light_sampling_threshold > 0.0f) {
kintegrator->light_inv_rr_threshold = 1.0f / light_sampling_threshold;
More information about the Bf-blender-cvs
mailing list