Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/integrator.cpp
| Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene) | void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene) | ||||
| { | { | ||||
| if (!is_modified()) | if (!is_modified()) | ||||
| return; | return; | ||||
| scoped_callback_timer timer([scene](double time) { | scoped_callback_timer timer([scene](double time) { | ||||
| if (scene->update_stats) { | if (scene->get_update_stats()) { | ||||
| scene->update_stats->integrator.times.add_entry({"device_update", time}); | scene->get_update_stats()->integrator.times.add_entry({"device_update", time}); | ||||
| } | } | ||||
| }); | }); | ||||
| device_free(device, dscene); | device_free(device, dscene); | ||||
| KernelIntegrator *kintegrator = &dscene->data.integrator; | KernelIntegrator *kintegrator = &dscene->data.integrator; | ||||
| /* integrator parameters */ | /* integrator parameters */ | ||||
| Show All 15 Lines | else { | ||||
| kintegrator->ao_bounces = ao_bounces - 1; | kintegrator->ao_bounces = ao_bounces - 1; | ||||
| } | } | ||||
| /* Transparent Shadows | /* Transparent Shadows | ||||
| * We only need to enable transparent shadows, if we actually have | * We only need to enable transparent shadows, if we actually have | ||||
| * transparent shaders in the scene. Otherwise we can disable it | * transparent shaders in the scene. Otherwise we can disable it | ||||
| * to improve performance a bit. */ | * to improve performance a bit. */ | ||||
| kintegrator->transparent_shadows = false; | kintegrator->transparent_shadows = false; | ||||
| foreach (Shader *shader, scene->shaders) { | foreach (Shader *shader, scene->get_shaders()) { | ||||
| /* keep this in sync with SD_HAS_TRANSPARENT_SHADOW in shader.cpp */ | /* keep this in sync with SD_HAS_TRANSPARENT_SHADOW in shader.cpp */ | ||||
| if ((shader->has_surface_transparent && shader->get_use_transparent_shadow()) || | if ((shader->get_has_surface_transparent() && shader->get_use_transparent_shadow()) || | ||||
| shader->has_volume) { | shader->get_has_volume()) { | ||||
| kintegrator->transparent_shadows = true; | kintegrator->transparent_shadows = true; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| kintegrator->volume_max_steps = volume_max_steps; | kintegrator->volume_max_steps = volume_max_steps; | ||||
| kintegrator->volume_step_rate = volume_step_rate; | kintegrator->volume_step_rate = volume_step_rate; | ||||
| kintegrator->caustics_reflective = caustics_reflective; | kintegrator->caustics_reflective = caustics_reflective; | ||||
| kintegrator->caustics_refractive = caustics_refractive; | kintegrator->caustics_refractive = caustics_refractive; | ||||
| kintegrator->filter_glossy = (filter_glossy == 0.0f) ? FLT_MAX : 1.0f / filter_glossy; | kintegrator->filter_glossy = (filter_glossy == 0.0f) ? FLT_MAX : 1.0f / filter_glossy; | ||||
| kintegrator->seed = hash_uint2(seed, 0); | kintegrator->seed = hash_uint2(seed, 0); | ||||
| kintegrator->use_ambient_occlusion = ((Pass::contains(scene->passes, PASS_AO)) || | kintegrator->use_ambient_occlusion = ((Pass::contains(scene->get_passes(), PASS_AO)) || | ||||
| dscene->data.background.ao_factor != 0.0f); | dscene->data.background.ao_factor != 0.0f); | ||||
| kintegrator->sample_clamp_direct = (sample_clamp_direct == 0.0f) ? FLT_MAX : | kintegrator->sample_clamp_direct = (sample_clamp_direct == 0.0f) ? FLT_MAX : | ||||
| sample_clamp_direct * 3.0f; | sample_clamp_direct * 3.0f; | ||||
| kintegrator->sample_clamp_indirect = (sample_clamp_indirect == 0.0f) ? | kintegrator->sample_clamp_indirect = (sample_clamp_indirect == 0.0f) ? | ||||
| FLT_MAX : | FLT_MAX : | ||||
| sample_clamp_indirect * 3.0f; | sample_clamp_indirect * 3.0f; | ||||
| ▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene) | ||||
| else { | else { | ||||
| kintegrator->light_inv_rr_threshold = 0.0f; | kintegrator->light_inv_rr_threshold = 0.0f; | ||||
| } | } | ||||
| /* sobol directions table */ | /* sobol directions table */ | ||||
| int max_samples = 1; | int max_samples = 1; | ||||
| if (method == BRANCHED_PATH) { | if (method == BRANCHED_PATH) { | ||||
| foreach (Light *light, scene->lights) | foreach (Light *light, scene->get_lights()) | ||||
| max_samples = max(max_samples, light->get_samples()); | max_samples = max(max_samples, light->get_samples()); | ||||
| max_samples = max(max_samples, | max_samples = max(max_samples, | ||||
| max(diffuse_samples, max(glossy_samples, transmission_samples))); | max(diffuse_samples, max(glossy_samples, transmission_samples))); | ||||
| max_samples = max(max_samples, max(ao_samples, max(mesh_light_samples, subsurface_samples))); | max_samples = max(max_samples, max(ao_samples, max(mesh_light_samples, subsurface_samples))); | ||||
| max_samples = max(max_samples, volume_samples); | max_samples = max(max_samples, volume_samples); | ||||
| } | } | ||||
| Show All 32 Lines | |||||
| void Integrator::device_free(Device *, DeviceScene *dscene) | void Integrator::device_free(Device *, DeviceScene *dscene) | ||||
| { | { | ||||
| dscene->sample_pattern_lut.free(); | dscene->sample_pattern_lut.free(); | ||||
| } | } | ||||
| void Integrator::tag_update(Scene *scene) | void Integrator::tag_update(Scene *scene) | ||||
| { | { | ||||
| foreach (Shader *shader, scene->shaders) { | foreach (Shader *shader, scene->get_shaders()) { | ||||
| if (shader->has_integrator_dependency) { | if (shader->get_has_integrator_dependency()) { | ||||
| scene->shader_manager->need_update = true; | scene->get_shader_manager()->need_update = true; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| tag_modified(); | tag_modified(); | ||||
| } | } | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||