diff options
author | Patrick Mours <pmours@nvidia.com> | 2020-12-08 17:42:00 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2020-12-08 18:06:39 +0300 |
commit | 612b83bbd183c214b2d252cf19cdf581f3d9cede (patch) | |
tree | d7e703f8b550dbc3f90ea84a213393fa33aa01fd /intern/cycles/device | |
parent | 9962e5936dd2e58319c01beb6b5392169627cfd8 (diff) |
Cycles: Enable baking panel in OptiX and redirect those requests to CUDA for now
This enables support for baking when OptiX is active, but uses CUDA for that behind the scenes, since
the way baking is currently implemented does not work well with OptiX.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D9784
Diffstat (limited to 'intern/cycles/device')
-rw-r--r-- | intern/cycles/device/device_optix.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/intern/cycles/device/device_optix.cpp b/intern/cycles/device/device_optix.cpp index 682540a51fd..c6276c1e955 100644 --- a/intern/cycles/device/device_optix.cpp +++ b/intern/cycles/device/device_optix.cpp @@ -297,6 +297,10 @@ class OptiXDevice : public CUDADevice { BVHLayoutMask get_bvh_layout_mask() const override { + // CUDA kernels are used when doing baking, so need to build a BVH those can understand too! + if (optix_module == NULL) + return CUDADevice::get_bvh_layout_mask(); + // OptiX has its own internal acceleration structure format return BVH_LAYOUT_OPTIX; } @@ -330,10 +334,9 @@ class OptiXDevice : public CUDADevice { return false; } - // Disable baking for now, since its kernel is not well-suited for inlining and is very slow + // Baking is currently performed using CUDA, so no need to load OptiX kernels if (requested_features.use_baking) { - set_error("OptiX backend does not support baking yet"); - return false; + return true; } const CUDAContextScope scope(cuContext); @@ -700,6 +703,11 @@ class OptiXDevice : public CUDADevice { while (task.acquire_tile(this, tile, task.tile_types)) { if (tile.task == RenderTile::PATH_TRACE) launch_render(task, tile, thread_index); + else if (tile.task == RenderTile::BAKE) { + // Perform baking using CUDA, since it is not currently implemented in OptiX + device_vector<WorkTile> work_tiles(this, "work_tiles", MEM_READ_ONLY); + CUDADevice::render(task, tile, work_tiles); + } else if (tile.task == RenderTile::DENOISE) launch_denoise(task, tile); task.release_tile(tile); |