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
This commit is contained in:
Patrick Mours 2021-11-09 12:24:54 +01:00
parent 65c5ebf577
commit 9daf6a69a6
Notes: blender-bot 2023-02-14 00:44:02 +01:00
Referenced by issue #92472, OptiX denoising artifacts with recent GPU driver 495.29.05 or newer on Linux
1 changed files with 12 additions and 9 deletions

View File

@ -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;