summaryrefslogtreecommitdiff
path: root/indra/newview/llvotree.cpp
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2017-11-01 19:36:13 +0200
committerandreykproductengine <andreykproductengine@lindenlab.com>2017-11-01 19:36:13 +0200
commit149b2d88dd75bddf1cb3e9927c4e8fcc84e263e1 (patch)
treeb02a4d2775cec34281b637a6f4d1ae0c40faa976 /indra/newview/llvotree.cpp
parentfec6bbddc371b2d1e0aa41d39a1b3dfaa8fb2016 (diff)
MAINT-7228 Vertex buffer allocation failure handling
Diffstat (limited to 'indra/newview/llvotree.cpp')
-rw-r--r--indra/newview/llvotree.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp
index 4dcc267e96..5193d3bb0e 100644
--- a/indra/newview/llvotree.cpp
+++ b/indra/newview/llvotree.cpp
@@ -525,7 +525,14 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
}
mReferenceBuffer = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, 0);
- mReferenceBuffer->allocateBuffer(max_vertices, max_indices, TRUE);
+ if (!mReferenceBuffer->allocateBuffer(max_vertices, max_indices, TRUE))
+ {
+ LL_WARNS() << "Failed to allocate Vertex Buffer on update to "
+ << max_vertices << " vertices and "
+ << max_indices << " indices" << LL_ENDL;
+ mReferenceBuffer = NULL; //unref
+ return TRUE;
+ }
LLStrider<LLVector3> vertices;
LLStrider<LLVector3> normals;
@@ -883,7 +890,21 @@ void LLVOTree::updateMesh()
LLFace* facep = mDrawable->getFace(0);
if (!facep) return;
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, GL_STATIC_DRAW_ARB);
- buff->allocateBuffer(vert_count, index_count, TRUE);
+ if (!buff->allocateBuffer(vert_count, index_count, TRUE))
+ {
+ LL_WARNS() << "Failed to allocate Vertex Buffer on mesh update to "
+ << vert_count << " vertices and "
+ << index_count << " indices" << LL_ENDL;
+ buff->allocateBuffer(1, 3, true);
+ memset((U8*)buff->getMappedData(), 0, buff->getSize());
+ memset((U8*)buff->getIndicesPointer(), 0, buff->getIndicesSize());
+ facep->setSize(1, 3);
+ facep->setVertexBuffer(buff);
+ mReferenceBuffer->flush();
+ buff->flush();
+ return;
+ }
+
facep->setVertexBuffer(buff);
LLStrider<LLVector3> vertices;