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.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index b221221f16..8128790eb6 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->getMappedIndices(), 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->getMappedIndices(), 0, buffer->getIndicesSize());
+ }
}
- face->setSize(vol_face.mNumVertices, vol_face.mNumIndices);
+ face->setSize(buffer->getNumVerts(), buffer->getNumIndices());
face->setVertexBuffer(buffer);
U16 offset = 0;
@@ -1594,6 +1613,14 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(
}
}
+ if (buffer.isNull() ||
+ buffer->getNumVerts() != vol_face.mNumVertices ||
+ buffer->getNumIndices() != vol_face.mNumIndices)
+ {
+ // Allocation failed
+ return;
+ }
+
if (sShaderLevel <= 0 && face->mLastSkinTime < avatar->getLastSkinTime())
{
//perform software vertex skinning for this face