summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorDave Houlton <euclid@lindenlab.com>2021-05-05 13:09:16 -0600
committerDave Houlton <euclid@lindenlab.com>2021-05-06 14:52:47 -0600
commit5da88f5a809fd6f29d7704cfd947226e23714bd1 (patch)
tree2ff0db7770de026058bbdc67b01302504bca2f49 /indra/llrender
parent2d53f5ea859195151bb4bc4d855165ef8b6fc226 (diff)
SL-15221 add VBO dirty bit to avoid many per-frame checks
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llvertexbuffer.cpp45
-rw-r--r--indra/llrender/llvertexbuffer.h1
2 files changed, 25 insertions, 21 deletions
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 7d2b09ca4a..0d39d503d7 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -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;
+ }
}
diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h
index dbe1a3687f..649fbb782c 100644
--- a/indra/llrender/llvertexbuffer.h
+++ b/indra/llrender/llvertexbuffer.h
@@ -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
};