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.
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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,
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user