summaryrefslogtreecommitdiff
path: root/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-07-09 02:28:34 -0500
committerDave Parks <davep@lindenlab.com>2011-07-09 02:28:34 -0500
commitf1443579b32cf260e7ad35f35de3930f0f801bd2 (patch)
treeeba8949b8dd71832297a0836be58cf2d4c71d830 /indra/newview/llvovolume.cpp
parent36a05ebd9a2a969bab4621f522a9a82f69e523d7 (diff)
SH-2038 Potential fix for a myriad of performance problems concering VBO usage.
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r--indra/newview/llvovolume.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index e6da8eb89d..40afabdb65 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4361,6 +4361,8 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
group->mBuilt = 1.f;
+ std::set<LLVertexBuffer*> mapped_buffers;
+
for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter)
{
LLFastTimer t(FTM_VOLUME_GEOM_PARTIAL);
@@ -4375,35 +4377,31 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
for (S32 i = 0; i < drawablep->getNumFaces(); ++i)
{
LLFace* face = drawablep->getFace(i);
- if (face && face->getVertexBuffer())
+ if (face)
{
- face->getGeometryVolume(*volume, face->getTEOffset(),
- vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), face->getGeomIndex());
+ LLVertexBuffer* buff = face->getVertexBuffer();
+ if (buff)
+ {
+ face->getGeometryVolume(*volume, face->getTEOffset(),
+ vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), face->getGeomIndex());
+
+ if (buff->isLocked())
+ {
+ mapped_buffers.insert(buff);
+ }
+ }
}
}
-
+
drawablep->clearState(LLDrawable::REBUILD_ALL);
}
}
- //unmap all the buffers
- for (LLSpatialGroup::buffer_map_t::iterator i = group->mBufferMap.begin(); i != group->mBufferMap.end(); ++i)
+ for (std::set<LLVertexBuffer*>::iterator iter = mapped_buffers.begin(); iter != mapped_buffers.end(); ++iter)
{
- LLSpatialGroup::buffer_texture_map_t& map = i->second;
- for (LLSpatialGroup::buffer_texture_map_t::iterator j = map.begin(); j != map.end(); ++j)
- {
- LLSpatialGroup::buffer_list_t& list = j->second;
- for (LLSpatialGroup::buffer_list_t::iterator k = list.begin(); k != list.end(); ++k)
- {
- LLVertexBuffer* buffer = *k;
- if (buffer->isLocked())
- {
- buffer->setBuffer(0);
- }
- }
- }
+ (*iter)->setBuffer(0);
}
-
+
// don't forget alpha
if(group != NULL &&
!group->mVertexBuffer.isNull() &&