[Bf-blender-cvs] [67d0a30de05] cycles_procedural_api: Merge branch 'cycles_optix_refit' into cycles_procedural_api
Kévin Dietrich
noreply at git.blender.org
Thu Nov 5 18:57:51 CET 2020
Commit: 67d0a30de054eeb3e6a07b0f35476ac4288cd0f2
Author: Kévin Dietrich
Date: Mon Nov 2 00:31:07 2020 +0100
Branches: cycles_procedural_api
https://developer.blender.org/rB67d0a30de054eeb3e6a07b0f35476ac4288cd0f2
Merge branch 'cycles_optix_refit' into cycles_procedural_api
===================================================================
===================================================================
diff --cc intern/cycles/device/device_optix.cpp
index 2e5a9252de4,5558354d03c..95234845f98
--- a/intern/cycles/device/device_optix.cpp
+++ b/intern/cycles/device/device_optix.cpp
@@@ -1201,9 -1215,24 +1215,24 @@@ class OptiXDevice : public CUDADevice
if (geometry.find(geom) != geometry.end())
continue;
+ OptixTraversableHandle handle;
+ OptixBuildOperation operation;
+ CUdeviceptr out_data;
+ // Refit is only possible in viewport for now.
+ if (static_cast<BVHOptiX *>(geom->bvh)->do_refit && !background) {
+ out_data = static_cast<BVHOptiX *>(geom->bvh)->optix_data_handle;
+ handle = static_cast<BVHOptiX *>(geom->bvh)->optix_handle;
+ operation = OPTIX_BUILD_OPERATION_UPDATE;
+ }
+ else {
+ out_data = 0;
+ handle = 0;
+ operation = OPTIX_BUILD_OPERATION_BUILD;
+ }
+
- if (geom->type == Geometry::HAIR) {
+ if (geom->geometry_type == Geometry::HAIR) {
// Build BLAS for curve primitives
- Hair *const hair = static_cast<Hair *const>(ob->geometry);
+ Hair *const hair = static_cast<Hair *const>(ob->get_geometry());
if (hair->num_curves() == 0) {
continue;
}
@@@ -1365,9 -1393,11 +1394,11 @@@
}
// Allocate memory for new BLAS and build it
- OptixTraversableHandle handle;
- if (build_optix_bvh(build_input, num_motion_steps, handle)) {
+ if (build_optix_bvh(build_input, num_motion_steps, handle, out_data, operation)) {
- geometry.insert({ob->geometry, handle});
+ geometry.insert({ob->get_geometry(), handle});
+ static_cast<BVHOptiX *>(geom->bvh)->optix_data_handle = out_data;
+ static_cast<BVHOptiX *>(geom->bvh)->optix_handle = handle;
+ static_cast<BVHOptiX *>(geom->bvh)->do_refit = false;
}
else {
return false;
@@@ -1439,9 -1467,11 +1470,11 @@@
build_input.triangleArray.primitiveIndexOffset = mesh->optix_prim_offset;
// Allocate memory for new BLAS and build it
- OptixTraversableHandle handle;
- if (build_optix_bvh(build_input, num_motion_steps, handle)) {
+ if (build_optix_bvh(build_input, num_motion_steps, handle, out_data, operation)) {
- geometry.insert({ob->geometry, handle});
+ geometry.insert({ob->get_geometry(), handle});
+ static_cast<BVHOptiX *>(geom->bvh)->optix_data_handle = out_data;
+ static_cast<BVHOptiX *>(geom->bvh)->optix_handle = handle;
+ static_cast<BVHOptiX *>(geom->bvh)->do_refit = false;
}
else {
return false;
More information about the Bf-blender-cvs
mailing list