2023-06-14 16:52:36 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2019 NVIDIA Corporation
|
|
|
|
|
* SPDX-FileCopyrightText: 2019-2022 Blender Foundation
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0 */
|
2019-09-12 14:50:06 +02:00
|
|
|
|
|
|
|
|
#ifdef WITH_OPTIX
|
|
|
|
|
|
2021-05-19 00:55:22 +02:00
|
|
|
# include "device/device.h"
|
|
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
# include "bvh/optix.h"
|
2020-06-05 11:39:11 +02:00
|
|
|
|
2019-09-12 14:50:06 +02:00
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
|
|
BVHOptiX::BVHOptiX(const BVHParams ¶ms_,
|
2020-02-02 12:04:19 +01:00
|
|
|
const vector<Geometry *> &geometry_,
|
2020-12-10 14:18:25 +01:00
|
|
|
const vector<Object *> &objects_,
|
|
|
|
|
Device *device)
|
|
|
|
|
: BVH(params_, geometry_, objects_),
|
2021-05-19 00:55:22 +02:00
|
|
|
device(device),
|
2020-12-10 14:18:25 +01:00
|
|
|
traversable_handle(0),
|
2021-11-22 17:07:55 +01:00
|
|
|
as_data(make_unique<device_only_memory<char>>(
|
|
|
|
|
device, params.top_level ? "optix tlas" : "optix blas", false)),
|
|
|
|
|
motion_transform_data(
|
|
|
|
|
make_unique<device_only_memory<char>>(device, "optix motion transform", false))
|
2019-09-12 14:50:06 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BVHOptiX::~BVHOptiX()
|
|
|
|
|
{
|
2021-11-22 17:07:55 +01:00
|
|
|
/* Acceleration structure memory is delayed freed on device, since deleting the
|
|
|
|
|
* BVH may happen while still being used for rendering. */
|
2024-03-18 11:00:21 +01:00
|
|
|
device->release_bvh(this);
|
2019-09-12 14:50:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CCL_NAMESPACE_END
|
|
|
|
|
|
|
|
|
|
#endif /* WITH_OPTIX */
|