[Bf-blender-cvs] [30af08c7883] cycles_embree: Cycles: Laid some foundation for embree ray accelerator: flags, UI and CMake
Stefan Werner
noreply at git.blender.org
Sun Nov 26 23:11:02 CET 2017
Commit: 30af08c7883cc5555664ccc8239bb7175da88e13
Author: Stefan Werner
Date: Tue May 30 13:25:26 2017 +0200
Branches: cycles_embree
https://developer.blender.org/rB30af08c7883cc5555664ccc8239bb7175da88e13
Cycles: Laid some foundation for embree ray accelerator: flags, UI and CMake
===================================================================
M CMakeLists.txt
M build_files/cmake/macros.cmake
M intern/cycles/CMakeLists.txt
M intern/cycles/app/CMakeLists.txt
M intern/cycles/blender/addon/properties.py
M intern/cycles/blender/addon/ui.py
M intern/cycles/blender/blender_sync.cpp
M intern/cycles/bvh/CMakeLists.txt
M intern/cycles/bvh/bvh.cpp
A intern/cycles/bvh/bvh_embree.cpp
A intern/cycles/bvh/bvh_embree.h
M intern/cycles/bvh/bvh_params.h
M intern/cycles/render/mesh.cpp
M intern/cycles/render/scene.h
M source/blender/python/intern/CMakeLists.txt
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 359e51adbb6..a21568d38d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -407,6 +407,7 @@ option(WITH_CYCLES "Enable Cycles Render Engine" ON)
option(WITH_CYCLES_STANDALONE "Build Cycles standalone application" OFF)
option(WITH_CYCLES_STANDALONE_GUI "Build Cycles standalone with GUI" OFF)
option(WITH_CYCLES_OSL "Build Cycles with OSL support" ${_init_CYCLES_OSL})
+option(WITH_CYCLES_EMBREE "Build Cycles with embree support" ON)
option(WITH_CYCLES_OPENSUBDIV "Build Cycles with OpenSubdiv support" ${_init_CYCLES_OPENSUBDIV})
option(WITH_CYCLES_CUDA_BINARIES "Build Cycles CUDA binaries" OFF)
set(CYCLES_CUDA_BINARIES_ARCH sm_20 sm_21 sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 CACHE STRING "CUDA architectures to build binaries for")
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 6998595a6fc..7992872ea76 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -423,6 +423,9 @@ function(setup_liblinks
if(WITH_CYCLES_OSL)
target_link_libraries(${target} ${OSL_LIBRARIES})
endif()
+ if(WITH_CYCLES_EMBREE)
+ target_link_libraries(${target} ${EMBREE_LIBRARIES})
+ endif()
if(WITH_BOOST)
target_link_libraries(${target} ${BOOST_LIBRARIES})
if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index dbf1bcece16..f4a50716abd 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -155,6 +155,15 @@ if(WITH_CYCLES_OSL)
)
endif()
+if(WITH_CYCLES_EMBREE)
+ find_package(embree 2.16.1 REQUIRED)
+ add_definitions(-DWITH_EMBREE)
+ include_directories(
+ SYSTEM
+ ${EMBREE_INCLUDE_DIRS}
+ )
+endif()
+
if(WITH_CYCLES_OPENSUBDIV)
add_definitions(-DWITH_OPENSUBDIV)
include_directories(
diff --git a/intern/cycles/app/CMakeLists.txt b/intern/cycles/app/CMakeLists.txt
index 08a3931ef46..f45e8592740 100644
--- a/intern/cycles/app/CMakeLists.txt
+++ b/intern/cycles/app/CMakeLists.txt
@@ -77,6 +77,9 @@ macro(cycles_target_link_libraries target)
if(WITH_CYCLES_OSL)
target_link_libraries(${target} ${OSL_LIBRARIES} ${LLVM_LIBRARIES})
endif()
+ if(WITH_CYCLES_EMBREE)
+ target_link_libraries(${target} ${EMBREE_LIBRARIES})
+ endif()
if(WITH_CYCLES_OPENSUBDIV)
target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES})
endif()
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index e5084138a9c..b75929b91b2 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -512,6 +512,11 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default=0,
min=0, max=16,
)
+ cls.use_bvh_embree = BoolProperty(
+ name="Use embree",
+ description="Use embree as ray accelerator",
+ default=False,
+ )
cls.tile_order = EnumProperty(
name="Tile Order",
description="Tile order for rendering",
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 03ca1ab6c7f..28d323e018e 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -421,11 +421,16 @@ class CYCLES_RENDER_PT_performance(CyclesButtonsPanel, Panel):
col.separator()
col.label(text="Acceleration structure:")
- col.prop(cscene, "debug_use_spatial_splits")
- col.prop(cscene, "debug_use_hair_bvh")
+ col.prop(cscene, "use_bvh_embree")
+ row = col.row()
+ row.active = not cscene.use_bvh_embree
+ row.prop(cscene, "debug_use_spatial_splits")
+ row = col.row()
+ row.active = not cscene.use_bvh_embree
+ row.prop(cscene, "debug_use_hair_bvh")
row = col.row()
- row.active = not cscene.debug_use_spatial_splits
+ row.active = not cscene.debug_use_spatial_splits and not cscene.use_bvh_embree
row.prop(cscene, "debug_bvh_time_steps")
col = layout.column()
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index e24ed31b926..9f8fbc9932f 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -646,6 +646,7 @@ SceneParams BlenderSync::get_scene_params(BL::Scene& b_scene,
params.use_bvh_spatial_split = RNA_boolean_get(&cscene, "debug_use_spatial_splits");
params.use_bvh_unaligned_nodes = RNA_boolean_get(&cscene, "debug_use_hair_bvh");
params.num_bvh_time_steps = RNA_int_get(&cscene, "debug_bvh_time_steps");
+ params.use_bvh_embree = RNA_int_get(&cscene, "use_bvh_embree");
if(background && params.shadingsystem != SHADINGSYSTEM_OSL)
params.persistent_data = r.use_persistent_data();
diff --git a/intern/cycles/bvh/CMakeLists.txt b/intern/cycles/bvh/CMakeLists.txt
index 6078db5a8ca..d84dee04696 100644
--- a/intern/cycles/bvh/CMakeLists.txt
+++ b/intern/cycles/bvh/CMakeLists.txt
@@ -12,6 +12,7 @@ set(SRC
bvh4.cpp
bvh_binning.cpp
bvh_build.cpp
+ bvh_embree.cpp
bvh_node.cpp
bvh_sort.cpp
bvh_split.cpp
@@ -24,6 +25,7 @@ set(SRC_HEADERS
bvh4.h
bvh_binning.h
bvh_build.h
+ bvh_embree.h
bvh_node.h
bvh_params.h
bvh_sort.h
diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp
index 6531ca50d9a..37d96ce99c9 100644
--- a/intern/cycles/bvh/bvh.cpp
+++ b/intern/cycles/bvh/bvh.cpp
@@ -25,6 +25,10 @@
#include "bvh/bvh_build.h"
#include "bvh/bvh_node.h"
+#ifdef WITH_EMBREE
+#include "bvh/bvh_embree.h"
+#endif
+
#include "util/util_foreach.h"
#include "util/util_progress.h"
@@ -51,6 +55,10 @@ BVH::BVH(const BVHParams& params_, const vector<Object*>& objects_)
BVH *BVH::create(const BVHParams& params, const vector<Object*>& objects)
{
+#ifdef WITH_EMBREE
+ if(params.use_bvh_embree)
+ return new BVHEmbree(params, objects);
+#endif
if(params.use_qbvh)
return new BVH4(params, objects);
else
diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp
new file mode 100644
index 00000000000..926b5daf4fc
--- /dev/null
+++ b/intern/cycles/bvh/bvh_embree.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2017, Blender Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef WITH_EMBREE
+
+#include "bvh/bvh_embree.h"
+
+#include "render/mesh.h"
+#include "render/object.h"
+
+CCL_NAMESPACE_BEGIN
+
+BVHEmbree::BVHEmbree(const BVHParams& params_, const vector<Object*>& objects_)
+: BVH(params_, objects_)
+{
+
+}
+
+void BVHEmbree::pack_nodes(const BVHNode *root)
+{
+
+}
+
+void BVHEmbree::refit_nodes()
+{
+
+}
+CCL_NAMESPACE_END
+
+#endif /* WITH_EMBREE */
diff --git a/intern/cycles/bvh/bvh_embree.h b/intern/cycles/bvh/bvh_embree.h
new file mode 100644
index 00000000000..94ad940af2a
--- /dev/null
+++ b/intern/cycles/bvh/bvh_embree.h
@@ -0,0 +1,47 @@
+/*
+ * Modifications Copyright 2017, Blender Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __BVH_EMBREE_H__
+#define __BVH_EMBREE_H__
+
+#ifdef WITH_EMBREE
+
+#include "bvh/bvh.h"
+#include "bvh/bvh_params.h"
+
+#include "util/util_types.h"
+#include "util/util_vector.h"
+
+#include "embree2/rtcore.h"
+
+CCL_NAMESPACE_BEGIN
+
+class BVHEmbree : public BVH
+{
+protected:
+ /* constructor */
+ friend class BVH;
+ BVHEmbree(const BVHParams& params, const vector<Object*>& objects);
+
+ virtual void pack_nodes(const BVHNode *root);
+ virtual void refit_nodes();
+};
+
+CCL_NAMESPACE_END
+
+#endif /* WITH_EMBREE */
+
+#endif /* __BVH_EMBREE_H__ */
diff --git a/intern/cycles/bvh/bvh_params.h b/intern/cycles/bvh/bvh_params.h
index 7dd699b33a4..7c362568974 100644
--- a/intern/cycles/bvh/bvh_params.h
+++ b/intern/cycles/bvh/bvh_params.h
@@ -79,6 +79,8 @@ public:
NUM_SPATIAL_BINS = 32
};
+ bool use_bvh_embree;
+
BVHParams()
{
use_spatial_split = true;
@@ -105,6 +107,8 @@ public:
num_motion_curve_steps = 0;
num_motion_triangle_steps = 0;
+
+ use_bvh_embree = false;
}
/* SAH costs */
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index 4353fd4b819..93771d35116 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -38,6 +38,12 @@
#include "util/util_progress.h"
#include "util/util_set.h"
+#ifdef WITH_EMBREE
+# include "embree2/rtcore.h"
+# include "embree2/rtcore_scene.h"
+# include "embree2/rtcore_builder.h"
+#endif
+
CCL_NAMESPACE_BEGIN
/* Triangle */
@@ -1059,6 +1065,7 @@ void Mesh::compute_bvh(Device *device,
BVHParams bparams;
bparams.use_spatial_split = params->use_bvh_spatial_split;
bparams.use_qbvh = params->use_qbvh && device->info.has_qbvh;
+ bparams.use_bvh_embree = params->use_bvh_embree;
bparams.use_unaligned_nodes = dscene->data.bvh.have_curves &&
params->use_bvh_unaligned_nodes;
bparams.num_motion_triangle_steps = params->num_bvh_time_steps;
@@ -1819,6 +1826,7 @@ void MeshManager::device_update_bvh(Device *device, DeviceScene *dscene, Scene *
bparams.top_level = true;
bparams.use_qbvh = scene->params.use_qbvh && device->info.has_qbvh;
bparams.use_spatial_split = scene->params.use_bvh_s
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list