[Bf-blender-cvs] [cc6c338b250] soc-2019-embree-gpu: Cycles: Remove some debug flags
MATILLAT Quentin
noreply at git.blender.org
Mon Aug 19 18:37:10 CEST 2019
Commit: cc6c338b250376dce6a8e6ea7fcd5ddc542ad470
Author: MATILLAT Quentin
Date: Mon Aug 19 17:37:08 2019 +0200
Branches: soc-2019-embree-gpu
https://developer.blender.org/rBcc6c338b250376dce6a8e6ea7fcd5ddc542ad470
Cycles: Remove some debug flags
===================================================================
M build_files/build_environment/patches/embree.diff
M intern/cycles/bvh/bvh.cpp
M intern/cycles/bvh/bvh.h
M intern/cycles/bvh/bvh2.cpp
M intern/cycles/bvh/bvh_embree.cpp
M intern/cycles/kernel/bvh/bvh_nodes.h
M intern/cycles/kernel/kernel_types.h
M intern/cycles/render/mesh.cpp
M intern/cycles/render/object.h
===================================================================
diff --git a/build_files/build_environment/patches/embree.diff b/build_files/build_environment/patches/embree.diff
index 3ca9b523f84..fc5106b6c24 100644
--- a/build_files/build_environment/patches/embree.diff
+++ b/build_files/build_environment/patches/embree.diff
@@ -1,4 +1,4 @@
-From 4a3ec5e090fa208eef6900bd9217b93e62111168 Mon Sep 17 00:00:00 2001
+From 1bd1456d289b3587e6c532085375c83bafccadf4 Mon Sep 17 00:00:00 2001
From: MATILLAT Quentin <qmatillat at gmail.com>
Date: Sun, 18 Aug 2019 15:29:34 +0200
Subject: [PATCH] Add ability to export curve from BVH
@@ -7,8 +7,8 @@ Subject: [PATCH] Add ability to export curve from BVH
include/embree3/rtcore_builder.h | 22 +++
include/embree3/rtcore_common.h | 7 +
kernels/bvh/bvh_builder_hair.cpp | 3 +-
- kernels/common/rtcore_builder.cpp | 297 ++++++++++++++++++++++--------
- 4 files changed, 251 insertions(+), 78 deletions(-)
+ kernels/common/rtcore_builder.cpp | 290 ++++++++++++++++++++++--------
+ 4 files changed, 244 insertions(+), 78 deletions(-)
diff --git a/include/embree3/rtcore_builder.h b/include/embree3/rtcore_builder.h
index af84035b0..77e754f7e 100644
@@ -77,7 +77,7 @@ index 14273787f..cad238123 100644
}
#endif
diff --git a/kernels/common/rtcore_builder.cpp b/kernels/common/rtcore_builder.cpp
-index 56858294c..9ef862979 100644
+index 56858294c..94d2e211f 100644
--- a/kernels/common/rtcore_builder.cpp
+++ b/kernels/common/rtcore_builder.cpp
@@ -29,8 +29,17 @@
@@ -98,7 +98,7 @@ index 56858294c..9ef862979 100644
namespace isa // FIXME: support more ISAs for builders
{
struct BVH : public RefCount
-@@ -334,92 +343,226 @@ namespace embree
+@@ -334,92 +343,219 @@ namespace embree
return root;
}
@@ -205,12 +205,12 @@ index 56858294c..9ef862979 100644
+ }
+ } break;
+ default:
-+ throw_RTCError(RTC_ERROR_INVALID_OPERATION,"Unexpected geom type");
++ throw_RTCError(RTC_ERROR_INVALID_OPERATION, "Unexpected curve geom type");
+ }
+
+ return args.createCurve(realNum, primsArray, userData);
+ } else {
-+ throw_RTCError(RTC_ERROR_INVALID_OPERATION,"Unexpected primitive type");
++ throw_RTCError(RTC_ERROR_INVALID_OPERATION, "Unsupported primitive");
+ }
+ }
+
@@ -258,8 +258,7 @@ index 56858294c..9ef862979 100644
+ unanode = node.unalignedNode();
+ bnode = unanode;
+ } else {
-+ throw_RTCError(RTC_ERROR_INVALID_OPERATION,"Node type is unknown");
-+ return nullptr;
++ throw_RTCError(RTC_ERROR_INVALID_OPERATION, "Unknown node type");
}
- else
- throw_RTCError(RTC_ERROR_INVALID_OPERATION,"invalid build quality");
@@ -366,12 +365,11 @@ index 56858294c..9ef862979 100644
+ for (Accel *a : scene->accels) {
+ AccelData *ad = a->intersectors.ptr;
+ if(ad->type != AccelData::TY_BVH4) {
-+ throw_RTCError(RTC_ERROR_INVALID_OPERATION,"Unable to extract non BVH4 tree")
++ throw_RTCError(RTC_ERROR_INVALID_OPERATION, "Unable to extract non BVH4 tree");
+ continue;
+ }
+
+ BVH4 *bvh = dynamic_cast<BVH4 *>(ad);
-+
+ BVH4::NodeRef root = bvh->root;
+ void *node = recurse(root, bvh->primTy, args, userData);
+ args.setAlignedBounds(node, boundsToRTC(bvh->bounds.bounds()), userData);
diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp
index 525af8123d4..607f10788a5 100644
--- a/intern/cycles/bvh/bvh.cpp
+++ b/intern/cycles/bvh/bvh.cpp
@@ -99,7 +99,6 @@ BVH::BVH(const BVHParams ¶ms_, const vector<Object *> &objects_)
BVH *BVH::create(const BVHParams ¶ms, const vector<Object *> &objects)
{
- std::cout << "Using layout : " << bvh_layout_name(params.bvh_layout) << std::endl;
switch (params.bvh_layout) {
case BVH_LAYOUT_BVH2:
return new BVH2(params, objects);
@@ -122,12 +121,6 @@ BVH *BVH::create(const BVHParams ¶ms, const vector<Object *> &objects)
/* Building */
-void BVH::buildTimed(Progress &p, Stats *s) {
- auto start = std::chrono::steady_clock::now();
- this->build(p, s);
- std::cout << std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now()-start).count() << "ms" << std::endl;
-}
-
void BVH::build(Progress &progress, Stats *)
{
progress.set_substatus("Building BVH");
@@ -155,7 +148,6 @@ void BVH::build(Progress &progress, Stats *)
if (root != bvh2_root) {
bvh2_root->deleteSubtree();
}
- std::cout << "SAH " << root->computeSubtreeSAHCost(this->params) << std::endl;
if (progress.get_cancel()) {
if (root != NULL) {
diff --git a/intern/cycles/bvh/bvh.h b/intern/cycles/bvh/bvh.h
index 65e5268c5e7..edce3ca6f2a 100644
--- a/intern/cycles/bvh/bvh.h
+++ b/intern/cycles/bvh/bvh.h
@@ -88,7 +88,6 @@ class BVH {
{
}
- void buildTimed(Progress &p, Stats *s);
virtual void build(Progress &progress, Stats *stats = NULL);
void refit(Progress &progress);
diff --git a/intern/cycles/bvh/bvh2.cpp b/intern/cycles/bvh/bvh2.cpp
index 6a2875adaac..6fa26e8e6db 100644
--- a/intern/cycles/bvh/bvh2.cpp
+++ b/intern/cycles/bvh/bvh2.cpp
@@ -161,7 +161,6 @@ void BVH2::pack_unaligned_node(int idx,
void BVH2::pack_nodes(const BVHNode *root)
{
- std::cout << "BVH2 SAH is " << root->computeSubtreeSAHCost(this->params) << std::endl;
const size_t num_nodes = root->getSubtreeSize(BVH_STAT_NODE_COUNT);
const size_t num_leaf_nodes = root->getSubtreeSize(BVH_STAT_LEAF_COUNT);
assert(num_leaf_nodes <= num_nodes);
diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp
index c3bc8dd3509..ae50ca50310 100644
--- a/intern/cycles/bvh/bvh_embree.cpp
+++ b/intern/cycles/bvh/bvh_embree.cpp
@@ -55,11 +55,11 @@
# include "util/util_logging.h"
# include "util/util_progress.h"
# include "bvh_embree_converter.h"
+
CCL_NAMESPACE_BEGIN
# define IS_HAIR(x) (x & 1)
-
/* This gets called by Embree at every valid ray/object intersection.
* Things like recording subsurface or shadow hits for later evaluation
* as well as filtering for volume objects happen here.
@@ -303,7 +303,7 @@ BVHEmbree::BVHEmbree(const BVHParams ¶ms_, const vector<Object *> &objects_)
_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
thread_scoped_lock lock(rtc_shared_mutex);
if (rtc_shared_users == 0) {
- rtc_shared_device = rtcNewDevice("verbose=0;tri_accel=bvh4.triangle4v");
+ rtc_shared_device = rtcNewDevice("verbose=0");
/* Check here if Embree was built with the correct flags. */
ssize_t ret = rtcGetDeviceProperty(rtc_shared_device, RTC_DEVICE_PROPERTY_RAY_MASK_SUPPORTED);
if (ret != 1) {
@@ -527,8 +527,6 @@ void BVHEmbree::add_instance(Object *ob, int i)
assert(0);
return;
}
- ob->pack_index = pack.prim_index.size();
-
BVHEmbree *instance_bvh = (BVHEmbree *)(ob->mesh->bvh);
if (instance_bvh->top_level != this) {
@@ -924,7 +922,7 @@ void BVHEmbree::pack_nodes(const BVHNode *)
else {
pack_prim_index[pack_prim_index_offset] = bvh_prim_index[i] + mesh_tri_offset;
pack_prim_tri_index[pack_prim_index_offset] = bvh_prim_tri_index[i] +
- pack_prim_tri_verts_offset;
+ pack_prim_tri_verts_offset;
}
pack_prim_type[pack_prim_index_offset] = bvh_prim_type[i];
@@ -938,8 +936,8 @@ void BVHEmbree::pack_nodes(const BVHNode *)
if (bvh->pack.prim_tri_verts.size()) {
const size_t prim_tri_size = bvh->pack.prim_tri_verts.size();
memcpy(pack_prim_tri_verts + pack_prim_tri_verts_offset,
- &bvh->pack.prim_tri_verts[0],
- prim_tri_size * sizeof(float4));
+ &bvh->pack.prim_tri_verts[0],
+ prim_tri_size * sizeof(float4));
pack_prim_tri_verts_offset += prim_tri_size;
}
@@ -967,7 +965,6 @@ void BVHEmbree::refit_nodes()
}
rtcCommitScene(scene);
}
-
CCL_NAMESPACE_END
#endif /* WITH_EMBREE */
diff --git a/intern/cycles/kernel/bvh/bvh_nodes.h b/intern/cycles/kernel/bvh/bvh_nodes.h
index db9203ce328..a0356c13518 100644
--- a/intern/cycles/kernel/bvh/bvh_nodes.h
+++ b/intern/cycles/kernel/bvh/bvh_nodes.h
@@ -29,7 +29,6 @@ ccl_device_forceinline Transform bvh_unaligned_node_fetch_space(KernelGlobals *k
}
#if !defined(__KERNEL_SSE2__)
-
ccl_device_forceinline int bvh_aligned_node_intersect(KernelGlobals *kg,
const float3 P,
const float3 idir,
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index e7953d6d28d..97303936b66 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -321,10 +321,10 @@ enum PathRayFlag {
/* Path and shader is being evaluated for direct lighting emission. */
PATH_RAY_EMISSION = (1 << 22),
- /* Special flag to tag 4D BVH nodes (they also cary time bounds). */
+ /* Special flag to tag 4D BVH nodes (they also carry time bounds). */
PATH_RAY_NODE_4D = (1 << 23),
- /* Special flag to tag 4D BVH nodes (they also cary time bounds). */
+ /* Special flag to tag nodes that can be linearly interpolated */
PATH_RAY_NODE_MB = (1 << 24),
PATH_RAY_NODE_CLEAR = (PATH_RAY_NODE_4D | PATH_RAY_NODE_UNALIGNED | PATH_RAY_NODE_MB),
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index e6b5f78ffee..127e3e641a0 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -1904,7 +1904,7 @@ void MeshManager::device_update_bvh(Device *device,
bparams.curve_flags = dscene->data.curve.curveflags;
bparams.curve_subdivisions = dscene->data.curve.subdivisions;
- std::cout << "Using " << bvh_layout_name(bparams.bvh_layout) << " layout.";
+ VLOG(1) << "Using " << bvh_layout_name(bparams.bvh_layout) << " layout.";
#ifdef WITH_EMBREE
if (bparams.bvh_layout == BVH_LAYOUT_EMBREE) {
@@ -1915,7 +1915,7 @@ void MeshManager::device_update_bvh(Device *device,
#endif
BVH *bvh = BVH::create(bparams, scene->objects);
- bvh->buildTimed(progress, &device->stats);
+ bvh->build(progres
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list