From ec2aeef91c18a4706707040dd2af8d471826dbbc Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Sun, 5 Jul 2020 12:57:49 -0400
Subject: [PATCH] Experimental-ish optimization to bumpmap draw to reduce list
 realloc

---
 indra/newview/llface.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index c8b6ebc449c..832552310d1 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -1917,7 +1917,11 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 				LL_RECORD_BLOCK_TIME(FTM_FACE_TEX_DEFAULT);
 
 				std::vector<LLVector2> bump_tc;
-		
+				if (!mat && do_bump)
+				{
+					bump_tc.reserve(num_vertices);
+				}
+
 				if (mat && !mat->getNormalID().isNull())
 				{ //writing out normal and specular texture coordinates, not bump offsets
 					do_bump = false;
@@ -2006,8 +2010,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 						xform(tc, cos_ang, sin_ang, os, ot, ms, mt);
 					}
 
-						*dst++ = tc;
-					if (do_bump)
+					*dst++ = tc;
+					if (!mat && do_bump)
 					{
 						bump_tc.push_back(tc);
 					}
-- 
GitLab