diff options
author | Dave Parks <davep@lindenlab.com> | 2013-03-29 12:02:53 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2013-03-29 12:02:53 -0500 |
commit | d81fde49f7927c94488c1eca24c07f4e52cbf54a (patch) | |
tree | 04d9959975dce3460263ac14d769c469410f0dd3 /indra/newview | |
parent | 8f0711010347e8696f04fbfd7b5e987a23d55fbf (diff) |
NORSPEC-64 Fix for batches breaking on every single face when materials are in play.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llspatialpartition.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llspatialpartition.h | 2 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 21 |
3 files changed, 16 insertions, 10 deletions
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 5ba2a149b9..7c7b370bbb 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -4642,8 +4642,7 @@ LLDrawInfo::LLDrawInfo(U16 start, U16 end, U32 count, U32 offset, mSpecColor(1.0f, 1.0f, 1.0f, 0.5f), mEnvIntensity(0.0f), mAlphaMaskCutoff(0.5f), - mDiffuseAlphaMode(0), - mMaterialID(NULL) + mDiffuseAlphaMode(0) { mVertexBuffer->validateRange(mStart, mEnd, mCount, mOffset); diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index a71ca60d85..13196de1ef 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -120,7 +120,7 @@ public: F32 mDistance; U32 mDrawMode; - const LLMaterialID *mMaterialID; // If this is false, the following parameters are unused. + LLMaterialID mMaterialID; // If this is null, the following parameters are unused. LLPointer<LLViewerTexture> mSpecularMap; const LLMatrix4* mSpecularMapMatrix; LLPointer<LLViewerTexture> mNormalMap; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index becbbbc3a4..750d6bd2ac 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4071,7 +4071,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U8 index = facep->getTextureIndex(); - const LLMaterialID* matid = &facep->getTextureEntry()->getMaterialID(); + const LLMaterialID& matid = facep->getTextureEntry()->getMaterialID(); bool batchable = false; @@ -4141,7 +4141,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, if (facep->getTextureEntry()->getMaterialParams() != NULL) { // We have a material. Update our draw info accordingly. - draw_info->mMaterialID = &facep->getTextureEntry()->getMaterialID(); + draw_info->mMaterialID = matid; LLVector4 specColor; specColor.mV[0] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[0] * (1.f / 255.f); specColor.mV[1] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[1] * (1.f / 255.f); @@ -4702,14 +4702,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) bump_mask |= LLVertexBuffer::MAP_BINORMAL; genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, simple_faces, FALSE, TRUE); genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, fullbright_faces, FALSE, TRUE); - genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, bump_faces, FALSE, TRUE); + genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, bump_faces, FALSE, FALSE); genDrawInfo(group, alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, alpha_faces, TRUE, TRUE); } else { genDrawInfo(group, simple_mask, simple_faces); genDrawInfo(group, fullbright_mask, fullbright_faces); - genDrawInfo(group, bump_mask, bump_faces, FALSE, TRUE); + genDrawInfo(group, bump_mask, bump_faces, FALSE, FALSE); genDrawInfo(group, alpha_mask, alpha_faces, TRUE); } @@ -4864,11 +4864,14 @@ struct CompareBatchBreakerModified { return lte->getFullbright() < rte->getFullbright(); } - else + else if (lhs->getTexture() != rhs->getTexture()) { return lhs->getTexture() < rhs->getTexture(); } - + else + { + return lte->getMaterialParams() < rte->getMaterialParams(); + } } }; @@ -4952,6 +4955,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: //pull off next face LLFace* facep = *face_iter; LLViewerTexture* tex = facep->getTexture(); + LLMaterialPtr mat = facep->getTextureEntry()->getMaterialParams(); if (distance_sort) { @@ -5053,7 +5057,10 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: else { while (i != faces.end() && - (LLPipeline::sTextureBindTest || (distance_sort || (*i)->getTexture() == tex))) + (LLPipeline::sTextureBindTest || + (distance_sort || + ((*i)->getTexture() == tex && + ((*i)->getTextureEntry()->getMaterialParams() == mat))))) { facep = *i; |