From c66f00dc26b08d5f7be6aef080c1a0ec2de19cd7 Mon Sep 17 00:00:00 2001 From: Patrick Mours Date: Fri, 8 Jan 2021 13:38:26 +0100 Subject: Fix Cycles rendering with OptiX after instance limit increase when building with old SDK Commit d259e7dcfbbd37cec5a45fdfb554f24de10d0268 increased the instance limit, but only provided a fall back for the host code for older OptiX SDKs, not for kernel code. This caused a mismatch when an old SDK was used (as is currently the case on buildbot) and subsequent rendering artifacts. This fixes that by moving the bit that is checked to a common location that works with both old an new SDK versions. --- intern/cycles/kernel/kernels/optix/kernel_optix.cu | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'intern/cycles/kernel/kernels') diff --git a/intern/cycles/kernel/kernels/optix/kernel_optix.cu b/intern/cycles/kernel/kernels/optix/kernel_optix.cu index 0c2c84fdbdf..7f609eab474 100644 --- a/intern/cycles/kernel/kernels/optix/kernel_optix.cu +++ b/intern/cycles/kernel/kernels/optix/kernel_optix.cu @@ -45,13 +45,12 @@ template ccl_device_forceinline uint get_object_id() uint object = optixGetInstanceId(); #endif // Choose between always returning object ID or only for instances - if (always) - // Can just remove the high bit since instance always contains object ID - return object & 0x7FFFFFF; // OPTIX_ABI_VERSION >= 23 ? 0x7FFFFFF : 0x7FFFFF - // Set to OBJECT_NONE if this is not an instanced object - else if (object & 0x8000000) // OPTIX_ABI_VERSION >= 23 ? 0x8000000 : 0x800000 - object = OBJECT_NONE; - return object; + if (always || (object & 1) == 0) + // Can just remove the low bit since instance always contains object ID + return object >> 1; + else + // Set to OBJECT_NONE if this is not an instanced object + return OBJECT_NONE; } extern "C" __global__ void __raygen__kernel_optix_path_trace() -- cgit v1.2.3