Commit: 10d2cbfa369a512730a53192ccfe2473c9d96035
Author: Brecht Van Lommel
Date:   Wed Jan 20 13:03:09 2021 +0100
Branches: blender-v2.92-release
https://developer.blender.org/rB10d2cbfa369a512730a53192ccfe2473c9d96035

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

===================================================================

M       intern/cycles/blender/blender_sync.cpp
M       intern/cycles/device/device.cpp
M       intern/cycles/device/device.h
M       intern/cycles/device/device_optix.cpp
M       intern/cycles/render/integrator.cpp

===================================================================

diff --git a/intern/cycles/blender/blender_sync.cpp 
b/intern/cycles/blender/blender_sync.cpp
index b830db7485b..e27daa2488d 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -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;
     }
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index 1efd628b79b..94732cd1855 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -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;
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index e9b7cde7a16..0a731969c79 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -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;
diff --git a/intern/cycles/device/device_optix.cpp 
b/intern/cycles/device/device_optix.cpp
index f04113635f3..07ce63f5394 100644
--- a/intern/cycles/device/device_optix.cpp
+++ b/intern/cycles/device/device_optix.cpp
@@ -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);
   }
diff --git a/intern/cycles/render/integrator.cpp 
b/intern/cycles/render/integrator.cpp
index 3dc4b2fd4c5..e5b9e6bfabf 100644
--- a/intern/cycles/render/integrator.cpp
+++ b/intern/cycles/render/integrator.cpp
@@ -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());

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to