diff options
author | callum_linden <callum@lindenlab.com> | 2017-11-30 14:44:44 -0800 |
---|---|---|
committer | callum_linden <callum@lindenlab.com> | 2017-11-30 14:44:44 -0800 |
commit | dd0d2805e2b495246525f49325c4492b7b57f157 (patch) | |
tree | 96ae78468bbe760c4934416764a4cd89cf5ae381 /indra/newview/llfloatermodelpreview.cpp | |
parent | 2e3c5ac88a434ee437bc3e68b321d5bd0bcd7cc9 (diff) | |
parent | e3a2c5e3217ae74a0277f2e6d4e1e708fe398a1c (diff) |
Automated erge with tip of viewer64
Diffstat (limited to 'indra/newview/llfloatermodelpreview.cpp')
-rw-r--r-- | indra/newview/llfloatermodelpreview.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index b3885bf36c..da84a6b8f8 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -2568,13 +2568,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()); @@ -3322,7 +3330,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; |