Backed out changeset 5fd12c1b13ae - LL backed this out too

master
Ansariel 2017-12-20 21:57:28 +01:00
parent 9317ff6bdf
commit ddcbb42c87
10 changed files with 42 additions and 270 deletions

View File

@ -106,16 +106,10 @@ LLMaterial::LLMaterial()
, mEnvironmentIntensity(LLMaterial::DEFAULT_ENV_INTENSITY)
, mDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
, mAlphaMaskCutoff(0)
, mIsDiffuseAlphaInvalid(false)
, mIsNormalInvalid(false)
, mIsSpecularInvalid(false)
{
}
LLMaterial::LLMaterial(const LLSD& material_data)
: mIsDiffuseAlphaInvalid(false)
, mIsNormalInvalid(false)
, mIsSpecularInvalid(false)
{
fromLLSD(material_data);
}
@ -205,17 +199,13 @@ U32 LLMaterial::getShaderMask(U32 alpha_mode)
{
ret = getDiffuseAlphaMode();
}
if (mIsDiffuseAlphaInvalid && ret != DIFFUSE_ALPHA_MODE_DEFAULT)
{
ret = alpha_mode != DIFFUSE_ALPHA_MODE_NONE;
}
llassert(ret < SHADER_COUNT);
//next bit is whether or not specular map is present
const U32 SPEC_BIT = 0x4;
if (getSpecularID().notNull() && !mIsSpecularInvalid)
if (getSpecularID().notNull())
{
ret |= SPEC_BIT;
}
@ -224,7 +214,7 @@ U32 LLMaterial::getShaderMask(U32 alpha_mode)
//next bit is whether or not normal map is present
const U32 NORM_BIT = 0x8;
if (getNormalID().notNull() && !mIsNormalInvalid)
if (getNormalID().notNull())
{
ret |= NORM_BIT;
}

View File

@ -120,13 +120,6 @@ public:
void setAlphaMaskCutoff(U8 cutoff) { mAlphaMaskCutoff = cutoff; }
bool isNull() const;
bool isDiffuseAlphaInvalid() const { return mIsDiffuseAlphaInvalid; }
void setDiffuseAlphaInvalid(bool is_invalid) { mIsDiffuseAlphaInvalid = is_invalid; }
bool isNormalInvalid() const { return mIsNormalInvalid; }
void setNormalInvalid(bool is_invalid) { mIsNormalInvalid = is_invalid; }
bool isSpecularInvalid() const { return mIsSpecularInvalid; }
void setSpecularInvalid(bool is_invalid) { mIsSpecularInvalid = is_invalid; }
static const LLMaterial null;
bool operator == (const LLMaterial& rhs) const;
@ -154,10 +147,6 @@ protected:
U8 mEnvironmentIntensity;
U8 mDiffuseAlphaMode;
U8 mAlphaMaskCutoff;
bool mIsDiffuseAlphaInvalid;
bool mIsNormalInvalid;
bool mIsSpecularInvalid;
};
typedef LLPointer<LLMaterial> LLMaterialPtr;

View File

@ -1981,7 +1981,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
F32 env = mat->getEnvironmentIntensity()/255.f;
if (mat->getSpecularID().isNull() || mat->isSpecularInvalid())
if (mat->getSpecularID().isNull())
{
env = te->getShiny()*0.25f;
col.set(env,env,env,0);
@ -1994,7 +1994,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
sVertexProgram->uniform4f(LLShaderMgr::SPECULAR_COLOR, col.mV[0], col.mV[1], col.mV[2], spec);
sVertexProgram->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, env);
if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK && !mat->isDiffuseAlphaInvalid())
if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
{
sVertexProgram->setMinimumAlpha(mat->getAlphaMaskCutoff()/255.f);
}

View File

