summaryrefslogtreecommitdiff
path: root/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-09-26 19:27:10 -0500
committerDave Parks <davep@lindenlab.com>2011-09-26 19:27:10 -0500
commitbd02cdc75f1c752a127d1303527be3a96479af93 (patch)
treed8503b7c296a4cd4f1aa2954c03ff250beda4254 /indra/newview/llvovolume.cpp
parentd475a96e94be90e68cf34bf6c25d8ab259aa47b5 (diff)
parent8dbfa022778f2a7fcd5d2b527045724551279412 (diff)
merge
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rwxr-xr-xindra/newview/llvovolume.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 380d63c77b..2fadc795fd 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3976,8 +3976,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
}
}
- U8 glow = (U8) (facep->getTextureEntry()->getGlow() * 255);
-
if (idx >= 0 &&
draw_vec[idx]->mVertexBuffer == facep->getVertexBuffer() &&
draw_vec[idx]->mEnd == facep->getGeomIndex()-1 &&
@@ -3986,7 +3984,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
draw_vec[idx]->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() <= (U32) gGLManager.mGLMaxVertexRange &&
draw_vec[idx]->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange &&
#endif
- draw_vec[idx]->mGlowColor.mV[3] == glow &&
draw_vec[idx]->mFullbright == fullbright &&
draw_vec[idx]->mBump == bump &&
draw_vec[idx]->mTextureMatrix == tex_mat &&
@@ -4018,7 +4015,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
draw_vec.push_back(draw_info);
draw_info->mTextureMatrix = tex_mat;
draw_info->mModelMatrix = model_mat;
- draw_info->mGlowColor.setVec(0,0,0,glow);
if (type == LLRenderPass::PASS_ALPHA)
{ //for alpha sorting
facep->setDrawInfo(draw_info);
@@ -4118,6 +4114,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
U32 cur_total = 0;
+ bool emissive = false;
+
//get all the faces into a list
for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter)
{
@@ -4330,6 +4328,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
}
+
if (cur_total > max_total || facep->getIndicesCount() <= 0 || facep->getGeomCount() <= 0)
{
facep->clearVertexBuffer();
@@ -4343,6 +4342,11 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
const LLTextureEntry* te = facep->getTextureEntry();
LLViewerTexture* tex = facep->getTexture();
+ if (te->getGlow() >= 1.f/255.f)
+ {
+ emissive = true;
+ }
+
if (facep->isState(LLFace::TEXTURE_ANIM))
{
if (!vobj->mTexAnimMode)
@@ -4459,6 +4463,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
U32 bump_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
U32 fullbright_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
+ if (emissive)
+ { //emissive faces are present, include emissive byte to preserve batching
+ simple_mask = simple_mask | LLVertexBuffer::MAP_EMISSIVE;
+ alpha_mask = alpha_mask | LLVertexBuffer::MAP_EMISSIVE;
+ bump_mask = bump_mask | LLVertexBuffer::MAP_EMISSIVE;
+ fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_EMISSIVE;
+ }
+
bool batch_textures = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1;
if (batch_textures)
@@ -4551,7 +4563,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
for (std::set<LLVertexBuffer*>::iterator iter = mapped_buffers.begin(); iter != mapped_buffers.end(); ++iter)
{
- (*iter)->setBuffer(0);
+ (*iter)->flush();
}
// don't forget alpha
@@ -4559,7 +4571,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
!group->mVertexBuffer.isNull() &&
group->mVertexBuffer->isLocked())
{
- group->mVertexBuffer->setBuffer(0);
+ group->mVertexBuffer->flush();
}
//if not all buffers are unmapped
@@ -4575,7 +4587,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
LLVertexBuffer* buff = face->getVertexBuffer();
if (face && buff && buff->isLocked())
{
- buff->setBuffer(0) ;
+ buff->flush();
}
}
}
@@ -4602,10 +4614,6 @@ struct CompareBatchBreakerModified
{
return lte->getFullbright() < rte->getFullbright();
}
- else if (lte->getGlow() != rte->getGlow())
- {
- return lte->getGlow() < rte->getGlow();
- }
else
{
return lhs->getTexture() < rhs->getTexture();
@@ -4985,7 +4993,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
++face_iter;
}
- buffer->setBuffer(0);
+ buffer->flush();
}
group->mBufferMap[mask].clear();