summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolavatar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lldrawpoolavatar.cpp')
-rw-r--r--indra/newview/lldrawpoolavatar.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index b221221f16..bb5c86f705 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -1485,15 +1485,34 @@ void LLDrawPoolAvatar::getRiggedGeometry(
{
buffer = new LLVertexBuffer(data_mask, GL_STREAM_DRAW_ARB);
}
- buffer->allocateBuffer(vol_face.mNumVertices, vol_face.mNumIndices, true);
+
+ if (!buffer->allocateBuffer(vol_face.mNumVertices, vol_face.mNumIndices, true))
+ {
+ LL_WARNS("LLDrawPoolAvatar") << "Failed to allocate Vertex Buffer to "
+ << vol_face.mNumVertices << " vertices and "
+ << vol_face.mNumIndices << " indices" << LL_ENDL;
+ // allocate dummy triangle
+ buffer->allocateBuffer(1, 3, true);
+ memset((U8*)buffer->getMappedData(), 0, buffer->getSize());
+ memset((U8*)buffer->getIndicesPointer(), 0, buffer->getIndicesSize());
+ }
}
else
{
//resize existing buffer
- buffer->resizeBuffer(vol_face.mNumVertices, vol_face.mNumIndices);
+ if(!buffer->resizeBuffer(vol_face.mNumVertices, vol_face.mNumIndices))
+ {
+ LL_WARNS("LLDrawPoolAvatar") << "Failed to resize Vertex Buffer to "
+ << vol_face.mNumVertices << " vertices and "
+ << vol_face.mNumIndices << " indices" << LL_ENDL;
+ // allocate dummy triangle
+ buffer->resizeBuffer(1, 3);
+ memset((U8*)buffer->getMappedData(), 0, buffer->getSize());
+ memset((U8*)buffer->getIndicesPointer(), 0, buffer->getIndicesSize());
+ }
}
- face->setSize(vol_face.mNumVertices, vol_face.mNumIndices);
+ face->setSize(buffer->getNumVerts(), buffer->getNumIndices());
face->setVertexBuffer(buffer);
U16 offset = 0;