diff options
author | Graham Madarasz <graham@lindenlab.com> | 2013-05-23 16:24:34 -0700 |
---|---|---|
committer | Graham Madarasz <graham@lindenlab.com> | 2013-05-23 16:24:34 -0700 |
commit | 260afbcece7db436af411abcba28495bf99fa08b (patch) | |
tree | 27609345c4a73e0ce9b566e9046abf2f21c25d54 /indra | |
parent | 33f674a0d080c5e74ae2f50029b601b4dcecd4d9 (diff) |
NORSPEC-192 fix more incorrect batching, fix bug in reflecting normal map state in build tool, and protect against callback crashes when switching regions
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llmaterialmgr.cpp | 53 | ||||
-rwxr-xr-x | indra/newview/llpanelface.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/llspatialpartition.h | 1 | ||||
-rwxr-xr-x | indra/newview/llvovolume.cpp | 10 |
4 files changed, 39 insertions, 27 deletions
diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index edf8e83038..5c0173c7a7 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -337,34 +337,41 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL itMaterial = ret.first; } - mGetPending.erase(pending_material_t(region_id, material_id)); - - get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); - if (itCallback != mGetCallbacks.end()) - { - (*itCallback->second)(material_id, itMaterial->second); - - delete itCallback->second; - mGetCallbacks.erase(itCallback); - } + // we may have cleared our queues on leaving a region before we recv'd our + // update for this material...too late now! + // + if (isGetPending(region_id, material_id)) + { + + #if USE_TE_SPECIFIC_REGISTRATION + TEMaterialPair te_mat_pair; + te_mat_pair.materialID = material_id; -#if USE_TE_SPECIFIC_REGISTRATION - TEMaterialPair te_mat_pair; - te_mat_pair.materialID = material_id; + U32 i = 0; + while (i < LLTEContents::MAX_TES) + { + te_mat_pair.te = i++; + get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair); + if (itCallbackTE != mGetTECallbacks.end()) + { + (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te); + delete itCallbackTE->second; + mGetTECallbacks.erase(itCallbackTE); + } + } + #endif - U32 i = 0; - while (i < LLTEContents::MAX_TES) - { - te_mat_pair.te = i++; - get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair); - if (itCallbackTE != mGetTECallbacks.end()) + get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); + if (itCallback != mGetCallbacks.end()) { - (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te); - delete itCallbackTE->second; - mGetTECallbacks.erase(itCallbackTE); + (*itCallback->second)(material_id, itMaterial->second); + + delete itCallback->second; + mGetCallbacks.erase(itCallback); } } -#endif + + mGetPending.erase(pending_material_t(region_id, material_id)); return itMaterial->second; } diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 33c77ed98f..27ca13fcf1 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1683,7 +1683,7 @@ void LLPanelFace::updateUI() texture_ctrl = getChild<LLTextureCtrl>("bumpytexture control"); texture_ctrl->setImageAssetID(material->getNormalID()); - if (!material->getNormalID().isNull() && (bumpy == BUMPY_TEXTURE)) + if (!material->getNormalID().isNull()) { material->getNormalOffset(offset_x,offset_y); material->getNormalRepeat(repeat_x,repeat_y); diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 8d3e8499da..8ccc3efd66 100755 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -121,6 +121,7 @@ public: F32 mDistance; U32 mDrawMode; LLMaterialPtr mMaterial; // If this is null, the following parameters are unused. + LLMaterialID mMaterialID; U32 mShaderMask; LLPointer<LLViewerTexture> mSpecularMap; const LLMatrix4* mSpecularMapMatrix; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 91a5a082c1..5663d474bd 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4109,6 +4109,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U8 index = facep->getTextureIndex(); LLMaterial* mat = facep->getTextureEntry()->getMaterialParams().get(); + LLMaterialID mat_id = facep->getTextureEntry()->getMaterialID(); bool batchable = false; @@ -4159,12 +4160,13 @@ 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]->mMaterial == mat && + draw_vec[idx]->mMaterialID == mat_id && draw_vec[idx]->mFullbright == fullbright && - draw_vec[idx]->mBump == bump && + draw_vec[idx]->mBump == bump && + (!mat || (draw_vec[idx]->mShiny == shiny)) && // need to break batches when a material is shared, but legacy settings are different draw_vec[idx]->mTextureMatrix == tex_mat && draw_vec[idx]->mModelMatrix == model_mat && - draw_vec[idx]->mMaterial == mat && - (!mat || (draw_vec[idx]->mShiny == shiny)) && // need to break batches when a material is shared, but legacy shiny is different draw_vec[idx]->mShaderMask == shader_mask) { draw_vec[idx]->mCount += facep->getIndicesCount(); @@ -4213,6 +4215,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, if (mat) { + draw_info->mMaterialID = mat_id; + // We have a material. Update our draw info accordingly. if (!mat->getSpecularID().isNull()) |