[Bf-blender-cvs] [d245d675d02] cycles_procedural_api: handle comments for review
Kévin Dietrich
noreply at git.blender.org
Thu Nov 5 18:57:50 CET 2020
Commit: d245d675d027c264e3a16974cf65fe4c12868b2b
Author: Kévin Dietrich
Date: Tue Oct 27 13:55:20 2020 +0100
Branches: cycles_procedural_api
https://developer.blender.org/rBd245d675d027c264e3a16974cf65fe4c12868b2b
handle comments for review
===================================================================
M intern/cycles/bvh/bvh_optix.cpp
M intern/cycles/bvh/bvh_optix.h
M intern/cycles/device/device_optix.cpp
M intern/cycles/render/geometry.cpp
M intern/cycles/render/geometry.h
===================================================================
diff --git a/intern/cycles/bvh/bvh_optix.cpp b/intern/cycles/bvh/bvh_optix.cpp
index 51611a4aaf6..9dfe3c56445 100644
--- a/intern/cycles/bvh/bvh_optix.cpp
+++ b/intern/cycles/bvh/bvh_optix.cpp
@@ -37,6 +37,8 @@ BVHOptiX::BVHOptiX(const BVHParams ¶ms_,
const vector<Object *> &objects_)
: BVH(params_, geometry_, objects_)
{
+ optix_handle = 0;
+ optix_data_handle = 0;
}
BVHOptiX::~BVHOptiX()
diff --git a/intern/cycles/bvh/bvh_optix.h b/intern/cycles/bvh/bvh_optix.h
index e4745b093b5..38da6b55c5d 100644
--- a/intern/cycles/bvh/bvh_optix.h
+++ b/intern/cycles/bvh/bvh_optix.h
@@ -32,7 +32,10 @@ class Optix;
class BVHOptiX : public BVH {
friend class BVH;
- public:
+ public:
+ unsigned long long optix_handle;
+ unsigned long long optix_data_handle;
+
BVHOptiX(const BVHParams ¶ms,
const vector<Geometry *> &geometry,
const vector<Object *> &objects);
diff --git a/intern/cycles/device/device_optix.cpp b/intern/cycles/device/device_optix.cpp
index a14aef35063..c9667852497 100644
--- a/intern/cycles/device/device_optix.cpp
+++ b/intern/cycles/device/device_optix.cpp
@@ -18,6 +18,7 @@
#ifdef WITH_OPTIX
# include "bvh/bvh.h"
+# include "bvh/bvh_optix.h"
# include "device/cuda/device_cuda.h"
# include "device/device_denoising.h"
# include "device/device_intern.h"
@@ -1079,7 +1080,7 @@ class OptiXDevice : public CUDADevice {
bool build_optix_bvh(const OptixBuildInput &build_input,
uint16_t num_motion_steps,
OptixTraversableHandle &out_handle,
- CUdeviceptr &out_data_ptr,
+ CUdeviceptr &out_data,
OptixBuildOperation operation)
{
const CUDAContextScope scope(cuContext);
@@ -1119,13 +1120,8 @@ class OptiXDevice : public CUDADevice {
move_textures_to_host(size - free, false);
}
- CUdeviceptr out_data = 0;
if (operation == OPTIX_BUILD_OPERATION_BUILD) {
check_result_cuda_ret(cuMemAlloc(&out_data, sizes.outputSizeInBytes));
- out_data_ptr = out_data;
- }
- else {
- out_data = out_data_ptr;
}
as_mem.push_back(out_data);
@@ -1199,7 +1195,7 @@ class OptiXDevice : public CUDADevice {
for (Geometry *geom : bvh->geometry) {
if (geom->do_optix_refit) {
- refit_mem.insert(geom->optix_data_handle);
+ refit_mem.insert(static_cast<BVHOptiX *>(geom->bvh)->optix_data_handle);
}
}
@@ -1224,8 +1220,8 @@ class OptiXDevice : public CUDADevice {
CUdeviceptr out_data;
// Refit is only possible in viewport for now.
if (ob->geometry->do_optix_refit && !background) {
- out_data = geom->optix_data_handle;
- handle = geom->optix_handle;
+ out_data = static_cast<BVHOptiX *>(geom->bvh)->optix_data_handle;
+ handle = static_cast<BVHOptiX *>(geom->bvh)->optix_handle;
operation = OPTIX_BUILD_OPERATION_UPDATE;
}
else {
@@ -1399,8 +1395,8 @@ class OptiXDevice : public CUDADevice {
// Allocate memory for new BLAS and build it
if (build_optix_bvh(build_input, num_motion_steps, handle, out_data, operation)) {
geometry.insert({ob->geometry, handle});
- geom->optix_data_handle = out_data;
- geom->optix_handle = handle;
+ static_cast<BVHOptiX *>(geom->bvh)->optix_data_handle = out_data;
+ static_cast<BVHOptiX *>(geom->bvh)->optix_handle = handle;
geom->do_optix_refit = false;
}
else {
@@ -1473,8 +1469,8 @@ class OptiXDevice : public CUDADevice {
// Allocate memory for new BLAS and build it
if (build_optix_bvh(build_input, num_motion_steps, handle, out_data, operation)) {
geometry.insert({ob->geometry, handle});
- geom->optix_data_handle = out_data;
- geom->optix_handle = handle;
+ static_cast<BVHOptiX *>(geom->bvh)->optix_data_handle = out_data;
+ static_cast<BVHOptiX *>(geom->bvh)->optix_handle = handle;
geom->do_optix_refit = false;
}
else {
diff --git a/intern/cycles/render/geometry.cpp b/intern/cycles/render/geometry.cpp
index 65a869875bc..587ed4f418b 100644
--- a/intern/cycles/render/geometry.cpp
+++ b/intern/cycles/render/geometry.cpp
@@ -75,8 +75,6 @@ Geometry::Geometry(const NodeType *node_type, const Type type)
optix_prim_offset = 0;
prim_offset = 0;
do_optix_refit = false;
- optix_handle = 0;
- optix_data_handle = 0;
}
Geometry::~Geometry()
diff --git a/intern/cycles/render/geometry.h b/intern/cycles/render/geometry.h
index 85df927f7f4..2728d29de41 100644
--- a/intern/cycles/render/geometry.h
+++ b/intern/cycles/render/geometry.h
@@ -91,8 +91,6 @@ class Geometry : public Node {
bool need_update;
bool need_update_rebuild;
bool do_optix_refit;
- unsigned long long optix_handle;
- unsigned long long optix_data_handle;
/* Index into scene->geometry (only valid during update) */
size_t index;
More information about the Bf-blender-cvs
mailing list