From Marc Helbling, "I've come across scenes that contains geometries with initialized but empty vertex arrays and primitives and that would make some optimizers crash.

The submission therefore only contains a test on the size of the vertex array for the VertexCacheMissVisitor and the VertexAccessOrderVisitor visitors."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14503 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-11-20 10:45:05 +00:00
parent 1e75ca63f4
commit 2da766ff1b

View File

@@ -975,7 +975,7 @@ struct CacheRecorder : public TriangleIndexFunctor<CacheRecordOperator>
void VertexCacheMissVisitor::doGeometry(Geometry& geom)
{
Array* vertArray = geom.getVertexArray();
if (!vertArray)
if (!vertArray || vertArray->getNumElements()==0)
return;
Geometry::PrimitiveSetList& primSets = geom.getPrimitiveSetList();
CacheRecorder recorder(_cacheSize);
@@ -1117,7 +1117,7 @@ inline void reorderDrawElements(DE& drawElements,
void VertexAccessOrderVisitor::optimizeOrder(Geometry& geom)
{
Array* vertArray = geom.getVertexArray();
if (!vertArray)
if (!vertArray || vertArray->getNumElements()==0)
return;
Geometry::PrimitiveSetList& primSets = geom.getPrimitiveSetList();
VertexReorder vr(vertArray->getNumElements());