From 149b2d88dd75bddf1cb3e9927c4e8fcc84e263e1 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 1 Nov 2017 19:36:13 +0200 Subject: MAINT-7228 Vertex buffer allocation failure handling --- indra/newview/llvovolume.cpp | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 90ba814a15..f77b48ff80 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -5638,18 +5638,25 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac } //create vertex buffer - LLVertexBuffer* buffer = NULL; + LLPointer buffer; { LL_RECORD_BLOCK_TIME(FTM_GEN_DRAW_INFO_ALLOCATE); buffer = createVertexBuffer(mask, buffer_usage); - buffer->allocateBuffer(geom_count, index_count, TRUE); + if(!buffer->allocateBuffer(geom_count, index_count, TRUE)) + { + LL_WARNS() << "Failed to allocate group Vertex Buffer to " + << geom_count << " vertices and " + << index_count << " indices" << LL_ENDL; + buffer = NULL; + } } - group->mGeometryBytes += buffer->getSize() + buffer->getIndicesSize(); - - - buffer_map[mask][*face_iter].push_back(buffer); + if (buffer) + { + group->mGeometryBytes += buffer->getSize() + buffer->getIndicesSize(); + buffer_map[mask][*face_iter].push_back(buffer); + } //add face geometry @@ -5657,8 +5664,17 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac U16 index_offset = 0; while (face_iter < i) - { //update face indices for new buffer + { + //update face indices for new buffer facep = *face_iter; + if (buffer.isNull()) + { + // Bulk allocation failed + facep->setVertexBuffer(buffer); + facep->setSize(0, 0); // mark as no geometry + ++face_iter; + continue; + } facep->setIndicesIndex(indices_index); facep->setGeomIndex(index_offset); facep->setVertexBuffer(buffer); @@ -5983,7 +5999,10 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac ++face_iter; } - buffer->flush(); + if (buffer) + { + buffer->flush(); + } } group->mBufferMap[mask].clear(); -- cgit v1.2.3