Optimize Animated Models bones updating with a batches memory pass and manual resource transitions batch

#3917 #3827
This commit is contained in:
Wojtek Figat
2026-02-09 23:03:25 +01:00
parent 0f6c1aea62
commit 55f73b6cf7
4 changed files with 125 additions and 10 deletions

View File

@@ -31,6 +31,13 @@ namespace
Array<RenderList*> FreeRenderList;
Array<Pair<void*, uintptr>> MemPool;
CriticalSection MemPoolLocker;
typedef Array<RenderList::IExtension*, FixedAllocation<8>> ExtensionsList;
ExtensionsList& GetExtensions()
{
static ExtensionsList list;
return list;
}
}
void ShaderObjectData::Store(const Matrix& worldMatrix, const Matrix& prevWorldMatrix, const Rectangle& lightmapUVsArea, const Float3& geometrySize, float perInstanceRandom, float worldDeterminantSign, float lodDitherFactor)
@@ -236,6 +243,16 @@ void RenderList::CleanupCache()
MemPoolLocker.Unlock();
}
RenderList::IExtension::IExtension()
{
GetExtensions().Add(this);
}
RenderList::IExtension::~IExtension()
{
GetExtensions().Remove(this);
}
bool RenderList::BlendableSettings::operator<(const BlendableSettings& other) const
{
// Sort by higher priority
@@ -271,6 +288,20 @@ void RenderList::DrainDelayedDraws(GPUContext* context, RenderContextBatch& rend
_delayedDraws.Clear();
}
#define LOOP_EXTENSIONS() const auto& extensions = GetExtensions(); for (auto* e : extensions)
void RenderList::PreDraw(GPUContext* context, RenderContextBatch& renderContextBatch)
{
LOOP_EXTENSIONS()
e->PreDraw(context, renderContextBatch);
}
void RenderList::PostDraw(GPUContext* context, RenderContextBatch& renderContextBatch)
{
LOOP_EXTENSIONS()
e->PostDraw(context, renderContextBatch);
}
void RenderList::BlendSettings()
{
PROFILE_CPU();