@ -360,34 +360,6 @@ void LLFace::dirtyTexture()
gPipeline.markTextured(drawablep);
}
void LLFace::notifyAboutCreatingTexture(LLViewerTexture *texture)
{
LLDrawable* drawablep = getDrawable();
if(mVObjp.notNull() && mVObjp->getVolume())
{
LLVOVolume *vobj = drawablep->getVOVolume();
if(vobj && vobj->notifyAboutCreatingTexture(texture))
{
gPipeline.markTextured(drawablep);
gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_VOLUME);
}
}
}
void LLFace::notifyAboutMissingAsset(LLViewerTexture *texture)
{
LLDrawable* drawablep = getDrawable();
if(mVObjp.notNull() && mVObjp->getVolume())
{
LLVOVolume *vobj = drawablep->getVOVolume();
if(vobj && vobj->notifyAboutMissingAsset(texture))
{
gPipeline.markTextured(drawablep);
gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_VOLUME);
}
}
}
void LLFace::switchTexture(U32 ch, LLViewerTexture* new_texture)
{
llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
@ -1132,7 +1104,7 @@ bool LLFace::canRenderAsMask()
}
LLMaterial* mat = te->getMaterialParams();
if (mat && !mat->isDiffuseAlphaInvalid() && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
{
return false;
}
@ -1392,14 +1364,14 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
if (LLPipeline::sRenderDeferred)
{ //store shiny in alpha if we don't have a specular map
if (!mat || mat->getSpecularID().isNull() || mat->isSpecularInvalid())
if (!mat || mat->getSpecularID().isNull())
{
shiny_in_alpha = true;
}
}
else
{
if (!mat || mat->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_MASK || mat->isDiffuseAlphaInvalid())
if (!mat || mat->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
{
shiny_in_alpha = true;
}
@ -1899,7 +1871,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
std::vector<LLVector2> bump_tc;
if (mat && !(mat->getNormalID().isNull() || mat->isNormalInvalid()))
if (mat && !mat->getNormalID().isNull())
{ //writing out normal and specular texture coordinates, not bump offsets
do_bump = false;
}

View File

@ -236,13 +236,10 @@ public:
static U32 getRiggedDataMask(U32 type);
void notifyAboutCreatingTexture(LLViewerTexture *texture);
void notifyAboutMissingAsset(LLViewerTexture *texture);
public: //aligned members
LLVector4a mExtents[2];
private:
private:
F32 adjustPartialOverlapPixelArea(F32 cos_angle_to_view_dir, F32 radius );
BOOL calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) ;
public:

View File

@ -725,36 +725,12 @@ S8 LLViewerTexture::getType() const
void LLViewerTexture::cleanup()
{
notifyAboutMissingAsset();
mFaceList[LLRender::DIFFUSE_MAP].clear();
mFaceList[LLRender::NORMAL_MAP].clear();
mFaceList[LLRender::SPECULAR_MAP].clear();
mVolumeList.clear();
}
void LLViewerTexture::notifyAboutCreatingTexture()
{
for(U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
{
for(U32 f = 0; f < mNumFaces[ch]; f++)
{
mFaceList[ch][f]->notifyAboutCreatingTexture(this);
}
}
}
void LLViewerTexture::notifyAboutMissingAsset()
{
for(U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
{
for(U32 f = 0; f < mNumFaces[ch]; f++)
{
mFaceList[ch][f]->notifyAboutMissingAsset(this);
}
}
}
// virtual
void LLViewerTexture::dump()
{
@ -1608,8 +1584,6 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/)
res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, TRUE, mBoostLevel);
notifyAboutCreatingTexture();
setActive();
if (!needsToSaveRawImage())
@ -2369,8 +2343,6 @@ void LLViewerFetchedTexture::setIsMissingAsset(BOOL is_missing)
}
if (is_missing)
{
notifyAboutMissingAsset();
if (mUrl.empty())
{
LL_WARNS() << mID << ": Marking image as missing" << LL_ENDL;

View File

@ -180,10 +180,6 @@ protected:
void init(bool firstinit) ;
void reorganizeFaceList() ;
void reorganizeVolumeList() ;
void notifyAboutMissingAsset();
void notifyAboutCreatingTexture();
private:
friend class LLBumpImageList;
friend class LLUIImageList;
@ -351,7 +347,6 @@ public:
void addToCreateTexture();
// ONLY call from LLViewerTextureList
BOOL createTexture(S32 usename = 0);
void destroyTexture() ;

View File

@ -2238,148 +2238,28 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID)
return res;
}
bool LLVOVolume::notifyAboutCreatingTexture(LLViewerTexture *texture)
{
// Texture was created, process it and remove from wait list
std::pair<mmap_UUID_MAP_t::iterator, mmap_UUID_MAP_t::iterator> range = mWaitingTextureInfo.equal_range(texture->getID());
if(range.first == range.second) return false;
bool needs_update = false;
for(mmap_UUID_MAP_t::iterator range_it = range.first; range_it != range.second; ++range_it)
{
LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te);
if (cur_material.isNull())
{
continue;
}
if (LLRender::DIFFUSE_MAP == range_it->second.map
&& GL_RGBA != texture->getPrimaryFormat()
&& cur_material->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_NONE
&& cur_material->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_DEFAULT)
{
// We have non 32 bit texture with alpha, it is invalid
cur_material->setDiffuseAlphaInvalid(true);
needs_update = true;
}
}
//clear wait-list
mWaitingTextureInfo.erase(range.first, range.second);
return needs_update;
}
bool LLVOVolume::notifyAboutMissingAsset(LLViewerTexture *texture)
{
// Texture was marked as missing, process it and remove from wait list
std::pair<mmap_UUID_MAP_t::iterator, mmap_UUID_MAP_t::iterator> range = mWaitingTextureInfo.equal_range(texture->getID());
if(range.first == range.second) return false;
for(mmap_UUID_MAP_t::iterator range_it = range.first; range_it != range.second; ++range_it)
{
LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te);
if (cur_material.isNull())
{
continue;
}
switch (range_it->second.map)
{
case LLRender::DIFFUSE_MAP:
{
cur_material->setDiffuseAlphaInvalid(true);
break;
}
case LLRender::NORMAL_MAP:
{
cur_material->setNormalInvalid(true);
break;
}
case LLRender::SPECULAR_MAP:
{
cur_material->setSpecularInvalid(true);
break;
}
default:
break;
}
}
//clear wait-list
mWaitingTextureInfo.erase(range.first, range.second);
return true;
}
S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams)
{
LLMaterialPtr pMaterial = const_cast<LLMaterialPtr&>(pMaterialParams);
if(pMaterialParams)
{ //check all of them according to material settings
{
LLViewerTexture* image = getTEImage(te);
LLGLenum image_format = image ? image->getPrimaryFormat() : GL_RGB;
LLMaterialPtr current_material = getTEMaterialParams(te);
LLViewerTexture *img_diffuse = getTEImage(te);
LLViewerTexture *img_normal = getTENormalMap(te);
LLViewerTexture *img_specular = getTESpecularMap(te);
U8 new_diffuse_alpha_mode = pMaterialParams->getDiffuseAlphaMode();
llassert(NULL != img_diffuse);
//diffuse
if(NULL != img_diffuse)
if(new_diffuse_alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
{
if(0 == img_diffuse->getPrimaryFormat() && !img_diffuse->isMissingAsset())
{
// Texture information is missing, wait for it
mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(img_diffuse->getID(), material_info(LLRender::DIFFUSE_MAP, te)));
}
else
{
if(img_diffuse->isMissingAsset())
{
pMaterial->setDiffuseAlphaInvalid(true);
}
else if (GL_RGBA != img_diffuse->getPrimaryFormat()
&& pMaterialParams->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_NONE
&& pMaterialParams->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_DEFAULT)
{
pMaterial->setDiffuseAlphaInvalid(true);
}
}
new_diffuse_alpha_mode = (GL_RGB == image_format || 0 == image_format ? LLMaterial::DIFFUSE_ALPHA_MODE_NONE : new_diffuse_alpha_mode);
}
//normal
if(LLUUID::null != pMaterialParams->getNormalID())
{
if(img_normal && img_normal->isMissingAsset() && img_normal->getID() == pMaterialParams->getNormalID())
{
pMaterial->setNormalInvalid(true);
}
else if(NULL == img_normal || 0 == img_normal->getPrimaryFormat())
{
// Texture information is missing, wait for it
mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(pMaterialParams->getNormalID(), material_info(LLRender::NORMAL_MAP,te)));
}
}
//specular
if(LLUUID::null != pMaterialParams->getSpecularID())
{
if(img_specular && img_specular->isMissingAsset() && img_specular->getID() == pMaterialParams->getSpecularID())
{
pMaterial->setSpecularInvalid(true);
}
else if(NULL == img_specular || 0 == img_specular->getPrimaryFormat())
{
// Texture information is missing, wait for it
mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(pMaterialParams->getSpecularID(), material_info(LLRender::SPECULAR_MAP, te)));
}
if(pMaterialParams->getDiffuseAlphaMode() != new_diffuse_alpha_mode) {
//create new material
pMaterial = new LLMaterial(pMaterialParams->asLLSD());
pMaterial->setDiffuseAlphaMode(new_diffuse_alpha_mode);
LLMaterialMgr::getInstance()->put(getID(),te,*pMaterial);
}
}
@ -4762,7 +4642,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
}
draw_info->mAlphaMaskCutoff = mat->getAlphaMaskCutoff() * (1.f / 255.f);
draw_info->mDiffuseAlphaMode = mat->isDiffuseAlphaInvalid() ? LLMaterial::DIFFUSE_ALPHA_MODE_NONE : mat->getDiffuseAlphaMode();
draw_info->mDiffuseAlphaMode = mat->getDiffuseAlphaMode();
draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset());
}
@ -5064,14 +4944,11 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
LLMaterial* mat = te->getMaterialParams().get();
U8 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
if (mat && !mat->isDiffuseAlphaInvalid())
{
alpha_mode = mat->getDiffuseAlphaMode();
}
if (mat && LLPipeline::sRenderDeferred)
{
U8 alpha_mode = mat->getDiffuseAlphaMode();
bool is_alpha = type == LLDrawPool::POOL_ALPHA &&
(alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND ||
te->getColor().mV[3] < 0.999f);
@ -5091,10 +4968,11 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
bool fullbright = te->getFullbright();
bool is_alpha = type == LLDrawPool::POOL_ALPHA;
bool can_be_shiny = alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE ||
alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE;
U8 mode = mat->getDiffuseAlphaMode();
bool can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE ||
mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE;
if (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK && te->getColor().mV[3] >= 0.999f)
if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK && te->getColor().mV[3] >= 0.999f)
{
pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT : LLDrawPoolAvatar::RIGGED_SIMPLE);
}
@ -5303,9 +5181,9 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
// </FS:ND>
{
LLMaterial* mat = te->getMaterialParams().get();
if (mat->getNormalID().notNull() && !mat->isNormalInvalid())
if (mat->getNormalID().notNull())
{
if (mat->getSpecularID().notNull() && !mat->isSpecularInvalid())
if (mat->getSpecularID().notNull())
{ //has normal and specular maps (needs texcoord1, texcoord2, and tangent)
if (normspec_count < MAX_FACE_COUNT)
{
@ -5320,7 +5198,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
}
}
else if (mat->getSpecularID().notNull() && !mat->isSpecularInvalid())
else if (mat->getSpecularID().notNull())
{ //has specular map but no normal map, needs texcoord2
if (spec_count < MAX_FACE_COUNT)
{
@ -5990,14 +5868,13 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac
BOOL is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) ? TRUE : FALSE;
LLMaterial* mat = te->getMaterialParams().get();
U8 diffuse_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
bool can_be_shiny = true;
bool can_be_shiny = true;
if (mat)
{
diffuse_mode = mat->isDiffuseAlphaInvalid() ? LLMaterial::DIFFUSE_ALPHA_MODE_NONE : mat->getDiffuseAlphaMode();
can_be_shiny = diffuse_mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE ||
diffuse_mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE;
U8 mode = mat->getDiffuseAlphaMode();
can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE ||
mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE;
}
bool use_legacy_bump = te->getBumpmap() && (te->getBumpmap() < 18) && (!mat || mat->getNormalID().isNull());
@ -6013,7 +5890,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac
//
if (te->getFullbright())
{
if (diffuse_mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
{
if (opaque)
{
@ -6092,7 +5969,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac
}
else if (mat)
{
U8 mode = diffuse_mode;
U8 mode = mat->getDiffuseAlphaMode();
if (te->getColor().mV[3] < 0.999f)
{
mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND;
@ -6188,7 +6065,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac
}
else if (fullbright || bake_sunlight)
{ //fullbright
if (mat && diffuse_mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
{
registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK);
}
@ -6210,7 +6087,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac
else
{ //all around simple
llassert(mask & LLVertexBuffer::MAP_NORMAL);
if (mat && diffuse_mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK)
{ //material alpha mask can be respected in non-deferred
registerFace(group, facep, LLRenderPass::PASS_ALPHA_MASK);
}

View File

@ -387,7 +387,7 @@ public:
static F32 sLODSlopDistanceFactor;// Changing this to zero, effectively disables the LOD transition slop
static F32 sLODFactor; // LOD scale factor
static F32 sDistanceFactor; // LOD distance factor
static LLPointer<LLObjectMediaDataClient> sObjectMediaClient;
static LLPointer<LLObjectMediaNavigateClient> sObjectMediaNavigateClient;
@ -395,26 +395,6 @@ protected:
static S32 sNumLODChanges;
friend class LLVolumeImplFlexible;
public:
bool notifyAboutCreatingTexture(LLViewerTexture *texture);
bool notifyAboutMissingAsset(LLViewerTexture *texture);
private:
struct material_info
{
LLRender::eTexIndex map;
U8 te;
material_info(LLRender::eTexIndex map_, U8 te_)
: map(map_)
, te(te_)
{}
};
typedef std::multimap<LLUUID, material_info> mmap_UUID_MAP_t;
mmap_UUID_MAP_t mWaitingTextureInfo;
};
#endif // LL_LLVOVOLUME_H

View File

@ -1781,7 +1781,7 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima
alpha = alpha || (imagep->getComponents() == 4 && imagep->getType() != LLViewerTexture::MEDIA_TEXTURE) || (imagep->getComponents() == 2);
}
if (alpha && mat && !mat->isDiffuseAlphaInvalid())
if (alpha && mat)
{
switch (mat->getDiffuseAlphaMode())
{
@ -1802,7 +1802,7 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima
{
return LLDrawPool::POOL_ALPHA;
}
else if ((te->getBumpmap() || te->getShiny()) && (!mat || mat->getNormalID().isNull() || mat->isNormalInvalid()))
else if ((te->getBumpmap() || te->getShiny()) && (!mat || mat->getNormalID().isNull()))
{
return LLDrawPool::POOL_BUMP;
}