Fix T84872: OptiX GPU + CPU rendering uses branched path samples

Branched path tracing is not supported for OptiX, and it would still use the
number of AA samples from there when branched path was enabled by the user
earlier but auto disabled and hidden in the UI when using OptiX.

Ref D10159
This commit is contained in:
Brecht Van Lommel 2021-01-20 13:03:09 +01:00
parent 1451f7d093
commit 10d2cbfa36
5 changed files with 9 additions and 4 deletions

@ -853,7 +853,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine &b_engine,
preview_samples = preview_samples * preview_samples;
}
if (get_enum(cscene, "progressive") == 0 && (params.device.type != DEVICE_OPTIX)) {
if (get_enum(cscene, "progressive") == 0 && params.device.has_branched_path) {
if (background) {
params.samples = aa_samples;
}

@ -620,6 +620,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
info.has_half_images = true;
info.has_volume_decoupled = true;
info.has_branched_path = true;
info.has_adaptive_stop_per_sample = true;
info.has_osl = true;
info.has_profiling = true;
@ -665,6 +666,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
/* Accumulate device info. */
info.has_half_images &= device.has_half_images;
info.has_volume_decoupled &= device.has_volume_decoupled;
info.has_branched_path &= device.has_branched_path;
info.has_adaptive_stop_per_sample &= device.has_adaptive_stop_per_sample;
info.has_osl &= device.has_osl;
info.has_profiling &= device.has_profiling;

@ -79,6 +79,7 @@ class DeviceInfo {
bool display_device; /* GPU is used as a display device. */
bool has_half_images; /* Support half-float textures. */
bool has_volume_decoupled; /* Decoupled volume shading. */
bool has_branched_path; /* Supports branched path tracing. */
bool has_adaptive_stop_per_sample; /* Per-sample adaptive sampling stopping. */
bool has_osl; /* Support Open Shading Language. */
bool use_split_kernel; /* Use split or mega kernel. */
@ -99,6 +100,7 @@ class DeviceInfo {
display_device = false;
has_half_images = false;
has_volume_decoupled = false;
has_branched_path = true;
has_adaptive_stop_per_sample = false;
has_osl = false;
use_split_kernel = false;

@ -1857,6 +1857,7 @@ void device_optix_info(const vector<DeviceInfo> &cuda_devices, vector<DeviceInfo
info.type = DEVICE_OPTIX;
info.id += "_OptiX";
info.denoisers |= DENOISER_OPTIX;
info.has_branched_path = false;
devices.push_back(info);
}

@ -168,7 +168,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
FLT_MAX :
sample_clamp_indirect * 3.0f;
kintegrator->branched = (method == BRANCHED_PATH);
kintegrator->branched = (method == BRANCHED_PATH) && device->info.has_branched_path;
kintegrator->volume_decoupled = device->info.has_volume_decoupled;
kintegrator->diffuse_samples = diffuse_samples;
kintegrator->glossy_samples = glossy_samples;
@ -179,7 +179,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
kintegrator->volume_samples = volume_samples;
kintegrator->start_sample = start_sample;
if (method == BRANCHED_PATH) {
if (kintegrator->branched) {
kintegrator->sample_all_lights_direct = sample_all_lights_direct;
kintegrator->sample_all_lights_indirect = sample_all_lights_indirect;
}
@ -224,7 +224,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
/* sobol directions table */
int max_samples = 1;
if (method == BRANCHED_PATH) {
if (kintegrator->branched) {
foreach (Light *light, scene->lights)
max_samples = max(max_samples, light->get_samples());