summaryrefslogtreecommitdiff
path: root/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
authorAnkur Ahlawat <anchor@lindenlab.com>2018-01-04 00:54:41 -0800
committerAnkur Ahlawat <anchor@lindenlab.com>2018-01-04 00:54:41 -0800
commitd4ce47b09122d1f76601ba402c2b9ad6bb504950 (patch)
tree2f9a4aca02618d53d31ac62625645f89fb30c52f /indra/newview/llvovolume.cpp
parent93100236ae34eaa9cd3fa314e7e770339c13eba7 (diff)
parent1693ccba58eef676df1f91e50627545ac35bb819 (diff)
Merged lindenlab/viewer-release into default
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r--indra/newview/llvovolume.cpp35
1 files changed, 27 insertions, 8 deletions
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<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
@@ -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();