Change texture default to non-auto-alphamaskable, non-pickable. Only 'fetchable' textures may qualify for either.

This commit is contained in:
Shyotl
2014-06-22 03:53:08 -05:00
parent 5cb5d284c3
commit 96df7b82de
4 changed files with 10 additions and 17 deletions

View File

@@ -468,6 +468,8 @@ LLImageGL::~LLImageGL()
sCount--;
}
const S8 INVALID_OFFSET = -99 ;
void LLImageGL::init(BOOL usemipmaps)
{
// keep these members in the same order as declared in llimagehl.h
@@ -484,14 +486,12 @@ void LLImageGL::init(BOOL usemipmaps)
mHasExplicitFormat = FALSE;
mAutoGenMips = FALSE;
mCanMask = TRUE;
mIsMask = FALSE;
mMaskRMSE = 1.f ;
mNeedsAlphaAndPickMask = TRUE ;
mNeedsAlphaAndPickMask = FALSE ;
mAlphaStride = 0 ;
mAlphaOffset = 0 ;
mAlphaOffset = INVALID_OFFSET ;
mGLTextureCreated = FALSE ;
mTexName = 0;
@@ -1709,7 +1709,6 @@ void LLImageGL::setTarget(const LLGLenum target, const LLTexUnit::eTextureType b
}
//Used by media in V2
const S8 INVALID_OFFSET = -99 ;
void LLImageGL::setNeedsAlphaAndPickMask(BOOL need_mask)
{
if(mNeedsAlphaAndPickMask != need_mask)
@@ -1723,7 +1722,6 @@ void LLImageGL::setNeedsAlphaAndPickMask(BOOL need_mask)
else //do not need alpha mask
{
mAlphaOffset = INVALID_OFFSET ;
mCanMask = FALSE;
}
}
}
@@ -1746,8 +1744,7 @@ void LLImageGL::calcAlphaChannelOffsetAndStride()
mAlphaStride = 2;
break;
case GL_RGB:
mNeedsAlphaAndPickMask = FALSE ;
mCanMask = FALSE;
setNeedsAlphaAndPickMask(FALSE);
return ; //no alpha channel.
case GL_RGBA:
mAlphaStride = 4;
@@ -1793,15 +1790,14 @@ void LLImageGL::calcAlphaChannelOffsetAndStride()
{
llwarns << "Cannot analyze alpha for image with format type " << std::hex << mFormatType << std::dec << llendl;
mNeedsAlphaAndPickMask = FALSE ;
mCanMask = FALSE;
setNeedsAlphaAndPickMask(FALSE);
}
}
//std::map<LLGLuint, std::list<std::pair<std::string,std::string> > > sTextureMaskMap;
void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h)
{
if(!mNeedsAlphaAndPickMask || !mCanMask)
if(!mNeedsAlphaAndPickMask)
{
return ;
}

View File

@@ -135,7 +135,7 @@ public:
BOOL getHasGLTexture() const { return mTexName != 0; }
LLGLuint getTexName() const { return mTexName; }
BOOL getIsAlphaMask(const F32 max_rmse) const { return mCanMask && (max_rmse < 0.f ? (bool)mIsMask : (mMaskRMSE <= max_rmse)); }
BOOL getIsAlphaMask(const F32 max_rmse) const { return mNeedsAlphaAndPickMask && (max_rmse < 0.f ? (bool)mIsMask : (mMaskRMSE <= max_rmse)); }
BOOL getIsResident(BOOL test_now = FALSE); // not const
@@ -185,7 +185,6 @@ private:
S8 mHasExplicitFormat; // If false (default), GL format is f(mComponents)
S8 mAutoGenMips;
BOOL mCanMask;
BOOL mIsMask;
F32 mMaskRMSE;
BOOL mNeedsAlphaAndPickMask;

View File

@@ -914,6 +914,7 @@ LLViewerFetchedTexture::LLViewerFetchedTexture(const LLUUID& id, const LLHost& h
{
init(TRUE) ;
generateGLTexture() ;
mGLTexturep->setNeedsAlphaAndPickMask(TRUE) ;
}
LLViewerFetchedTexture::LLViewerFetchedTexture(const LLImageRaw* raw, BOOL usemipmaps)
@@ -928,6 +929,7 @@ LLViewerFetchedTexture::LLViewerFetchedTexture(const std::string& url, const LLU
{
init(TRUE) ;
generateGLTexture() ;
mGLTexturep->setNeedsAlphaAndPickMask(TRUE) ;
}
void LLViewerFetchedTexture::init(bool firstinit)
@@ -3172,8 +3174,6 @@ LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps, LL
mGLTexturep->setAllowCompression(false);
mGLTexturep->setNeedsAlphaAndPickMask(FALSE) ;
mIsPlaying = FALSE ;
setMediaImpl() ;
@@ -3204,7 +3204,6 @@ void LLViewerMediaTexture::reinit(BOOL usemipmaps /* = TRUE */)
mUseMipMaps = usemipmaps ;
getLastReferencedTimer()->reset() ;
mGLTexturep->setUseMipMaps(mUseMipMaps) ;
mGLTexturep->setNeedsAlphaAndPickMask(FALSE) ;
}
void LLViewerMediaTexture::setUseMipMaps(BOOL mipmap)

View File

@@ -298,7 +298,6 @@ void LLSkyTex::create(const F32 brightness)
void LLSkyTex::createGLImage(S32 which)
{
mTexture[which]->setNeedsAlphaAndPickMask(false); //Needed, else analyzeAlpha is called every frame for each texture.
mTexture[which]->createGLTexture(0, mImageRaw[which], 0, TRUE, LLGLTexture::LOCAL);
mTexture[which]->setAddressMode(LLTexUnit::TAM_CLAMP);
}