diff options
-rw-r--r-- | intern/cycles/kernel/kernel_adaptive_sampling.h | 9 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 6 | ||||
-rw-r--r-- | intern/cycles/render/film.cpp | 12 |
3 files changed, 20 insertions, 7 deletions
diff --git a/intern/cycles/kernel/kernel_adaptive_sampling.h b/intern/cycles/kernel/kernel_adaptive_sampling.h index 047fe8c92ec..ee4d1507ef1 100644 --- a/intern/cycles/kernel/kernel_adaptive_sampling.h +++ b/intern/cycles/kernel/kernel_adaptive_sampling.h @@ -150,6 +150,7 @@ ccl_device void kernel_adaptive_post_adjust(KernelGlobals *kg, } #endif /* __DENOISING_FEATURES__ */ + /* Cryptomatte. */ if (kernel_data.film.cryptomatte_passes) { int num_slots = 0; num_slots += (kernel_data.film.cryptomatte_passes & CRYPT_OBJECT) ? 1 : 0; @@ -162,6 +163,14 @@ ccl_device void kernel_adaptive_post_adjust(KernelGlobals *kg, id_buffer[slot].y *= sample_multiplier; } } + + /* AOVs. */ + for (int i = 0; i < kernel_data.film.pass_aov_value_num; i++) { + *(buffer + kernel_data.film.pass_aov_value + i) *= sample_multiplier; + } + for (int i = 0; i < kernel_data.film.pass_aov_color_num; i++) { + *((ccl_global float4 *)(buffer + kernel_data.film.pass_aov_color) + i) *= sample_multiplier; + } } /* This is a simple box filter in two passes. diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index b6d319311a1..44c936da626 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -1242,7 +1242,9 @@ typedef struct KernelFilm { int pass_aov_color; int pass_aov_value; - int pad1; + int pass_aov_color_num; + int pass_aov_value_num; + int pad1, pad2, pad3; /* XYZ to rendering color space transform. float4 instead of float3 to * ensure consistent padding/alignment across devices. */ @@ -1265,7 +1267,7 @@ typedef struct KernelFilm { int use_display_exposure; int use_display_pass_alpha; - int pad3, pad4, pad5; + int pad4, pad5, pad6; } KernelFilm; static_assert_align(KernelFilm, 16); diff --git a/intern/cycles/render/film.cpp b/intern/cycles/render/film.cpp index baf02901123..f28c943ea6c 100644 --- a/intern/cycles/render/film.cpp +++ b/intern/cycles/render/film.cpp @@ -362,8 +362,10 @@ void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene) kfilm->light_pass_flag = 0; kfilm->pass_stride = 0; kfilm->use_light_pass = use_light_visibility; + kfilm->pass_aov_value_num = 0; + kfilm->pass_aov_color_num = 0; - bool have_cryptomatte = false, have_aov_color = false, have_aov_value = false; + bool have_cryptomatte = false; for (size_t i = 0; i < passes.size(); i++) { Pass &pass = passes[i]; @@ -498,16 +500,16 @@ void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene) kfilm->pass_sample_count = kfilm->pass_stride; break; case PASS_AOV_COLOR: - if (!have_aov_color) { + if (kfilm->pass_aov_value_num == 0) { kfilm->pass_aov_color = kfilm->pass_stride; - have_aov_color = true; } + kfilm->pass_aov_value_num++; break; case PASS_AOV_VALUE: - if (!have_aov_value) { + if (kfilm->pass_aov_color_num == 0) { kfilm->pass_aov_value = kfilm->pass_stride; - have_aov_value = true; } + kfilm->pass_aov_color_num++; break; default: assert(false); |