diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-01-29 19:17:18 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-01-29 19:35:28 +0300 |
commit | d0f59d38429d945b3215890897eb2cfb90eacaa7 (patch) | |
tree | f3ddebd94b9f7dd4b54ec3523d95bcea11df1958 /intern | |
parent | 171f2e4949837ca3537d9b998a42590fd88c5ad8 (diff) |
Fix T85144: Cycles crashes when editing render properties in viewport
rendering
Issue was caused by the sample pattern LUT always being freed and not
rebuilt when properties driving its dimensions were modified.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/render/integrator.cpp | 18 | ||||
-rw-r--r-- | intern/cycles/render/integrator.h | 1 | ||||
-rw-r--r-- | intern/cycles/render/light.cpp | 4 |
3 files changed, 21 insertions, 2 deletions
diff --git a/intern/cycles/render/integrator.cpp b/intern/cycles/render/integrator.cpp index c97a6549653..d93856ceb61 100644 --- a/intern/cycles/render/integrator.cpp +++ b/intern/cycles/render/integrator.cpp @@ -115,7 +115,15 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene } }); - if (sampling_pattern_is_modified()) { + const bool need_update_lut = ao_samples_is_modified() || diffuse_samples_is_modified() || + glossy_samples_is_modified() || max_bounce_is_modified() || + max_transmission_bounce_is_modified() || + mesh_light_samples_is_modified() || method_is_modified() || + sampling_pattern_is_modified() || + subsurface_samples_is_modified() || + transmission_samples_is_modified() || volume_samples_is_modified(); + + if (need_update_lut) { dscene->sample_pattern_lut.tag_realloc(); } @@ -248,7 +256,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene int dimensions = PRNG_BASE_NUM + max_samples * PRNG_BOUNCE_NUM; dimensions = min(dimensions, SOBOL_MAX_DIMENSIONS); - if (sampling_pattern_is_modified()) { + if (need_update_lut) { if (sampling_pattern == SAMPLING_PATTERN_SOBOL) { uint *directions = dscene->sample_pattern_lut.alloc(SOBOL_BITS * dimensions); @@ -272,6 +280,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene } } + dscene->sample_pattern_lut.clear_modified(); clear_modified(); } @@ -292,6 +301,11 @@ void Integrator::tag_update(Scene *scene, uint32_t flag) tag_ao_bounces_modified(); } + if ((flag & LIGHT_SAMPLES_MODIFIED) && (method == BRANCHED_PATH)) { + /* the number of light samples may affect the size of the sample_pattern_lut */ + tag_sampling_pattern_modified(); + } + if (filter_glossy_is_modified()) { foreach (Shader *shader, scene->shaders) { if (shader->has_integrator_dependency) { diff --git a/intern/cycles/render/integrator.h b/intern/cycles/render/integrator.h index 57dcaf95360..4eeeda92d41 100644 --- a/intern/cycles/render/integrator.h +++ b/intern/cycles/render/integrator.h @@ -92,6 +92,7 @@ class Integrator : public Node { enum : uint32_t { AO_PASS_MODIFIED = (1 << 0), BACKGROUND_AO_MODIFIED = (1 << 1), + LIGHT_SAMPLES_MODIFIED = (1 << 2), /* tag everything in the manager for an update */ UPDATE_ALL = ~0u, diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 6e9dea564c2..638ac376157 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -164,6 +164,10 @@ void Light::tag_update(Scene *scene) { if (is_modified()) { scene->light_manager->tag_update(scene, LightManager::LIGHT_MODIFIED); + + if (samples_is_modified()) { + scene->integrator->tag_update(scene, Integrator::LIGHT_SAMPLES_MODIFIED); + } } } |