SegFault when using the Pathtracer on Ospray 2.10
NadirRoGue opened this issue · comments
We have just updated to Ospray 2.10 in our software. We've noticed that, when switching to the pathtracer on an empty scene, it crashed with a segfault.
Debugging the code showed us that the problem comes from here:
By default, we initialize out program with the scivis renderer, which works fine. But if we start with the pathtracer, or switch to it when there are no lights on the scene, the lightsCDF
vector will be empty, causing ispc::Distribution1D_create
to crash:
Because the CDF array is accessed unconditionally.
It would be great to allow the scene to be empty when switching renderers, if possible.
Can be reproduced with this on Ospray 2.10
diff --git a/apps/common/ospray_testing/builders/Boxes.cpp b/apps/common/ospray_testing/builders/Boxes.cpp
index b54a2daf2..3f40e6860 100644
--- a/apps/common/ospray_testing/builders/Boxes.cpp
+++ b/apps/common/ospray_testing/builders/Boxes.cpp
@@ -20,7 +20,6 @@ struct Boxes : public detail::Builder
cpp::Group buildGroup() const override;
cpp::World buildWorld() const override;
-
private:
vec3i dimensions{4};
bool useLights{false};
@@ -102,7 +101,7 @@ cpp::World Boxes::buildWorld() const
ambient.setParam("visible", false);
ambient.commit();
std::vector<cpp::Light> lights{light, ambient};
- world.setParam("light", cpp::CopiedData(lights));
+ // world.setParam("light", cpp::CopiedData(lights));
return world;
}
diff --git a/apps/common/ospray_testing/builders/Builder.cpp b/apps/common/ospray_testing/builders/Builder.cpp
index ca930c365..b62977b74 100644
--- a/apps/common/ospray_testing/builders/Builder.cpp
+++ b/apps/common/ospray_testing/builders/Builder.cpp
@@ -44,7 +44,7 @@ cpp::World Builder::buildWorld(
light.setParam("visible", false);
light.commit();
- world.setParam("light", cpp::CopiedData(light));
+ // world.setParam("light", cpp::CopiedData(light));
return world;
}
diff --git a/apps/ospExamples/GLFWOSPRayWindow.cpp b/apps/ospExamples/GLFWOSPRayWindow.cpp
index fead0bde7..a7eef4a7b 100644
--- a/apps/ospExamples/GLFWOSPRayWindow.cpp
+++ b/apps/ospExamples/GLFWOSPRayWindow.cpp
@@ -694,13 +694,13 @@ void GLFWOSPRayWindow::buildUI()
if (ImGui::Checkbox("renderSunSky", &renderSunSky)) {
if (renderSunSky) {
sunSky.setParam("direction", sunDirection);
- world.setParam("light", cpp::CopiedData(sunSky));
+ //world.setParam("light", cpp::CopiedData(sunSky));
addObjectToCommit(sunSky.handle());
} else {
cpp::Light light("ambient");
light.setParam("visible", false);
light.commit();
- world.setParam("light", cpp::CopiedData(light));
+ //world.setParam("light", cpp::CopiedData(light));
}
addObjectToCommit(world.handle());
}
@@ -871,8 +871,7 @@ void GLFWOSPRayWindow::refreshScene(bool resetCamera)
switch (rendererType) {
case OSPRayRendererType::PATHTRACER: {
renderer = &rendererPT;
- if (renderSunSky)
- world.setParam("light", cpp::CopiedData(sunSky));
+ //if (renderSunSky) world.setParam("light", cpp::CopiedData(sunSky));
break;
}
case OSPRayRendererType::SCIVIS: