summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatermodelpreview.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2017-11-29 23:40:12 +0000
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2017-11-29 23:40:12 +0000
commit5c7f27562dc1ef449f23be5ab747a19c23eec361 (patch)
tree658416eb1f85eaa96dbc9a4a9762b0029e520476 /indra/newview/llfloatermodelpreview.cpp
parent84b6bce4ee9299454aca75d8f876b6582b756ff6 (diff)
parent1693ccba58eef676df1f91e50627545ac35bb819 (diff)
merge
Diffstat (limited to 'indra/newview/llfloatermodelpreview.cpp')
-rw-r--r--indra/newview/llfloatermodelpreview.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 62b4d3265e..3989adf8d4 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -2576,13 +2576,21 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
if (sizes[i*2+1] > 0 && sizes[i*2] > 0)
{
- buff->allocateBuffer(sizes[i*2+1], sizes[i*2], true);
+ if (!buff->allocateBuffer(sizes[i * 2 + 1], sizes[i * 2], true))
+ {
+ // Todo: find a way to stop preview in this case instead of crashing
+ LL_ERRS() << "Failed buffer allocation during preview LOD generation."
+ << " Vertices: " << sizes[i * 2 + 1]
+ << " Indices: " << sizes[i * 2] << LL_ENDL;
+ }
buff->setBuffer(type_mask);
glodFillElements(mObject[base], names[i], GL_UNSIGNED_SHORT, (U8*) buff->getIndicesPointer());
stop_gloderror();
}
else
- { //this face was eliminated, create a dummy triangle (one vertex, 3 indices, all 0)
+ {
+ // This face was eliminated or we failed to allocate buffer,
+ // attempt to create a dummy triangle (one vertex, 3 indices, all 0)
buff->allocateBuffer(1, 3, true);
memset((U8*) buff->getMappedData(), 0, buff->getSize());
memset((U8*) buff->getIndicesPointer(), 0, buff->getIndicesSize());
@@ -3330,7 +3338,13 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights)
vb = new LLVertexBuffer(mask, 0);
- vb->allocateBuffer(num_vertices, num_indices, TRUE);
+ if (!vb->allocateBuffer(num_vertices, num_indices, TRUE))
+ {
+ // We are likely to crash due this failure, if this happens, find a way to gracefully stop preview
+ LL_WARNS() << "Failed to allocate Vertex Buffer for model preview "
+ << num_vertices << " vertices and "
+ << num_indices << " indices" << LL_ENDL;
+ }
LLStrider<LLVector3> vertex_strider;
LLStrider<LLVector3> normal_strider;