Huge renderer update (WIP). Still plenty to do, especially pertaining to UI.
-Nametag bubble visbility is oddly inconsistent. May vanish with future planned UI merges... -VBOs are PAINFULLY slow on ATI hardware. This repos self-compiled davep/shining-fixes branch, so I'll leave the ball in LL's court for now regarding that.
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
|
||||
// Included to allow LLTextureCache::purgeTextures() to pause watchdog timeout
|
||||
#include "llappviewer.h"
|
||||
#include "llmemory.h"
|
||||
|
||||
// Cache organization:
|
||||
// cache/texture.entries
|
||||
@@ -119,7 +120,7 @@ public:
|
||||
~LLTextureCacheWorker()
|
||||
{
|
||||
llassert_always(!haveWork());
|
||||
delete[] mReadData;
|
||||
FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
|
||||
}
|
||||
|
||||
// override this interface
|
||||
@@ -221,7 +222,7 @@ bool LLTextureCacheLocalFileWorker::doRead()
|
||||
mDataSize = 0;
|
||||
return true;
|
||||
}
|
||||
mReadData = new U8[mDataSize];
|
||||
mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mDataSize);
|
||||
mBytesRead = -1;
|
||||
mBytesToRead = mDataSize;
|
||||
setPriority(LLWorkerThread::PRIORITY_LOW | mPriority);
|
||||
@@ -239,7 +240,7 @@ bool LLTextureCacheLocalFileWorker::doRead()
|
||||
// << " Bytes: " << mDataSize << " Offset: " << mOffset
|
||||
// << " / " << mDataSize << llendl;
|
||||
mDataSize = 0; // failed
|
||||
delete[] mReadData;
|
||||
FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
|
||||
mReadData = NULL;
|
||||
}
|
||||
return true;
|
||||
@@ -254,7 +255,7 @@ bool LLTextureCacheLocalFileWorker::doRead()
|
||||
{
|
||||
mDataSize = local_size/* - mOffset*/;
|
||||
}
|
||||
mReadData = new U8[mDataSize];
|
||||
mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mDataSize);
|
||||
|
||||
S32 bytes_read = LLAPRFile::readEx(mFileName, mReadData, mOffset, mDataSize);
|
||||
|
||||
@@ -264,7 +265,7 @@ bool LLTextureCacheLocalFileWorker::doRead()
|
||||
// << " Bytes: " << mDataSize << " Offset: " << mOffset
|
||||
// << " / " << mDataSize << llendl;
|
||||
mDataSize = 0;
|
||||
delete[] mReadData;
|
||||
FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
|
||||
mReadData = NULL;
|
||||
}
|
||||
else
|
||||
@@ -377,15 +378,16 @@ bool LLTextureCacheRemoteWorker::doRead()
|
||||
mDataSize = local_size/* - mOffset*/;
|
||||
}
|
||||
// Allocate read buffer
|
||||
mReadData = new U8[mDataSize];
|
||||
S32 bytes_read = LLAPRFile::readEx(local_filename, mReadData, mOffset, mDataSize);
|
||||
mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mDataSize);
|
||||
S32 bytes_read = LLAPRFile::readEx(local_filename,
|
||||
mReadData, mOffset, mDataSize);
|
||||
if (bytes_read != mDataSize)
|
||||
{
|
||||
llwarns << "Error reading file from local cache: " << local_filename
|
||||
<< " Bytes: " << mDataSize << " Offset: " << mOffset
|
||||
<< " / " << mDataSize << llendl;
|
||||
mDataSize = 0;
|
||||
delete[] mReadData;
|
||||
FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
|
||||
mReadData = NULL;
|
||||
}
|
||||
else
|
||||
@@ -428,14 +430,14 @@ bool LLTextureCacheRemoteWorker::doRead()
|
||||
S32 size = TEXTURE_CACHE_ENTRY_SIZE - mOffset;
|
||||
size = llmin(size, mDataSize);
|
||||
// Allocate the read buffer
|
||||
mReadData = new U8[size];
|
||||
mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), size);
|
||||
S32 bytes_read = LLAPRFile::readEx(mCache->mHeaderDataFileName, mReadData, offset, size);
|
||||
if (bytes_read != size)
|
||||
{
|
||||
llwarns << "LLTextureCacheWorker: " << mID
|
||||
<< " incorrect number of bytes read from header: " << bytes_read
|
||||
<< " / " << size << llendl;
|
||||
delete[] mReadData;
|
||||
FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
|
||||
mReadData = NULL;
|
||||
mDataSize = -1; // failed
|
||||
done = true;
|
||||
@@ -465,7 +467,7 @@ bool LLTextureCacheRemoteWorker::doRead()
|
||||
S32 data_offset, file_size, file_offset;
|
||||
|
||||
// Reserve the whole data buffer first
|
||||
U8* data = new U8[mDataSize];
|
||||
U8* data = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mDataSize);
|
||||
|
||||
// Set the data file pointers taking the read offset into account. 2 cases:
|
||||
if (mOffset < TEXTURE_CACHE_ENTRY_SIZE)
|
||||
@@ -478,7 +480,7 @@ bool LLTextureCacheRemoteWorker::doRead()
|
||||
// Copy the raw data we've been holding from the header cache into the new sized buffer
|
||||
llassert_always(mReadData);
|
||||
memcpy(data, mReadData, data_offset);
|
||||
delete[] mReadData;
|
||||
FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
|
||||
mReadData = NULL;
|
||||
}
|
||||
else
|
||||
@@ -502,8 +504,8 @@ bool LLTextureCacheRemoteWorker::doRead()
|
||||
{
|
||||
LL_DEBUGS("TextureCache") << "LLTextureCacheWorker: " << mID
|
||||
<< " incorrect number of bytes read from body: " << bytes_read
|
||||
<< " / " << file_size << LL_ENDL;
|
||||
delete[] mReadData;
|
||||
<< " / " << file_size << llendl;
|
||||
FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
|
||||
mReadData = NULL;
|
||||
mDataSize = -1; // failed
|
||||
done = true;
|
||||
@@ -514,7 +516,7 @@ bool LLTextureCacheRemoteWorker::doRead()
|
||||
if (mImageSize > TEXTURE_CACHE_ENTRY_SIZE)
|
||||
{
|
||||
LL_DEBUGS("TextureCache") << "LLTextureCacheWorker: no body for texture: " << mID << LL_ENDL;
|
||||
delete[] mReadData;
|
||||
FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
|
||||
mReadData = NULL;
|
||||
mDataSize = -1; // failed
|
||||
done = true;
|
||||
@@ -605,11 +607,11 @@ bool LLTextureCacheRemoteWorker::doWrite()
|
||||
{
|
||||
// We need to write a full record in the header cache so, if the amount of data is smaller
|
||||
// than a record, we need to transfer the data to a buffer padded with 0 and write that
|
||||
U8* padBuffer = new U8[TEXTURE_CACHE_ENTRY_SIZE];
|
||||
U8* padBuffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), TEXTURE_CACHE_ENTRY_SIZE);
|
||||
memset(padBuffer, 0, TEXTURE_CACHE_ENTRY_SIZE); // Init with zeros
|
||||
memcpy(padBuffer, mWriteData, mDataSize); // Copy the write buffer
|
||||
bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, padBuffer, offset, size);
|
||||
delete [] padBuffer;
|
||||
FREE_MEM(LLImageBase::getPrivatePool(), padBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -704,7 +706,7 @@ void LLTextureCacheWorker::finishWork(S32 param, bool completed)
|
||||
}
|
||||
else
|
||||
{
|
||||
delete[] mReadData;
|
||||
FREE_MEM(LLImageBase::getPrivatePool(), mReadData);
|
||||
mReadData = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user