[Bf-blender-cvs] [9daf6a69a6a] blender-v3.0-release: Fix T92472: OptiX denoising artifacts with recent GPU driver 495.29.05 or newer on Linux

Patrick Mours noreply at git.blender.org
Tue Nov 9 14:48:26 CET 2021


Commit: 9daf6a69a6acd95f0b46bc45e5f3ae27d0904764
Author: Patrick Mours
Date:   Tue Nov 9 12:24:54 2021 +0100
Branches: blender-v3.0-release
https://developer.blender.org/rB9daf6a69a6acd95f0b46bc45e5f3ae27d0904764

Fix T92472: OptiX denoising artifacts with recent GPU driver 495.29.05 or newer on Linux

Adds a workaround for a driver bug in r495 that causes artifacts with OptiX denoising.
`optixDenoiserSetup` is not working properly there when called with a stream other than the
default stream, so use the default stream for now and force synchronization across the entire
context afterwards to ensure the other stream Cycles uses to enqueue the actual denoising
command cannot execute before the denoising setup has finished.

Maniphest Tasks: T92472

Differential Revision: https://developer.blender.org/D13158

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

M	intern/cycles/device/optix/device_impl.cpp

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

diff --git a/intern/cycles/device/optix/device_impl.cpp b/intern/cycles/device/optix/device_impl.cpp
index 9b9a5ac0de7..7f94212f383 100644
--- a/intern/cycles/device/optix/device_impl.cpp
+++ b/intern/cycles/device/optix/device_impl.cpp
@@ -891,20 +891,23 @@ bool OptiXDevice::denoise_configure_if_needed(DenoiseContext &context)
   denoiser_.state.alloc_to_device(denoiser_.scratch_offset + denoiser_.scratch_size);
 
   /* Initialize denoiser state for the current tile size. */
-  const OptixResult result = optixDenoiserSetup(denoiser_.optix_denoiser,
-                                                denoiser_.queue.stream(),
-                                                buffer_params.width,
-                                                buffer_params.height,
-                                                denoiser_.state.device_pointer,
-                                                denoiser_.scratch_offset,
-                                                denoiser_.state.device_pointer +
-                                                    denoiser_.scratch_offset,
-                                                denoiser_.scratch_size);
+  const OptixResult result = optixDenoiserSetup(
+      denoiser_.optix_denoiser,
+      0, /* Work around bug in r495 drivers that causes artifacts when denoiser setup is called
+            on a stream that is not the default stream */
+      buffer_params.width,
+      buffer_params.height,
+      denoiser_.state.device_pointer,
+      denoiser_.scratch_offset,
+      denoiser_.state.device_pointer + denoiser_.scratch_offset,
+      denoiser_.scratch_size);
   if (result != OPTIX_SUCCESS) {
     set_error("Failed to set up OptiX denoiser");
     return false;
   }
 
+  cuda_assert(cuCtxSynchronize());
+
   denoiser_.is_configured = true;
   denoiser_.configured_size.x = buffer_params.width;
   denoiser_.configured_size.y = buffer_params.height;



More information about the Bf-blender-cvs mailing list