Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorPatrick Mours <pmours@nvidia.com>2020-12-08 17:42:00 +0300
committerPatrick Mours <pmours@nvidia.com>2020-12-08 18:06:39 +0300
commit612b83bbd183c214b2d252cf19cdf581f3d9cede (patch)
treed7e703f8b550dbc3f90ea84a213393fa33aa01fd /intern
parent9962e5936dd2e58319c01beb6b5392169627cfd8 (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')
-rw-r--r--intern/cycles/blender/addon/ui.py7
-rw-r--r--intern/cycles/device/device_optix.cpp14
2 files changed, 14 insertions, 7 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 623e5cf9e37..f24265d256a 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -1822,10 +1822,6 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'CYCLES'}
- @classmethod
- def poll(cls, context):
- return CyclesButtonsPanel.poll(context) and not use_optix(context)
-
def draw(self, context):
layout = self.layout
layout.use_property_split = True
@@ -1836,6 +1832,9 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
cbk = scene.render.bake
rd = scene.render
+ if use_optix(context):
+ layout.label(text="Baking is performed using CUDA instead of OptiX", icon='INFO')
+
if rd.use_bake_multires:
layout.operator("object.bake_image", icon='RENDER_STILL')
layout.prop(rd, "use_bake_multires")
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);