Merge branch 'V2Media' of git://github.com/Shyotl/SingularityViewer into future

This commit is contained in:
Siana Gearz
2011-08-07 20:35:34 +02:00
10 changed files with 682 additions and 202 deletions

View File

@@ -66,7 +66,9 @@
//#include "lltextureatlas.h"
//#include "lltextureatlasmanager.h"
#include "lltextureentry.h"
//#include "llmediaentry.h"
#if NEW_MEDIA_TEXTURE
#include "llmediaentry.h"
#endif //NEW_MEDIA_TEXTURE
#include "llvovolume.h"
#include "llviewermedia.h"
///////////////////////////////////////////////////////////////////////////////
@@ -79,9 +81,11 @@ LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sDefaultImagep = NULL;
LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sSmokeImagep = NULL;
#if NEW_MEDIA_TEXTURE
LLViewerMediaTexture::media_map_t LLViewerMediaTexture::sMediaMap ;
#endif //NEW_MEDIA_TEXTURE
#if 0
LLTexturePipelineTester* LLViewerTextureManager::sTesterp = NULL ;
#endif
//LLTexturePipelineTester* LLViewerTextureManager::sTesterp = NULL ;
//const std::string sTesterName("TextureTester");
const std::string sTesterName("TextureTester");
S32 LLViewerTexture::sImageCount = 0;
S32 LLViewerTexture::sRawCount = 0;
@@ -171,7 +175,7 @@ LLViewerMediaTexture* LLViewerTextureManager::createMediaTexture(const LLUUID &m
{
return new LLViewerMediaTexture(media_id, usemipmaps, gl_image) ;
}
#endif
#endif //NEW_MEDIA_TEXTURE
LLViewerTexture* LLViewerTextureManager::findTexture(const LLUUID& id)
{
@@ -185,7 +189,7 @@ LLViewerTexture* LLViewerTextureManager::findTexture(const LLUUID& id)
{
tex = LLViewerTextureManager::findMediaTexture(id) ;
}
#endif
#endif //NEW_MEDIA_TEXTURE
return tex ;
}
@@ -207,7 +211,7 @@ LLViewerMediaTexture* LLViewerTextureManager::getMediaTexture(const LLUUID& id,
return tex ;
}
#endif
#endif //NEW_MEDIA_TEXTURE
LLViewerFetchedTexture* LLViewerTextureManager::staticCastToFetchedTexture(LLTexture* tex, BOOL report_error)
{
@@ -358,7 +362,8 @@ void LLViewerTextureManager::init()
LLViewerTexture::initClass() ;
/*if (LLMetricPerformanceTesterBasic::isMetricLogRequested(sTesterName) && !LLMetricPerformanceTesterBasic::getTester(sTesterName))
#if 0
if (LLMetricPerformanceTesterBasic::isMetricLogRequested(sTesterName) && !LLMetricPerformanceTesterBasic::getTester(sTesterName))
{
sTesterp = new LLTexturePipelineTester() ;
if (!sTesterp->isValid())
@@ -366,7 +371,8 @@ void LLViewerTextureManager::init()
delete sTesterp;
sTesterp = NULL;
}
}*/
}
#endif
}
void LLViewerTextureManager::cleanup()
@@ -382,7 +388,7 @@ void LLViewerTextureManager::cleanup()
#if NEW_MEDIA_TEXTURE
LLViewerMediaTexture::cleanUpClass() ;
#endif
#endif //NEW_MEDIA_TEXTURE
}
//----------------------------------------------------------------------------------------------
@@ -432,14 +438,16 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity
{
sCurrentTime = gFrameTimeSeconds ;
/*LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
#if 0
LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
if (tester)
{
tester->update() ;
}*/
}
#endif
#if NEW_MEDIA_TEXTURE
LLViewerMediaTexture::updateClass() ;
#endif
#endif //NEW_MEDIA_TEXTURE
sBoundTextureMemoryInBytes = LLImageGL::sBoundTextureMemoryInBytes;//in bytes
sTotalTextureMemoryInBytes = LLImageGL::sGlobalTextureMemoryInBytes;//in bytes
@@ -560,7 +568,9 @@ void LLViewerTexture::init(bool firstinit)
mFaceList.clear() ;
mVolumeList.clear();
#if !NEW_MEDIA_TEXTURE
mIsMediaTexture = false;
#endif //!NEW_MEDIA_TEXTURE
}
//virtual
@@ -632,11 +642,13 @@ bool LLViewerTexture::bindDefaultImage(S32 stage)
//check if there is cached raw image and switch to it if possible
switchToCachedImage() ;
/*LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
#if 0
LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
if (tester)
{
tester->updateGrayTextureBinding() ;
}*/
}
#endif
return res;
}
@@ -1096,11 +1108,13 @@ BOOL LLViewerTexture::isLargeImage()
//virtual
void LLViewerTexture::updateBindStatsForTester()
{
/*LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
#if 0
LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
if (tester)
{
tester->updateTextureBindingStats(this) ;
}*/
}
#endif
}
//----------------------------------------------------------------------------------------------
@@ -1888,12 +1902,14 @@ bool LLViewerFetchedTexture::updateFetch()
// We may have data ready regardless of whether or not we are finished (e.g. waiting on write)
if (mRawImage.notNull())
{
/*LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
#if 0
LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
if (tester)
{
mIsFetched = TRUE ;
tester->updateTextureLoadingStats(this, mRawImage, LLAppViewer::getTextureFetch()->isFromLocalCache(mID)) ;
}*/
}
#endif
mRawDiscardLevel = fetch_discard;
if ((mRawImage->getDataSize() > 0 && mRawDiscardLevel >= 0) &&
(current_discard < 0 || mRawDiscardLevel < current_discard))
@@ -3134,11 +3150,13 @@ void LLViewerLODTexture::scaleDown()
{
switchToCachedImage() ;
/*LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
#if 0
LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName);
if (tester)
{
tester->setStablizingTime() ;
}*/
}
#endif
}
}
//----------------------------------------------------------------------------------------------
@@ -3154,7 +3172,7 @@ void LLViewerMediaTexture::updateClass()
{
static const F32 MAX_INACTIVE_TIME = 30.f ;
#if NEW_MEDIA_TEXTURE
#if 0
//force to play media.
gSavedSettings.setBOOL("AudioStreamingMedia", true) ;
#endif
@@ -3247,7 +3265,7 @@ LLViewerMediaTexture::~LLViewerMediaTexture()
tex->setParcelMedia(NULL) ;
}
}
#endif
#endif //NEW_MEDIA_TEXTURE
void LLViewerMediaTexture::reinit(BOOL usemipmaps /* = TRUE */)
{
llassert(mGLTexturep.notNull()) ;
@@ -3641,7 +3659,7 @@ F32 LLViewerMediaTexture::getMaxVirtualSize()
return mMaxVirtualSize ;
}
#endif
#endif //NEW_MEDIA_TEXTURE
//----------------------------------------------------------------------------------------------
//end of LLViewerMediaTexture
//----------------------------------------------------------------------------------------------
@@ -3743,22 +3761,23 @@ void LLTexturePipelineTester::reset()
//virtual
void LLTexturePipelineTester::outputTestRecord(LLSD *sd)
{
(*sd)[mCurLabel]["TotalBytesLoaded"] = (LLSD::Integer)mTotalBytesLoaded ;
(*sd)[mCurLabel]["TotalBytesLoadedFromCache"] = (LLSD::Integer)mTotalBytesLoadedFromCache ;
(*sd)[mCurLabel]["TotalBytesLoadedForLargeImage"] = (LLSD::Integer)mTotalBytesLoadedForLargeImage ;
(*sd)[mCurLabel]["TotalBytesLoadedForSculpties"] = (LLSD::Integer)mTotalBytesLoadedForSculpties ;
std::string currentLabel = getCurrentLabelName();
(*sd)[currentLabel]["TotalBytesLoaded"] = (LLSD::Integer)mTotalBytesLoaded ;
(*sd)[currentLabel]["TotalBytesLoadedFromCache"] = (LLSD::Integer)mTotalBytesLoadedFromCache ;
(*sd)[currentLabel]["TotalBytesLoadedForLargeImage"] = (LLSD::Integer)mTotalBytesLoadedForLargeImage ;
(*sd)[currentLabel]["TotalBytesLoadedForSculpties"] = (LLSD::Integer)mTotalBytesLoadedForSculpties ;
(*sd)[mCurLabel]["StartFetchingTime"] = (LLSD::Real)mStartFetchingTime ;
(*sd)[mCurLabel]["TotalGrayTime"] = (LLSD::Real)mTotalGrayTime ;
(*sd)[mCurLabel]["TotalStablizingTime"] = (LLSD::Real)mTotalStablizingTime ;
(*sd)[currentLabel]["StartFetchingTime"] = (LLSD::Real)mStartFetchingTime ;
(*sd)[currentLabel]["TotalGrayTime"] = (LLSD::Real)mTotalGrayTime ;
(*sd)[currentLabel]["TotalStablizingTime"] = (LLSD::Real)mTotalStablizingTime ;
(*sd)[mCurLabel]["StartTimeLoadingSculpties"] = (LLSD::Real)mStartTimeLoadingSculpties ;
(*sd)[mCurLabel]["EndTimeLoadingSculpties"] = (LLSD::Real)mEndTimeLoadingSculpties ;
(*sd)[currentLabel]["StartTimeLoadingSculpties"] = (LLSD::Real)mStartTimeLoadingSculpties ;
(*sd)[currentLabel]["EndTimeLoadingSculpties"] = (LLSD::Real)mEndTimeLoadingSculpties ;
(*sd)[mCurLabel]["Time"] = LLImageGL::sLastFrameTime ;
(*sd)[mCurLabel]["TotalBytesBound"] = (LLSD::Integer)mLastTotalBytesUsed ;
(*sd)[mCurLabel]["TotalBytesBoundForLargeImage"] = (LLSD::Integer)mLastTotalBytesUsedForLargeImage ;
(*sd)[mCurLabel]["PercentageBytesBound"] = (LLSD::Real)(100.f * mLastTotalBytesUsed / mTotalBytesLoaded) ;
(*sd)[currentLabel]["Time"] = LLImageGL::sLastFrameTime ;
(*sd)[currentLabel]["TotalBytesBound"] = (LLSD::Integer)mLastTotalBytesUsed ;
(*sd)[currentLabel]["TotalBytesBoundForLargeImage"] = (LLSD::Integer)mLastTotalBytesUsedForLargeImage ;
(*sd)[currentLabel]["PercentageBytesBound"] = (LLSD::Real)(100.f * mLastTotalBytesUsed / mTotalBytesLoaded) ;
}
void LLTexturePipelineTester::updateTextureBindingStats(const LLViewerTexture* imagep)
@@ -3847,7 +3866,7 @@ void LLTexturePipelineTester::compareTestSessions(std::ofstream* os)
}
//compare and output the comparison
*os << llformat("%s\n", mName.c_str()) ;
*os << llformat("%s\n", getTesterName().c_str()) ;
*os << llformat("AggregateResults\n") ;
compareTestResults(os, "TotalFetchingTime", base_sessionp->mTotalFetchingTime, current_sessionp->mTotalFetchingTime) ;
@@ -3902,7 +3921,7 @@ void LLTexturePipelineTester::compareTestSessions(std::ofstream* os)
}
//virtual
LLMetricPerformanceTester::LLTestSession* LLTexturePipelineTester::loadTestSession(LLSD* log)
LLMetricPerformanceTesterWithSession::LLTestSession* LLTexturePipelineTester::loadTestSession(LLSD* log)
{
LLTexturePipelineTester::LLTextureTestSession* sessionp = new LLTexturePipelineTester::LLTextureTestSession() ;
if(!sessionp)
@@ -3929,12 +3948,11 @@ LLMetricPerformanceTester::LLTestSession* LLTexturePipelineTester::loadTestSessi
sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f ;
//load a session
BOOL in_log = (*log).has(mCurLabel) ;
while(in_log)
std::string currentLabel = getCurrentLabelName();
BOOL in_log = (*log).has(currentLabel) ;
while (in_log)
{
LLSD::String label = mCurLabel ;
incLabel() ;
in_log = (*log).has(mCurLabel) ;
LLSD::String label = currentLabel ;
if(sessionp->mInstantPerformanceListCounter >= (S32)sessionp->mInstantPerformanceList.size())
{
@@ -4000,7 +4018,11 @@ LLMetricPerformanceTester::LLTestSession* LLTexturePipelineTester::loadTestSessi
sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond = 0 ;
sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f ;
sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f ;
}
}
// Next label
incrementCurrentCount() ;
currentLabel = getCurrentLabelName();
in_log = (*log).has(currentLabel) ;
}
sessionp->mTotalFetchingTime += total_fetching_time ;
@@ -4040,7 +4062,7 @@ void LLTexturePipelineTester::LLTextureTestSession::reset()
mInstantPerformanceListCounter = 0 ;
}
#endif //0
#endif 0
//----------------------------------------------------------------------------------------------
//end of LLTexturePipelineTester
//----------------------------------------------------------------------------------------------