diff options
author | Patrick Mours <pmours@nvidia.com> | 2022-06-03 13:24:13 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2022-06-03 13:24:13 +0300 |
commit | 5c6053ccb1cbbe57d5a9d0aa33eadc6cb3e9dc9a (patch) | |
tree | 9663ab39a84756de58e4f30916c67ef9c3dfc13a /intern/cycles/device/optix | |
parent | 50976657ac1cf5bb110c4bf97186091e33bb02ae (diff) |
Fix misaligned address error when rendering 3D curves in the viewport with Cycles and OptiX 7.4
Acceleration structures in the viewport default to building with the fast
build flag, but the intersection program used for curves was queried with
the fast trace flag. The resulting mismatch caused an exception in the
intersection kernel. Since it's difficult to predict whether dynamic or static
acceleration structures are going to be built at the time of kernel loading,
this fixes the mismatch by always using the fast trace flag for curves.
Diffstat (limited to 'intern/cycles/device/optix')
-rw-r--r-- | intern/cycles/device/optix/device_impl.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/intern/cycles/device/optix/device_impl.cpp b/intern/cycles/device/optix/device_impl.cpp index 35717c49d1a..9ab9bbb59c5 100644 --- a/intern/cycles/device/optix/device_impl.cpp +++ b/intern/cycles/device/optix/device_impl.cpp @@ -553,7 +553,8 @@ bool OptiXDevice::load_kernels(const uint kernel_features) OptixBuiltinISOptions builtin_options = {}; # if OPTIX_ABI_VERSION >= 55 builtin_options.builtinISModuleType = OPTIX_PRIMITIVE_TYPE_ROUND_CATMULLROM; - builtin_options.buildFlags = OPTIX_BUILD_FLAG_PREFER_FAST_TRACE; + builtin_options.buildFlags = OPTIX_BUILD_FLAG_PREFER_FAST_TRACE | + OPTIX_BUILD_FLAG_ALLOW_COMPACTION; builtin_options.curveEndcapFlags = OPTIX_CURVE_ENDCAP_DEFAULT; /* Disable end-caps. */ # else builtin_options.builtinISModuleType = OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE; @@ -1387,7 +1388,10 @@ bool OptiXDevice::build_optix_bvh(BVHOptiX *bvh, OptixAccelBufferSizes sizes = {}; OptixAccelBuildOptions options = {}; options.operation = operation; - if (use_fast_trace_bvh) { + if (use_fast_trace_bvh || + /* The build flags have to match the ones used to query the built-in curve intersection + program (see optixBuiltinISModuleGet above) */ + build_input.type == OPTIX_BUILD_INPUT_TYPE_CURVES) { VLOG(2) << "Using fast to trace OptiX BVH"; options.buildFlags = OPTIX_BUILD_FLAG_PREFER_FAST_TRACE | OPTIX_BUILD_FLAG_ALLOW_COMPACTION; } |