for SH-4133: create a debug tool to show textures in active fetching

master
Xiaohong Bao 2013-04-22 22:11:41 -06:00
parent 04d0d5a3ab
commit c978364e1e
4 changed files with 42 additions and 1 deletions

View File

@ -245,6 +245,11 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind)
return texture->bindDefaultImage(mIndex);
}
if(texture->isActiveFetching()) //in debug
{
return texture->bindDebugImage(mIndex);
}
//in audit, replace the selected texture by the default one.
if ((mCurrTexture != gl_tex->getTexName()) || forceBind)
{

View File

@ -58,10 +58,12 @@ public:
virtual S8 getType() const = 0 ;
virtual void setKnownDrawSize(S32 width, S32 height) = 0 ;
virtual bool bindDefaultImage(const S32 stage = 0) = 0 ;
virtual bool bindDebugImage(const S32 stage = 0) = 0;
virtual void forceImmediateUpdate() = 0 ;
virtual void setActive() = 0 ;
virtual S32 getWidth(S32 discard_level = -1) const = 0 ;
virtual S32 getHeight(S32 discard_level = -1) const = 0 ;
virtual bool isActiveFetching() = 0;
private:
//note: do not make this function public.

View File

@ -698,6 +698,28 @@ void LLViewerTexture::setBoostLevel(S32 level)
}
bool LLViewerTexture::isActiveFetching()
{
return false;
}
bool LLViewerTexture::bindDebugImage(const S32 stage)
{
if (stage < 0) return false;
bool res = true;
if (LLViewerTexture::sCheckerBoardImagep.notNull() && (this != LLViewerTexture::sCheckerBoardImagep.get()))
{
res = gGL.getTexUnit(stage)->bind(LLViewerTexture::sCheckerBoardImagep);
}
if(!res)
{
return bindDefaultImage(stage);
}
return res;
}
bool LLViewerTexture::bindDefaultImage(S32 stage)
{
@ -1990,6 +2012,13 @@ bool LLViewerFetchedTexture::setDebugFetching(S32 debug_level)
return true;
}
bool LLViewerFetchedTexture::isActiveFetching()
{
static LLCachedControl<bool> monitor_enabled(gSavedSettings,"DebugShowTextureInfo");
return mFetchState > 7 && mFetchState < 10 && monitor_enabled; //in state of WAIT_HTTP_REQ or DECODE_IMAGE.
}
bool LLViewerFetchedTexture::updateFetch()
{
static LLCachedControl<bool> textures_decode_disabled(gSavedSettings,"TextureDecodeDisabled");

View File

@ -167,8 +167,10 @@ public:
virtual void dump(); // debug info to llinfos
/*virtual*/ bool bindDefaultImage(const S32 stage = 0) ;
/*virtual*/ bool bindDebugImage(const S32 stage = 0) ;
/*virtual*/ void forceImmediateUpdate() ;
/*virtual*/ bool isActiveFetching();
const LLUUID& getID() const { return mID; }
void setBoostLevel(S32 level);
@ -506,6 +508,9 @@ public:
void loadFromFastCache();
void setInFastCacheList(bool in_list) { mInFastCacheList = in_list; }
bool isInFastCacheList() { return mInFastCacheList; }
/*virtual*/bool isActiveFetching(); //is actively in fetching by the fetching pipeline.
protected:
/*virtual*/ void switchToCachedImage();
S32 getCurrentDiscardLevelForFetching() ;