diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-05-19 01:55:22 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-05-19 19:30:43 +0300 |
commit | 0456223cde98712c16cb9b584b5c66c58ec915c3 (patch) | |
tree | 50fc8cfb9553102ae7d2bb9f6f7d62474fbe179f /intern/cycles/bvh/bvh_optix.cpp | |
parent | 3e472d87a8d13aee078e156d584cf2171ed2d8a3 (diff) |
Fix T87793: Cycles OptiX crash hiding objects in viewport render
Diffstat (limited to 'intern/cycles/bvh/bvh_optix.cpp')
-rw-r--r-- | intern/cycles/bvh/bvh_optix.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/intern/cycles/bvh/bvh_optix.cpp b/intern/cycles/bvh/bvh_optix.cpp index d630e8965dc..cd266f72f89 100644 --- a/intern/cycles/bvh/bvh_optix.cpp +++ b/intern/cycles/bvh/bvh_optix.cpp @@ -17,6 +17,8 @@ #ifdef WITH_OPTIX +# include "device/device.h" + # include "bvh/bvh_optix.h" CCL_NAMESPACE_BEGIN @@ -26,6 +28,7 @@ BVHOptiX::BVHOptiX(const BVHParams ¶ms_, const vector<Object *> &objects_, Device *device) : BVH(params_, geometry_, objects_), + device(device), traversable_handle(0), as_data(device, params_.top_level ? "optix tlas" : "optix blas", false), motion_transform_data(device, "optix motion transform", false) @@ -34,7 +37,9 @@ BVHOptiX::BVHOptiX(const BVHParams ¶ms_, BVHOptiX::~BVHOptiX() { - // Acceleration structure memory is freed via the 'as_data' destructor + // Acceleration structure memory is delayed freed on device, since deleting the + // BVH may happen while still being used for rendering. + device->release_optix_bvh(this); } CCL_NAMESPACE_END |