summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/llcommon/llapr.cpp4
-rwxr-xr-xindra/newview/llpanelface.cpp39
-rwxr-xr-xindra/newview/llpanelface.h45
-rwxr-xr-xindra/newview/lltexturecache.cpp14
-rwxr-xr-xindra/newview/llvovolume.cpp13
5 files changed, 75 insertions, 40 deletions
diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp
index d1c44c9403..a0802c6adf 100755
--- a/indra/llcommon/llapr.cpp
+++ b/indra/llcommon/llapr.cpp
@@ -226,9 +226,7 @@ void LLVolatileAPRPool::clearVolatileAPRPool()
llassert_always(mNumActiveRef > 0) ;
}
- //paranoia check if the pool is jammed.
- //will remove the check before going to release.
- llassert_always(mNumTotalRef < (FULL_VOLATILE_APR_POOL << 2)) ;
+ llassert(mNumTotalRef < (FULL_VOLATILE_APR_POOL << 2)) ;
}
BOOL LLVolatileAPRPool::isFull()
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 30ccbeb917..4fd55e1cf2 100755
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -317,8 +317,6 @@ void LLPanelFace::sendTexture()
void LLPanelFace::sendBump(U32 bumpiness)
{
LLTextureCtrl* bumpytexture_ctrl = getChild<LLTextureCtrl>("bumpytexture control");
- LLUUID current_normal_map = bumpytexture_ctrl->getImageAssetID();
-
if (bumpiness < BUMPY_TEXTURE)
{
LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL;
@@ -330,6 +328,8 @@ void LLPanelFace::sendBump(U32 bumpiness)
LLSelectMgr::getInstance()->selectionSetBumpmap( bump );
updateBumpyControls(bumpiness == BUMPY_TEXTURE, true);
+
+ LLUUID current_normal_map = bumpytexture_ctrl->getImageAssetID();
LLSelectedTEMaterial::setNormalID(this, current_normal_map);
}
@@ -747,8 +747,15 @@ void LLPanelFace::updateUI()
LLUUID norm_map_id = getCurrentNormalMap();
LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness");
if (combobox_bumpiness)
- {
- combobox_bumpiness->selectNthItem((S32)bumpy);
+ {
+ if ((bumpy == BUMPY_TEXTURE) && !norm_map_id.isNull())
+ {
+ combobox_bumpiness->selectNthItem((S32)BUMPY_TEXTURE);
+ }
+ else
+ {
+ combobox_bumpiness->selectNthItem((S32)((bumpy < BUMPY_TEXTURE) ? bumpy : 0));
+ }
}
else
{
@@ -771,7 +778,7 @@ void LLPanelFace::updateUI()
}
mIsAlpha = FALSE;
- LLGLenum image_format;
+ LLGLenum image_format = GL_RGB;
bool identical_image_format = false;
LLSelectedTE::getImageFormat(image_format, identical_image_format);
@@ -799,17 +806,25 @@ void LLPanelFace::updateUI()
}
// Diffuse Alpha Mode
- U8 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+
+ // Init to the default that is appropriate for the alpha content of the asset
+ //
+ U8 alpha_mode = mIsAlpha ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
+
bool identical_alpha_mode = false;
+
+ // See if that's been overridden by a material setting for same...
+ //
LLSelectedTEMaterial::getDiffuseAlphaMode(alpha_mode, identical_alpha_mode);
LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode");
if (combobox_alphamode)
{
//it is invalid to have any alpha mode other than blend if transparency is greater than zero ...
+ // Want masking? Want emissive? Tough! You get BLEND!
alpha_mode = (transparency > 0.f) ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : alpha_mode;
- // ... unless there is no alpha channel in the texture, in which case alpha mode MUST ebe none
+ // ... unless there is no alpha channel in the texture, in which case alpha mode MUST be none
alpha_mode = mIsAlpha ? alpha_mode : LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
combobox_alphamode->selectNthItem(alpha_mode);
@@ -1592,6 +1607,7 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh
if (comboShiny->itemExists(USE_TEXTURE))
{
comboShiny->remove(SHINY_TEXTURE);
+ comboShiny->selectFirstItem();
}
}
}
@@ -1642,9 +1658,8 @@ void LLPanelFace::updateBumpyControls(bool is_setting_texture, bool mess_with_co
{
if (comboBumpy->itemExists(USE_TEXTURE))
{
- // HACK: This depends on adding the "Use texture"
- // item at the end of a list of known length.
comboBumpy->remove(BUMPY_TEXTURE);
+ comboBumpy->selectFirstItem();
}
}
}
@@ -2164,7 +2179,8 @@ void LLPanelFace::LLSelectedTE::getFace(LLFace*& face_to_return, bool& identical
}
void LLPanelFace::LLSelectedTE::getImageFormat(LLGLenum& image_format_to_return, bool& identical_face)
-{
+{
+ LLGLenum image_format;
struct LLSelectedTEGetImageFormat : public LLSelectedTEGetFunctor<LLGLenum>
{
LLGLenum get(LLViewerObject* object, S32 te_index)
@@ -2173,7 +2189,8 @@ void LLPanelFace::LLSelectedTE::getImageFormat(LLGLenum& image_format_to_return,
return image ? image->getPrimaryFormat() : GL_RGB;
}
} get_glenum;
- identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_glenum, image_format_to_return);
+ identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_glenum, image_format);
+ image_format_to_return = image_format;
}
void LLPanelFace::LLSelectedTE::getTexId(LLUUID& id, bool& identical)
diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h
index 84aba4dc89..79e6898e49 100755
--- a/indra/newview/llpanelface.h
+++ b/indra/newview/llpanelface.h
@@ -258,7 +258,8 @@ private:
if (!is_need_material)
{
LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL;
- LLMaterialMgr::getInstance()->remove(object->getID(),face);
+ LLMaterialMgr::getInstance()->remove(object->getID(),face);
+ object->setTEMaterialID(face, LLMaterialID::null);
}
else
{
@@ -283,29 +284,31 @@ private:
ReturnType (LLMaterial::* const MaterialGetFunc)() const >
static void getTEMaterialValue(DataType& data_to_return, bool& identical,DataType default_value)
{
- struct GetTEMaterialVal : public LLSelectedTEGetFunctor<DataType>
- {
- GetTEMaterialVal(DataType default_value) : _default(default_value) {}
- virtual ~GetTEMaterialVal() {}
+ DataType data_value;
+ struct GetTEMaterialVal : public LLSelectedTEGetFunctor<DataType>
+ {
+ GetTEMaterialVal(DataType default_value) : _default(default_value) {}
+ virtual ~GetTEMaterialVal() {}
- DataType get(LLViewerObject* object, S32 face)
+ DataType get(LLViewerObject* object, S32 face)
+ {
+ DataType ret = _default;
+ LLMaterialPtr material_ptr;
+ LLTextureEntry* tep = object ? object->getTE(face) : NULL;
+ if (tep)
{
- DataType ret = _default;
- LLMaterialPtr material_ptr;
- LLTextureEntry* tep = object ? object->getTE(face) : NULL;
- if (tep)
+ material_ptr = object->getTE(face)->getMaterialParams();
+ if (!material_ptr.isNull())
{
- material_ptr = object->getTE(face)->getMaterialParams();
- if (!material_ptr.isNull())
- {
- ret = (material_ptr->*(MaterialGetFunc))();
- }
+ ret = (material_ptr->*(MaterialGetFunc))();
}
- return ret;
}
- DataType _default;
- } GetFunc(default_value);
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetFunc, data_to_return);
+ return ret;
+ }
+ DataType _default;
+ } GetFunc(default_value);
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetFunc, data_value);
+ data_to_return = data_value;
}
template<
@@ -314,6 +317,7 @@ private:
ReturnType (LLTextureEntry::* const TEGetFunc)() const >
static void getTEValue(DataType& data_to_return, bool& identical, DataType default_value)
{
+ DataType data_value;
struct GetTEVal : public LLSelectedTEGetFunctor<DataType>
{
GetTEVal(DataType default_value) : _default(default_value) {}
@@ -325,7 +329,8 @@ private:
}
DataType _default;
} GetTEValFunc(default_value);
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetTEValFunc, data_to_return );
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetTEValFunc, data_value );
+ data_to_return = data_value;
}
// Update vis and enabling of specific subsets of controls based on material params
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 305f6fca0f..36a7aeb590 100755
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -568,8 +568,11 @@ bool LLTextureCacheRemoteWorker::doWrite()
idx = mCache->setHeaderCacheEntry(mID, entry, mImageSize, mDataSize); // create the new entry.
if(idx >= 0)
{
- //write to the fast cache.
- llassert_always(mCache->writeToFastCache(idx, mRawImage, mRawDiscardLevel));
+ // (almost always) write to the fast cache.
+ if (mRawImage->getDataSize())
+ {
+ llassert_always(mCache->writeToFastCache(idx, mRawImage, mRawDiscardLevel));
+ }
}
}
else
@@ -1895,10 +1898,17 @@ LLPointer<LLImageRaw> LLTextureCache::readFromFastCache(const LLUUID& id, S32& d
bool LLTextureCache::writeToFastCache(S32 id, LLPointer<LLImageRaw> raw, S32 discardlevel)
{
//rescale image if needed
+ if (raw.isNull() || !raw->getData())
+ {
+ llerrs << "Attempted to write NULL raw image to fastcache" << llendl;
+ return false;
+ }
+
S32 w, h, c;
w = raw->getWidth();
h = raw->getHeight();
c = raw->getComponents();
+
S32 i = 0 ;
while(((w >> i) * (h >> i) * c) > TEXTURE_FAST_CACHE_ENTRY_SIZE - TEXTURE_FAST_CACHE_ENTRY_OVERHEAD)
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index f24ee435c0..bd3be5b9cf 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4105,7 +4105,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
//drawable->getVObj()->setDebugText(llformat("%d", drawable->isState(LLDrawable::ANIMATED_CHILD)));
U8 bump = (type == LLRenderPass::PASS_BUMP || type == LLRenderPass::PASS_POST_BUMP) ? facep->getTextureEntry()->getBumpmap() : 0;
-
U8 shiny = facep->getTextureEntry()->getShiny();
LLViewerTexture* tex = facep->getTexture();
@@ -4115,6 +4114,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
LLMaterial* mat = facep->getTextureEntry()->getMaterialParams().get();
LLMaterialID mat_id = facep->getTextureEntry()->getMaterialID();
+ mat = mat_id.isNull() ? NULL : mat;
+
bool batchable = false;
U32 shader_mask = 0xFFFFFFFF; //no shader
@@ -4200,6 +4201,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
draw_info->mTextureMatrix = tex_mat;
draw_info->mModelMatrix = model_mat;
+ draw_info->mBump = bump;
draw_info->mShiny = shiny;
float alpha[4] =
@@ -4544,6 +4546,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
LLMaterial* mat = te->getMaterialParams().get();
+ mat = te->getMaterialID().isNull() ? NULL : mat;
if (mat && LLPipeline::sRenderDeferred)
{
@@ -4763,7 +4766,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
if (gPipeline.canUseWindLightShadersOnObjects()
&& LLPipeline::sRenderBump)
{
- if (LLPipeline::sRenderDeferred && te->getMaterialParams().notNull())
+ if (LLPipeline::sRenderDeferred && te->getMaterialParams().notNull() && !te->getMaterialID().isNull())
{
LLMaterial* mat = te->getMaterialParams().get();
if (mat->getNormalID().notNull())
@@ -5340,6 +5343,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
LLMaterial* mat = te->getMaterialParams().get();
+ mat = te->getMaterialID().isNull() ? NULL : mat;
+
bool can_be_shiny = true;
if (mat)
{
@@ -5497,7 +5502,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
registerFace(group, facep, LLRenderPass::PASS_POST_BUMP);
}
}
- else if (te->getBumpmap() && !te->getMaterialParams())
+ else if (te->getBumpmap() && !mat)
{ //register in deferred bump pass
registerFace(group, facep, LLRenderPass::PASS_BUMP);
}
@@ -5539,7 +5544,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
}
else
{
- if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && (te->getBumpmap() && !te->getMaterialParams()))
+ if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && (te->getBumpmap() && !mat))
{ //non-shiny or fullbright deferred bump
registerFace(group, facep, LLRenderPass::PASS_BUMP);
}