SL-15221 add VBO dirty bit to avoid many per-frame checks

meow-7.2.2
Dave Houlton 2021-05-05 13:09:16 -06:00
parent 2d53f5ea85
commit 5da88f5a80
2 changed files with 25 additions and 21 deletions

View File

@ -144,9 +144,10 @@ void LLVBOPool::deleteBuffer(U32 name)
LLVBOPool::LLVBOPool(U32 vboUsage, U32 vboType)
: mUsage(vboUsage), mType(vboType)
: mUsage(vboUsage), mType(vboType), mMissCountDirty(true)
{
mMissCount.resize(LL_VBO_POOL_SEED_COUNT);
mFreeList.resize(LL_VBO_POOL_SEED_COUNT);
mMissCount.resize(LL_VBO_POOL_SEED_COUNT);
std::fill(mMissCount.begin(), mMissCount.end(), 0);
}
@ -173,7 +174,8 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
if (!for_seed && i < LL_VBO_POOL_SEED_COUNT)
{ //record this miss
mMissCount[i]++;
}
mMissCountDirty = true; // signal to ::seedPool()
}
if (mType == GL_ARRAY_BUFFER_ARB)
{
@ -226,6 +228,7 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
sIndexBytesPooled += size;
}
mFreeList[i].push_back(rec);
mMissCountDirty = true; // signal to ::seedPool()
}
}
else
@ -243,6 +246,7 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
}
mFreeList[i].pop_front();
mMissCountDirty = true; // signal to ::seedPool()
}
return ret;
@ -267,26 +271,25 @@ void LLVBOPool::release(U32 name, volatile U8* buffer, U32 size)
void LLVBOPool::seedPool()
{
U32 dummy_name = 0;
if (mMissCountDirty)
{
U32 dummy_name = 0;
if (mFreeList.size() < LL_VBO_POOL_SEED_COUNT)
{
mFreeList.resize(LL_VBO_POOL_SEED_COUNT);
}
for (U32 i = 0; i < LL_VBO_POOL_SEED_COUNT; i++)
{
if (mMissCount[i] > mFreeList[i].size())
{
U32 size = i * LL_VBO_BLOCK_SIZE;
for (U32 i = 0; i < LL_VBO_POOL_SEED_COUNT; i++)
{
if (mMissCount[i] > mFreeList[i].size())
{
U32 size = i*LL_VBO_BLOCK_SIZE;
S32 count = mMissCount[i] - mFreeList[i].size();
for (U32 j = 0; j < count; ++j)
{
allocate(dummy_name, size, true);
}
}
}
S32 count = mMissCount[i] - mFreeList[i].size();
for (U32 j = 0; j < count; ++j)
{
allocate(dummy_name, size, true);
}
}
}
mMissCountDirty = false;
}
}

View File

@ -88,6 +88,7 @@ public:
typedef std::list<Record> record_list_t;
std::vector<record_list_t> mFreeList;
std::vector<U32> mMissCount;
bool mMissCountDirty; // flag any changes to mFreeList or mMissCount
};