diff options
author | Patrick Mours <pmours@nvidia.com> | 2020-12-10 16:18:25 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2020-12-11 15:24:29 +0300 |
commit | bfb6fce6594e9cf133bd18aee311c1e5e32dc799 (patch) | |
tree | 7c813e17ea87e9aae64221b3ac7a8d42ab894c85 /intern/cycles/device/device.cpp | |
parent | d72ec16e70721408c875040325c984941687b4a2 (diff) |
Cycles: Add CPU+GPU rendering support with OptiX
Adds support for building multiple BVH types in order to support using both CPU and OptiX
devices for rendering simultaneously. Primitive packing for Embree and OptiX is now
standalone, so it only needs to be run once and can be shared between the two. Additionally,
BVH building was made a device call, so that each device backend can decide how to
perform the building. The multi-device for instance creates a special multi-BVH that holds
references to several sub-BVHs, one for each sub-device.
Reviewed By: brecht, kevindietrich
Differential Revision: https://developer.blender.org/D9718
Diffstat (limited to 'intern/cycles/device/device.cpp')
-rw-r--r-- | intern/cycles/device/device.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index eb8fb8040e3..1efd628b79b 100644 --- a/intern/cycles/device/device.cpp +++ b/intern/cycles/device/device.cpp @@ -17,6 +17,8 @@ #include <stdlib.h> #include <string.h> +#include "bvh/bvh2.h" + #include "device/device.h" #include "device/device_intern.h" @@ -364,6 +366,19 @@ void Device::draw_pixels(device_memory &rgba, } } +void Device::build_bvh(BVH *bvh, Progress &progress, bool refit) +{ + assert(bvh->params.bvh_layout == BVH_LAYOUT_BVH2); + + BVH2 *const bvh2 = static_cast<BVH2 *>(bvh); + if (refit) { + bvh2->refit(progress); + } + else { + bvh2->build(progress, &stats); + } +} + Device *Device::create(DeviceInfo &info, Stats &stats, Profiler &profiler, bool background) { #ifdef WITH_MULTI |