diff options
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r-- | indra/newview/llvovolume.cpp | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index b12b503e78..fbbf0634ff 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -5955,18 +5955,25 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac } //create vertex buffer - LLVertexBuffer* buffer = NULL; + LLPointer<LLVertexBuffer> 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 @@ -5974,8 +5981,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); @@ -6300,7 +6316,10 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac ++face_iter; } - buffer->flush(); + if (buffer) + { + buffer->flush(); + } } group->mBufferMap[mask].clear(); |