Skip to content

Commit

Permalink
Don't attach invalid geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
szellmann committed Nov 1, 2024
1 parent dce161c commit f4983d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion DeviceCopyableObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,9 @@ struct Array
const void *data{nullptr};
size_t len{0};
TypeInfo typeInfo;

VSNRAY_FUNC bool empty() const
{ return len==0; }
};

enum class Attribute
Expand Down Expand Up @@ -1565,7 +1568,7 @@ struct Geometry
inline bool isValid() const
{
if (type == ISOSurface) {
return as<dco::ISOSurface>(0).numValues > 0;
return !primitives.empty() && as<dco::ISOSurface>(0).numValues > 0;
}
// TODO..
return true;
Expand Down
3 changes: 3 additions & 0 deletions scene/VisionarayScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@ void VisionaraySceneImpl::attachInstance(
void VisionaraySceneImpl::attachGeometry(
dco::Geometry geom, unsigned geomID, unsigned userID)
{
if (!geom.isValid())
return;

#if defined(WITH_CUDA) || defined(WITH_HIP)
m_gpuScene->attachGeometry(geom, geomID, userID);
#else
Expand Down

0 comments on commit f4983d2

Please sign in to comment.